From: Rhys Perry Date: Thu, 29 Jul 2021 10:12:29 +0000 (+0100) Subject: nir: fix signed overflow for iadd constant folding X-Git-Tag: upstream/22.3.5~19440 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e008eb12247ee2ad7410b0073b5f144a47767ec4;p=platform%2Fupstream%2Fmesa.git nir: fix signed overflow for iadd constant folding Signed-off-by: Rhys Perry Reviewed-by: Ian Romanick Part-of: --- diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index e37419c..2897a68 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -626,7 +626,7 @@ if (nir_is_rounding_mode_rtz(execution_mode, bit_size)) { dst = src0 + src1; } """) -binop("iadd", tint, _2src_commutative + associative, "src0 + src1") +binop("iadd", tint, _2src_commutative + associative, "(uint64_t)src0 + (uint64_t)src1") binop("iadd_sat", tint, _2src_commutative, """ src1 > 0 ? (src0 + src1 < src0 ? (1ull << (bit_size - 1)) - 1 : src0 + src1) :