aboutsummaryrefslogtreecommitdiffhomepage
path: root/x86_64
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-31 11:13:15 +0100
committerlemon <lsof@mailbox.org>2025-12-31 11:13:15 +0100
commit97c6d5c44f30b29b52d1dc431ab9f2df4bb47fd2 (patch)
tree564615d402793491d545d612df31dd80451120ab /x86_64
parent3a46902b3ede49116522992793d3ececef53c5a8 (diff)
backend: separate instrs for integer/float store
Diffstat (limited to 'x86_64')
-rw-r--r--x86_64/emit.c12
-rw-r--r--x86_64/isel.c4
-rw-r--r--x86_64/sysv.c14
3 files changed, 15 insertions, 15 deletions
diff --git a/x86_64/emit.c b/x86_64/emit.c
index b0b4f58..783ea20 100644
--- a/x86_64/emit.c
+++ b/x86_64/emit.c
@@ -979,14 +979,14 @@ emitinstr(uchar **pcode, struct function *fn, struct block *blk, int curi, struc
dst = reg2oper(ins->reg-1);
gencopy(pcode, cls, blk, curi, dst, ins->l);
break;
- case Ostore8: cls = KI32, X = Xmovb; goto Store;
- case Ostore16: cls = KI32, X = Xmovw; goto Store;
- case Ostore32: cls = KI32, X = Xmov; goto Store;
- case Ostore64: cls = KI64, X = Xmov;
+ case Ostorei8: cls = KI32, X = Xmovb; goto Store;
+ case Ostorei16: cls = KI32, X = Xmovw; goto Store;
+ case Ostorei32: cls = KI32, X = Xmov; goto Store;
+ case Ostorei64: cls = KI64, X = Xmov; goto Store;
+ case Ostoref32: cls = KF32, X = Xmov; goto Store;
+ case Ostoref64: cls = KF64, X = Xmov; goto Store;
Store:
src = mkimmregoper(ins->r);
- if (cls == KI32 && src.t == OREG && src.reg >= XMM0) cls = KF32;
- if (cls == KI64 && src.t == OREG && src.reg >= XMM0) cls = KF64;
X(pcode, cls, mkmemoper(ins->l), src);
break;
case Oexts8: src = mkregoper(ins->l); goto Movsxb;
diff --git a/x86_64/isel.c b/x86_64/isel.c
index d69f9ad..8a845ef 100644
--- a/x86_64/isel.c
+++ b/x86_64/isel.c
@@ -139,7 +139,7 @@ selcall(struct function *fn, struct instr *ins, struct block *blk, int *curi)
union ref adr = mkaddr((struct addr){mkref(RREG, RSP), .disp = abi.stk});
int iargsave = iarg;
if (!abi.ty.isagg) { /* scalar arg in stack */
- *arg = mkinstr(Ostore8+ilog2(cls2siz[abi.ty.cls]), 0, adr, arg->r);
+ *arg = mkinstr(cls2store[abi.ty.cls], 0, adr, arg->r);
if (isaddrcon(arg->r,1) || arg->r.t == RADDR)
arg->r = insertinstr(blk, iarg++, mkinstr(Ocopy, abi.ty.cls, arg->r));
else
@@ -497,7 +497,7 @@ sel(struct function *fn, struct instr *ins, struct block *blk, int *curi)
case Oloads32: case Oloadu32: case Oloadi64: case Oloadf32: case Oloadf64:
loadstoreaddr(blk, &ins->l, curi);
break;
- case Ostore8: case Ostore16: case Ostore32: case Ostore64:
+ case Ostorei8: case Ostorei16: case Ostorei32: case Ostorei64: case Ostoref32: case Ostoref64:
loadstoreaddr(blk, &ins->l, curi);
if (isaddrcon(ins->r,1) || ins->r.t == RADDR)
ins->r = insertinstr(blk, (*curi)++, mkinstr(Ocopy, KPTR, ins->r));
diff --git a/x86_64/sysv.c b/x86_64/sysv.c
index 6313b07..317f40f 100644
--- a/x86_64/sysv.c
+++ b/x86_64/sysv.c
@@ -195,16 +195,16 @@ vastart(struct function *fn, struct block *blk, int *curi)
*ins = mkinstr(Oadd, KPTR, ap, mkref(RICON, 16));
dst = mkref(RTMP, ins - instrtab);
int i = *curi + 1;
- insertinstr(blk, i++, mkinstr(Ostore64, 0, dst, rsave));
+ insertinstr(blk, i++, mkinstr(Ostorei64, 0, dst, rsave));
/* set ap->overflow_arg_area */
src = insertinstr(blk, i++, mkinstr(Oadd, KPTR, mkref(RREG, RBP), mkref(RICON, 16+stk0)));
dst = insertinstr(blk, i++, mkinstr(Oadd, KPTR, ap, mkref(RICON, 8)));
- insertinstr(blk, i++, mkinstr(Ostore64, 0, dst, src));
+ insertinstr(blk, i++, mkinstr(Ostorei64, 0, dst, src));
/* set ap->gp_offset */
- insertinstr(blk, i++, mkinstr(Ostore32, 0, ap, mkref(RICON, gpr0*8)));
+ insertinstr(blk, i++, mkinstr(Ostorei32, 0, ap, mkref(RICON, gpr0*8)));
/* set ap->fp_offset */
dst = insertinstr(blk, i++, mkinstr(Oadd, KPTR, ap, mkref(RICON, 4)));
- insertinstr(blk, i++, mkinstr(Ostore32, 0, dst, mkref(RICON, 6*8 + fpr0*16)));
+ insertinstr(blk, i++, mkinstr(Ostorei32, 0, dst, mkref(RICON, 6*8 + fpr0*16)));
*curi = i-1;
}
@@ -246,7 +246,7 @@ vaarg(struct function *fn, struct block *blk, int *curi)
phiargs[0] = irbinop(fn, Oadd, KPTR, sav, roff);
/* l->gp/fp_offset += num_gp/fp * 8(16) */
roff = irbinop(fn, Oadd, KI32, roff, mkref(RICON, ni ? ni * 8 : nf * 16));
- addinstr(fn, mkinstr(Ostore32, 0, irbinop(fn, Oadd, KPTR, ap, mkref(RICON, ni ? 0 : 4)), roff));
+ addinstr(fn, mkinstr(Ostorei32, 0, irbinop(fn, Oadd, KPTR, ap, mkref(RICON, ni ? 0 : 4)), roff));
assert(merge->npred == 1);
blkpred(merge, 0) = blk->s1;
blk->s1->jmp.t = Jb;
@@ -262,7 +262,7 @@ vaarg(struct function *fn, struct block *blk, int *curi)
phiargs[1] = ovf;
/* update l->overflow_arg_area += size */
int siz = 8;
- addinstr(fn, mkinstr(Ostore64, 0, adr, irbinop(fn, Oadd, KPTR, ovf, mkref(RICON, siz))));
+ addinstr(fn, mkinstr(Ostorei64, 0, adr, irbinop(fn, Oadd, KPTR, ovf, mkref(RICON, siz))));
putbranch(fn, merge);
}
assert(merge->npred == 2);
@@ -276,7 +276,7 @@ vaarg(struct function *fn, struct block *blk, int *curi)
} else {
instrtab[var] = mkalloca(8, 8);
tmp = insertinstr(merge, 1, mkinstr(Oloadi64, KI64, phi));
- insertinstr(merge, 2, mkinstr(Ostore64, 0, mkref(RTMP, var), tmp));
+ insertinstr(merge, 2, mkinstr(Ostorei64, 0, mkref(RTMP, var), tmp));
}
fn->prop &= ~FNUSE;
} else {