mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-05 21:27:23 +01:00
* x86: Fixed bug with BT optimisation where operand
sizes bigger than the register word size caused
incorrect code generation (fixes #40358)
This commit is contained in:
parent
62bc640306
commit
e4d5de8d05
@ -723,10 +723,10 @@ implementation
|
|||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,u32inttype,true);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,u32inttype,true);
|
||||||
register_maybe_adjust_setbase(current_asmdata.CurrAsmList,u32inttype,left.location,setbase);
|
register_maybe_adjust_setbase(current_asmdata.CurrAsmList,u32inttype,left.location,setbase);
|
||||||
|
|
||||||
if (tcgsize2size[right.location.size] < 4) or
|
if (tcgsize2size[right.location.size] < opdef.size) or
|
||||||
(right.location.loc = LOC_CONSTANT) or
|
(right.location.loc = LOC_CONSTANT) or
|
||||||
{ bt ...,[mem] is slow, see #40039, so try to use a register if we are not optimizing for size }
|
{ bt ...,[mem] is slow, see #40039, so try to use a register if we are not optimizing for size }
|
||||||
((right.resultdef.size<=sizeof(aint)) and not(cs_opt_size in current_settings.optimizerswitches)) then
|
((right.resultdef.size<=u32inttype.size) and not(cs_opt_size in current_settings.optimizerswitches)) then
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,u32inttype,true);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,u32inttype,true);
|
||||||
|
|
||||||
hreg:=left.location.register;
|
hreg:=left.location.register;
|
||||||
@ -971,7 +971,7 @@ implementation
|
|||||||
|
|
||||||
if (right.location.loc in [LOC_REGISTER,LOC_CREGISTER]) or
|
if (right.location.loc in [LOC_REGISTER,LOC_CREGISTER]) or
|
||||||
{ bt ...,[mem] is slow, see #40039, so try to use a register if we are not optimizing for size }
|
{ bt ...,[mem] is slow, see #40039, so try to use a register if we are not optimizing for size }
|
||||||
((right.resultdef.size<=sizeof(aint)) and not(cs_opt_size in current_settings.optimizerswitches)) then
|
((right.resultdef.size<=opdef.size) and not(cs_opt_size in current_settings.optimizerswitches)) then
|
||||||
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,opdef,true);
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,opdef,true);
|
||||||
|
|
||||||
pleftreg:=left.location.register;
|
pleftreg:=left.location.register;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user