mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 20:00:19 +02:00
* Xtensa: generate better code for adding/subtracting 16 bit constants
git-svn-id: trunk@44839 -
This commit is contained in:
parent
702e63e59f
commit
7b2bd0b917
@ -494,8 +494,25 @@ 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_ADD) and (a>=-128-32768) and (a<=127+32512) then
|
||||
begin
|
||||
{$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_ADDI,dst,dst,Shortint(a and $ff)));
|
||||
end
|
||||
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_SUB) and (a>=-127-32512) and (a<=128+32768) then
|
||||
begin
|
||||
{$ifdef EXTDEBUG}
|
||||
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_ADDI,dst,dst,Shortint(a and $ff)));
|
||||
end
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user