x86_64: rewrite vector @truncate

This commit is contained in:
Jacob Young 2025-02-03 01:10:34 -05:00
parent c58e60a042
commit 39119088f9
3 changed files with 6457 additions and 192 deletions

View File

@ -23751,23 +23751,27 @@ fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
@tagName(dest_info.signedness), operand_ty.fmt(pt), @tagName(dest_info.signedness), operand_ty.fmt(pt),
}); });
} }
if (operand_info.bits < dest_info.bits) { switch (std.math.order(dest_info.bits, operand_info.bits)) {
const msg = msg: { .gt => {
const msg = try sema.errMsg( const msg = msg: {
src, const msg = try sema.errMsg(
"destination type '{}' has more bits than source type '{}'", src,
.{ dest_ty.fmt(pt), operand_ty.fmt(pt) }, "destination type '{}' has more bits than source type '{}'",
); .{ dest_ty.fmt(pt), operand_ty.fmt(pt) },
errdefer msg.destroy(sema.gpa); );
try sema.errNote(src, msg, "destination type has {d} bits", .{ errdefer msg.destroy(sema.gpa);
dest_info.bits, try sema.errNote(src, msg, "destination type has {d} bits", .{
}); dest_info.bits,
try sema.errNote(operand_src, msg, "operand type has {d} bits", .{ });
operand_info.bits, try sema.errNote(operand_src, msg, "operand type has {d} bits", .{
}); operand_info.bits,
break :msg msg; });
}; break :msg msg;
return sema.failWithOwnedErrorMsg(block, msg); };
return sema.failWithOwnedErrorMsg(block, msg);
},
.eq => return operand,
.lt => {},
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff