Browse Source

* encode yield as hex code so the assembler will accept it regardless of the selected CPU type

florian 6 days ago
parent
commit
2a63c7474b
1 changed files with 8 additions and 2 deletions
  1. 8 2
      compiler/arm/narminl.pas

+ 8 - 2
compiler/arm/narminl.pas

@@ -66,7 +66,8 @@ implementation
     uses
     uses
       globtype,verbose,globals,
       globtype,verbose,globals,
       procinfo,
       procinfo,
-      compinnr,cpuinfo,defutil,symdef,aasmdata,aasmcpu,
+      compinnr,cpuinfo,defutil,symdef,
+      aasmdata,aasmcpu,aasmtai,
       cgbase,cgutils,pass_1,pass_2,
       cgbase,cgutils,pass_1,pass_2,
       cpubase,ncgutil,cgobj,cgcpu, hlcgobj,
       cpubase,ncgutil,cgobj,cgcpu, hlcgobj,
       nutils,ncal;
       nutils,ncal;
@@ -106,7 +107,12 @@ implementation
        begin
        begin
          case inlinenumber of
          case inlinenumber of
            in_arm_yield:
            in_arm_yield:
-             current_asmdata.CurrAsmList.concat(taicpu.op_none(A_YIELD));
+             if CPUARM_HAS_MP_INSTRUCTIONS in cpu_capabilities[current_settings.cputype] then
+               current_asmdata.CurrAsmList.concat(taicpu.op_none(A_YIELD))
+             else
+               { while yield is a no op operation if not supported by the cpu, assemblers do not
+                 handle it, so encode it in hex if the cpu does not support it }
+               current_asmdata.CurrAsmList.concat(tai_const.Create_32bit(longint($e320f001)));
            else
            else
              inherited pass_generate_code_cpu;
              inherited pass_generate_code_cpu;
          end;
          end;