Browse Source

* generate signed comparisons for immediate equality comparisons if
possible, because those can be optimized better by the peephole
optimizer

git-svn-id: trunk@2235 -

Jonas Maebe 19 years ago
parent
commit
1273e0d7ed
1 changed files with 5 additions and 4 deletions
  1. 5 4
      compiler/powerpc/cgcpu.pas

+ 5 - 4
compiler/powerpc/cgcpu.pas

@@ -848,12 +848,13 @@ const
           signed: boolean;
           signed: boolean;
 
 
         begin
         begin
-          signed := cmp_op in [OC_GT,OC_LT,OC_GTE,OC_LTE];
+          signed := cmp_op in [OC_GT,OC_LT,OC_GTE,OC_LTE,OC_EQ,OC_NE];
           { in the following case, we generate more efficient code when }
           { in the following case, we generate more efficient code when }
-          { signed is true                                              }
+          { signed is false                                              }
           if (cmp_op in [OC_EQ,OC_NE]) and
           if (cmp_op in [OC_EQ,OC_NE]) and
-             (aword(a) > $ffff) then
-            signed := true;
+             (aword(a) >= $8000) and
+             (aword(a) <= $ffff) then
+            signed := false;
           if signed then
           if signed then
             if (a >= low(smallint)) and (a <= high(smallint)) Then
             if (a >= low(smallint)) and (a <= high(smallint)) Then
               list.concat(taicpu.op_reg_reg_const(A_CMPWI,NR_CR0,reg,a))
               list.concat(taicpu.op_reg_reg_const(A_CMPWI,NR_CR0,reg,a))