From 1e3093b6208d33c6cdbb355078fc7b6d66f7f9d1 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 7 Aug 2023 23:10:55 +0200 Subject: amd64: fix isel for numeric conversion ops --- amd64/isel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'amd64') diff --git a/amd64/isel.c b/amd64/isel.c index df972fd..fcd4ab3 100644 --- a/amd64/isel.c +++ b/amd64/isel.c @@ -357,14 +357,12 @@ sel(struct function *fn, struct instr *ins, struct block *blk, int *curi) if (iscon(ins->l)) rswap(ins->l, ins->r); case Oneg: case Onot: - case Ocvtf4f8: case Ocvtf8f4: case Ocvtf4s: case Ocvtf8s: - case Oexts1: case Oextu1: case Oexts2: case Oextu2: case Oexts4: case Oextu4: ALU: if (!(op == Oadd && kisint(ins->cls))) /* 3-address add is lea */ if (!(in_range(op, Omul, Oumul) && kisint(ins->cls) && isimm32(ins->r))) /* for (I)MUL r,r/m,imm */ ins->inplace = 1; - if (ins->l.t != RTMP && ins->l.t != RREG) - ins->l = insertinstr(blk, (*curi)++, mkinstr(Ocopy, ins->cls, ins->l)); + if (iscon(ins->l)) + ins->l = insertinstr(blk, (*curi)++, mkinstr(Ocopy, concls(ins->l), ins->l)); if (ins->r.bits) case Omove: fixarg(&ins->r, ins, blk, curi); @@ -379,6 +377,8 @@ sel(struct function *fn, struct instr *ins, struct block *blk, int *curi) ins->l = insertinstr(blk, (*curi)++, mkinstr(Ocopy, KPTR, ins->l)); fixarg(&ins->r, ins, blk, curi); break; + case Ocvtf4f8: case Ocvtf8f4: case Ocvtf4s: case Ocvtf8s: + case Oexts1: case Oextu1: case Oexts2: case Oextu2: case Oexts4: case Oextu4: case Ocopy: fixarg(&ins->l, ins, blk, curi); break; -- cgit v1.2.3