aboutsummaryrefslogtreecommitdiffhomepage
path: root/amd64/isel.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-09-14 19:23:21 +0200
committerlemon <lsof@mailbox.org>2025-09-14 19:23:21 +0200
commit6cb4382b0128942f4ba57ab26021be1e5715f2bc (patch)
tree0b63731286acbe503981958930aeae93816b6b34 /amd64/isel.c
parent7a318363ec4fdcd80d9d0154cef393c9bf205d5e (diff)
codegen: float cmp, ior; frontend: fix cond expr bug
Diffstat (limited to 'amd64/isel.c')
-rw-r--r--amd64/isel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index 1054502..5cd5526 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -65,9 +65,12 @@ fixarg(union ref *r, struct instr *ins, struct block *blk, int *curi)
/* add X, INT32MAX+1 -> sub X, INT32MIN */
ins->op = Oadd + (op == Oadd);
*r = mkintcon(KI4, -2147483648);
- } else if ((in_range(op, Ocopy, Omove) || op == Ophi) && kisflt(con->cls) && con->f == 0) {
+ } else if (kisflt(con->cls) && con->f == 0) {
/* copy of float zero -> regular zero, that emit() will turn into xor x,x */
- *r = mkref(RICON, 0);
+ if (in_range(op, Ocopy, Omove) || op == Ophi)
+ *r = ZEROREF;
+ else
+ *r = insertinstr(blk, (*curi)++, mkinstr(Ocopy, con->cls, ZEROREF));
} else if (kisflt(con->cls) || con->cls == KI8) {
/* float immediates & >32b immediates are loaded from memory */
uchar data[8];