w6c+selfhost: cgen N_CAST signed narrow + peel !T on unsigned narrow
TY_RUNE excluded — wwstage primsize skips it; task #5 will collapse both gates back to symmetric once type_isunsigned recurses TY_ENUM.
This commit is contained in:
@@ -494,11 +494,41 @@ export fn encode(a: *asm_) i32 = {
|
||||
emitmodrmmem(a, rcode(tt), p.from.reg, p.from.offset);
|
||||
p = p.link; continue;
|
||||
};};
|
||||
if (isgpr(ft)) { if (isgpr(tt)) {
|
||||
emitrex(a, rhi(tt), rhi(ft), 1);
|
||||
emitbyte(a, 15u8);
|
||||
emitbyte(a, 191u8); // 0xBF
|
||||
emitbyte(a, modrmbyte(3, rcode(tt), rcode(ft)));
|
||||
p = p.link; continue;
|
||||
};};
|
||||
os.write(2, "w6a: unsupported MOVSWQ shape\n".ptr, 29u64);
|
||||
a.errs += 1;
|
||||
p = p.link; continue;
|
||||
};
|
||||
|
||||
if (op == A_MOVSBQ) {
|
||||
// MOVSX r64, r/m8 — 0F BE /r with REX.W.
|
||||
let ft: i32 = p.from.atype;
|
||||
let tt: i32 = p.to.atype;
|
||||
if (ft == D_INDIR) { if (isgpr(tt)) {
|
||||
emitrex(a, rhi(tt), rhi(p.from.reg), 1);
|
||||
emitbyte(a, 15u8);
|
||||
emitbyte(a, 190u8); // 0xBE
|
||||
emitmodrmmem(a, rcode(tt), p.from.reg, p.from.offset);
|
||||
p = p.link; continue;
|
||||
};};
|
||||
if (isgpr(ft)) { if (isgpr(tt)) {
|
||||
emitrex(a, rhi(tt), rhi(ft), 1);
|
||||
emitbyte(a, 15u8);
|
||||
emitbyte(a, 190u8); // 0xBE
|
||||
emitbyte(a, modrmbyte(3, rcode(tt), rcode(ft)));
|
||||
p = p.link; continue;
|
||||
};};
|
||||
os.write(2, "w6a: unsupported MOVSBQ shape\n".ptr, 29u64);
|
||||
a.errs += 1;
|
||||
p = p.link; continue;
|
||||
};
|
||||
|
||||
if (op == A_MOVZBQ) {
|
||||
let ft: i32 = p.from.atype;
|
||||
let tt: i32 = p.to.atype;
|
||||
@@ -549,6 +579,12 @@ export fn encode(a: *asm_) i32 = {
|
||||
emitmodrmmem(a, rcode(tt), p.from.reg, p.from.offset);
|
||||
p = p.link; continue;
|
||||
};};
|
||||
if (isgpr(ft)) { if (isgpr(tt)) {
|
||||
emitrex(a, rhi(tt), rhi(ft), 1);
|
||||
emitbyte(a, 99u8); // 0x63
|
||||
emitbyte(a, modrmbyte(3, rcode(tt), rcode(ft)));
|
||||
p = p.link; continue;
|
||||
};};
|
||||
os.write(2, "w6a: unsupported MOVSXD shape\n".ptr, 29u64);
|
||||
a.errs += 1;
|
||||
p = p.link; continue;
|
||||
|
||||
Reference in New Issue
Block a user