From 65244dba4adf96c0c0483b30f3a36089d41bcb67 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 12 Nov 2025 17:59:29 +0100 Subject: amd64/isel: fold Oext with immediates --- amd64/isel.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v1.2.3