diff options
| author | 2023-07-06 20:47:26 +0200 | |
|---|---|---|
| committer | 2023-07-06 20:47:26 +0200 | |
| commit | b02aecc21e951484fcb2702f2e3328e76cd9064d (patch) | |
| tree | b764e90d38c70b1230a9c47e82d07c4d81fc099b | |
| parent | eca20d8849d3593acd76256ca15989f2f71c5566 (diff) | |
fix emit() setcc and copy
| -rw-r--r-- | amd64/emit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/amd64/emit.c b/amd64/emit.c index 8f3286a..088809d 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -632,7 +632,7 @@ Xsetcc(uchar **pcode, enum cc cc, enum reg reg) if (in_range(reg, RSP, RDI)) rex = 0x40; rex |= (reg >> 3); /* REX.B */ - if (rex) B(rex); + if (rex) B(rex | 0x40); B(0x0F), B(0x90+cc); /* SETcc */ B(0xC0 + (reg & 7)); /* ModR/M with mod=11, rm=reg */ @@ -687,6 +687,7 @@ gencopy(uchar **pcode, enum irclass cls, struct block *blk, int curi, struct ope * which may clobber flags */ const struct addr *addr = &addrht[val.i]; if (flagslivep(blk, curi)) goto Lea; + if (addr->base.t != RREG) goto Lea; if (addr->base.bits && dst.reg == mkregoper(addr->base).reg) { /* base = dst */ if (addr->index.bits && !addr->disp && !addr->shift){ /* lea Rx, [Rx + Ry] -> add Rx, Ry */ |