From 6dbde11f5a46550784eb4d288b765c4339cf3c4c Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 17 Nov 2018 15:08:22 +0000 Subject: [PATCH] * three operand shl for shifting by 2, 4 or 8 can be simulated by lea git-svn-id: trunk@40337 - --- compiler/x86/cgx86.pas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index a1c02656f6..fc6a488d0f 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -2080,6 +2080,14 @@ unit cgx86; reference_reset_base(href,src,al,ctempposinvalid,0,[]); list.concat(taicpu.op_ref_reg(A_LEA,TCgSize2OpSize[size],href,dst)); end + else if (op=OP_SHL) and (size in [OS_32,OS_S32,OS_64,OS_S64]) and + (int64(a)>=1) and (int64(a)<=3) then + begin + reference_reset_base(href,NR_NO,0,ctempposinvalid,0,[]); + href.index:=src; + href.scalefactor:=1 shl longint(a); + list.concat(taicpu.op_ref_reg(A_LEA,TCgSize2OpSize[size],href,dst)); + end else if (op=OP_SUB) and ((size in [OS_32,OS_S32]) or { lea supports only 32 bit signed displacments }