* use 3 op cgobj methods when doing shl/shr code generation, this allows the cg to generate better code on risc archs having 3 operand shifts

git-svn-id: trunk@14487 -
This commit is contained in:
florian 2009-12-27 20:19:23 +00:00
parent 1583907ac4
commit 0d57b2d8da

View File

@ -412,12 +412,13 @@ implementation
shrn: op:=OP_SHR; shrn: op:=OP_SHR;
end; end;
{ load left operators in a register } { load left operators in a register }
location_copy(location,left.location);
if is_signed(left.resultdef) then if is_signed(left.resultdef) then
opsize:=OS_SINT opsize:=OS_SINT
else else
opsize:=OS_INT; opsize:=OS_INT;
location_force_reg(current_asmdata.CurrAsmList,location,opsize,false); location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true);
location_reset(location,LOC_REGISTER,opsize);
location.register:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
{ shifting by a constant directly coded: } { shifting by a constant directly coded: }
if (right.nodetype=ordconstn) then if (right.nodetype=ordconstn) then
@ -425,8 +426,8 @@ implementation
{ l shl 32 should 0 imho, but neither TP nor Delphi do it in this way (FK) { l shl 32 should 0 imho, but neither TP nor Delphi do it in this way (FK)
if right.value<=31 then if right.value<=31 then
} }
cg.a_op_const_reg(current_asmdata.CurrAsmList,op,location.size, cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,op,location.size,
tordconstnode(right).value.uvalue and 31,location.register); tordconstnode(right).value.uvalue and 31,left.location.register,location.register);
{ {
else else
emit_reg_reg(A_XOR,S_L,hregister1, emit_reg_reg(A_XOR,S_L,hregister1,
@ -446,7 +447,7 @@ implementation
end end
else else
hcountreg:=right.location.register; hcountreg:=right.location.register;
cg.a_op_reg_reg(current_asmdata.CurrAsmList,op,opsize,hcountreg,location.register); cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,opsize,hcountreg,left.location.register,location.register);
end; end;
end; end;