mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
x86_64: rewrite vector @truncate
This commit is contained in:
parent
c58e60a042
commit
39119088f9
38
src/Sema.zig
38
src/Sema.zig
@ -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
Loading…
x
Reference in New Issue
Block a user