aboutsummaryrefslogtreecommitdiffhomepage
path: root/amd64
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-02 14:27:14 +0100
committerlemon <lsof@mailbox.org>2025-12-02 14:27:14 +0100
commit3c6e4dd54d5c144369b96d6673da7f23df4940da (patch)
tree6f331c91187641c15aeef23f21e456fdc09561ec /amd64
parentc14321c4d35549d989d614437953b36b8c771cc2 (diff)
test/11-abi
Diffstat (limited to 'amd64')
-rw-r--r--amd64/isel.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index 3611670..9634103 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -68,8 +68,8 @@ 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(KI32, -2147483648);
- } else if (kisflt(con->cls) && con->f == 0) {
- /* copy of float zero -> regular zero, that emit() will turn into xor x,x */
+ } else if (kisflt(con->cls) && con->i == 0) {
+ /* copy of positive float zero -> regular zero, that emit() will turn into xor x,x */
if (in_range(op, Ocopy, Omove) || op == Ophi)
*r = ZEROREF;
else
@@ -176,10 +176,13 @@ selcall(struct function *fn, struct instr *ins, struct block *blk, int *curi)
/* duplicate to reuse same TMP ref */
insertinstr(blk, (*curi)++, *ins);
*ins = mkinstr(Ocopy, cls, mkref(RREG, call->abiret[0].reg));
- if (*curi + 1 < blk->ins.n)
- if (instrtab[blk->ins.p[*curi + 1]].op == Ocall2r) {
- ins = &instrtab[blk->ins.p[++*curi]];
- *ins = mkinstr(Ocopy, ins->cls, mkref(RREG, call->abiret[1].reg));
+ for (int i = 1; i <= 2; ++i) {
+ if (*curi + i >= blk->ins.n) break;
+ if (instrtab[blk->ins.p[*curi + i]].op == Ocall2r) {
+ ins = &instrtab[blk->ins.p[*curi += i]];
+ *ins = mkinstr(Ocopy, ins->cls, mkref(RREG, call->abiret[1].reg));
+ break;
+ }
}
}
}