nak: Assert no overflow when legalizing iadd with too many ineg modifiers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30402>
This commit is contained in:
Faith Ekstrand
2024-07-26 22:09:43 -05:00
committed by Marge Bot
parent 96812f6b72
commit eb5f333606
2 changed files with 3 additions and 0 deletions

View File

@@ -1133,6 +1133,7 @@ impl SM50Op for OpIAdd2 {
let [src0, src1] = &mut self.srcs;
swap_srcs_if_not_reg(src0, src1, GPR);
if src0.src_mod.is_ineg() && src1.src_mod.is_ineg() {
assert!(self.carry_out.is_none());
let val = b.alloc_ssa(GPR, 1);
b.push_op(OpIAdd2 {
dst: val.into(),

View File

@@ -1442,6 +1442,8 @@ impl SM70Op for OpIAdd3 {
swap_srcs_if_not_reg(src0, src1, gpr);
swap_srcs_if_not_reg(src2, src1, gpr);
if !src0.src_mod.is_none() && !src1.src_mod.is_none() {
assert!(self.overflow[0].is_none());
assert!(self.overflow[1].is_none());
let val = b.alloc_ssa(gpr, 1);
b.push_op(OpIAdd3 {
srcs: [Src::new_zero(), *src0, Src::new_zero()],