nir: Avoid UB of (int)0xff << 24 evaluating usadd_4x8_vc4.

Caught by UBSan on introduction of nir_opt_algebraic_pattern_test.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39184>
This commit is contained in:
Emma Anholt 2025-12-23 15:57:03 -08:00 committed by Marge Bot
parent a8224e3e00
commit feffd0e445

View file

@ -1502,7 +1502,7 @@ if (!isnormal(dst))
binop("usadd_4x8_vc4", tint32, _2src_commutative + associative, """
dst = 0;
for (int i = 0; i < 32; i += 8) {
dst |= MIN2(((src0 >> i) & 0xff) + ((src1 >> i) & 0xff), 0xff) << i;
dst |= (uint32_t)MIN2(((src0 >> i) & 0xff) + ((src1 >> i) & 0xff), 0xff) << i;
}
""")