Browse Source

* Xtensa: patch by Christo Crause: fix addmi/addi handling, resolves #37015

git-svn-id: trunk@45258 -
florian 5 years ago
parent
commit
724676db43
1 changed files with 2 additions and 2 deletions
  1. 2 2
      compiler/xtensa/cgcpu.pas

+ 2 - 2
compiler/xtensa/cgcpu.pas

@@ -499,7 +499,7 @@ implementation
 {$ifdef EXTDEBUG}
             list.concat(tai_comment.Create(strpnew('Value: '+tostr(a))));
 {$endif EXTDEBUG}
-            list.concat(taicpu.op_reg_reg_const(A_ADDMI,dst,src,Smallint(a and $ff00)));
+            list.concat(taicpu.op_reg_reg_const(A_ADDMI,dst,src,Smallint((a+128) and $ff00)));
             list.concat(taicpu.op_reg_reg_const(A_ADDI,dst,dst,Shortint(a and $ff)));
           end
         else if (op=OP_SUB) and (a>=-127) and (a<=128) then
@@ -510,7 +510,7 @@ implementation
             list.concat(tai_comment.Create(strpnew('Value: '+tostr(a))));
 {$endif EXTDEBUG}
             a:=-a;
-            list.concat(taicpu.op_reg_reg_const(A_ADDMI,dst,src,Smallint(a and $ff00)));
+            list.concat(taicpu.op_reg_reg_const(A_ADDMI,dst,src,Smallint((a+128) and $ff00)));
             list.concat(taicpu.op_reg_reg_const(A_ADDI,dst,dst,Shortint(a and $ff)));
           end
         else if (op=OP_SHL) and (a>=1) and (a<=31) then