Przeglądaj źródła

* optimized mul code generation

florian 21 lat temu
rodzic
commit
9594866b30
1 zmienionych plików z 9 dodań i 1 usunięć
  1. 9 1
      compiler/arm/cgcpu.pas

+ 9 - 1
compiler/arm/cgcpu.pas

@@ -299,6 +299,7 @@ unit cgcpu;
          shift : byte;
          tmpreg : tregister;
          so : tshifterop;
+         l1 : longint;
        begin
           if is_shifter_const(dword(-a),shift) then
             case op of
@@ -373,6 +374,10 @@ unit cgcpu;
                 a_load_const_reg(list,size,0,dst)
               else if (op in [OP_IMUL]) and (a=-1) then
                 a_op_reg_reg(list,OP_NEG,size,src,dst)
+              { we do this here instead in the peephole optimizer because
+                it saves us a register }
+              else if (op in [OP_MUL,OP_IMUL]) and ispowerof2(a,l1) then
+                a_op_const_reg_reg(list,OP_SHL,size,l1,src,dst)
               else
                 begin
                   tmpreg:=getintregister(list,size);
@@ -1283,7 +1288,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.48  2004-03-14 16:15:40  florian
+  Revision 1.49  2004-03-14 21:42:24  florian
+    * optimized mul code generation
+
+  Revision 1.48  2004/03/14 16:15:40  florian
     * spilling problem fixed
     * handling of floating point memory references fixed