Jelajahi Sumber

+ optimize SUB for small constants using ADDI

git-svn-id: trunk@44620 -
florian 5 tahun lalu
induk
melakukan
2e23e2b0fd
1 mengubah file dengan 2 tambahan dan 0 penghapusan
  1. 2 0
      compiler/xtensa/cgcpu.pas

+ 2 - 0
compiler/xtensa/cgcpu.pas

@@ -470,6 +470,8 @@ implementation
           a_op_const_reg_reg(list,OP_SHL,size,l1,src,dst)
         else if (op=OP_ADD) and (a>=-128) and (a<=127) then
           list.concat(taicpu.op_reg_reg_const(A_ADDI,dst,src,a))
+        else if (op=OP_SUB) and (a>=-127) and (a<=128) then
+          list.concat(taicpu.op_reg_reg_const(A_ADDI,dst,src,-a))
         else if (op=OP_SHL) and (a>=1) and (a<=31) then
           list.concat(taicpu.op_reg_reg_const(A_SLLI,dst,src,a))
         else if (op=OP_SHR) and (a>=0) and (a<=15) then