aboutsummaryrefslogtreecommitdiffhomepage
path: root/amd64/isel.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-11-12 17:59:29 +0100
committerlemon <lsof@mailbox.org>2025-11-12 18:03:51 +0100
commit65244dba4adf96c0c0483b30f3a36089d41bcb67 (patch)
treefb10644adf2c703bff8bb2dc8e44b8cc9f569d53 /amd64/isel.c
parent82a3c1cd8d00bc342752c31116c497c52f6d8933 (diff)
amd64/isel: fold Oext with immediates
Diffstat (limited to 'amd64/isel.c')
-rw-r--r--amd64/isel.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index c0c6054..23645bb 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -446,6 +446,14 @@ sel(struct function *fn, struct instr *ins, struct block *blk, int *curi)
case Ocvtf4f8: case Ocvtf8f4: case Ocvtf4s: case Ocvtf8s: case Ocvts4f: case Ocvts8f:
case Ocvtu8f:
case Oexts1: case Oextu1: case Oexts2: case Oextu2: case Oexts4: case Oextu4:
+ if (isnumcon(ins->l)) {
+ union ref it;
+ bool ok = foldunop(&it, ins->op, ins->cls, ins->l);
+ assert(ok);
+ ins->op = Ocopy;
+ ins->l = it;
+ break;
+ }
case Ocopy:
fixarg(&ins->l, ins, blk, curi);
break;