Browse Source

Don't generate IT instruction in second_cmp64bit for Thumb-2

Currently the register spiller can not handle the "bond" between IT* and
a following instruction, sometimes breaking them apart, which breaks the
build or worse the result.

So for now we're not emitting A_IT* in second_cmp64bit anymore but use a
conditional jump instead.

This fixes Mantis #22520

git-svn-id: trunk@22009 -
masta 13 years ago
parent
commit
8a684c1f10
1 changed files with 9 additions and 2 deletions
  1. 9 2
      compiler/arm/narmadd.pas

+ 9 - 2
compiler/arm/narmadd.pas

@@ -327,6 +327,7 @@ interface
         unsigned : boolean;
         unsigned : boolean;
         oldnodetype : tnodetype;
         oldnodetype : tnodetype;
         dummyreg : tregister;
         dummyreg : tregister;
+        l: tasmlabel;
       begin
       begin
         unsigned:=not(is_signed(left.resultdef)) or
         unsigned:=not(is_signed(left.resultdef)) or
                   not(is_signed(right.resultdef));
                   not(is_signed(right.resultdef));
@@ -365,8 +366,14 @@ interface
                 location.resflags:=getresflags(unsigned);
                 location.resflags:=getresflags(unsigned);
                 current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi));
                 current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi));
                 if current_settings.cputype in cpu_thumb2 then
                 if current_settings.cputype in cpu_thumb2 then
-                  current_asmdata.CurrAsmList.concat(taicpu.op_cond(A_IT, C_EQ));
-                current_asmdata.CurrAsmList.concat(setcondition(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo),C_EQ));
+                  begin
+                    current_asmdata.getjumplabel(l);
+                    cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,l);
+                    current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo));
+                    cg.a_label(current_asmdata.CurrAsmList,l);
+                  end
+                else
+                  current_asmdata.CurrAsmList.concat(setcondition(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo),C_EQ));
               end
               end
             else
             else
             { operation requiring proper N, Z and V flags ? }
             { operation requiring proper N, Z and V flags ? }