aboutsummaryrefslogtreecommitdiffhomepage
path: root/x86_64/isel.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-20 07:54:46 +0100
committerlemon <lsof@mailbox.org>2025-12-20 10:31:27 +0100
commitf7167c9ec81a0e8cd99f6692fa60ae1d476c9758 (patch)
tree6819df34361e1cb4efeb6ab448204b89b39fba6e /x86_64/isel.c
parent0b62a35ad498885bfbeba273ccc132ae8f776789 (diff)
x86-64: peephole optimization for 3-address shift -> lea
Diffstat (limited to 'x86_64/isel.c')
-rw-r--r--x86_64/isel.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/x86_64/isel.c b/x86_64/isel.c
index 19692ed..2b087cd 100644
--- a/x86_64/isel.c
+++ b/x86_64/isel.c
@@ -507,6 +507,7 @@ sel(struct function *fn, struct instr *ins, struct block *blk, int *curi)
ALU:
if (!(op == Oadd && kisint(ins->cls))) /* 3-address add is lea */
if (!(op == Omul && kisint(ins->cls) && isimm32(ins->r))) /* for (I)MUL r,r/m,imm */
+ if (!(op == Oshl && ins->r.t == RICON && ins->r.i <= 3)) /* can be lea */
ins->inplace = 1;
if (iscon(ins->l)) {
fixarg(&ins->l, ins, blk, curi);