diff --git a/.pick_status.json b/.pick_status.json index 6668cbbb22f..6471e6142e1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4432,7 +4432,7 @@ "description": "nir: Fix constant folding for irhadd/urhadd", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "272e927d0e9fed6e791d706ff5d895b6c2036fc0" }, diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index bf5b901b4e0..88194f762f0 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -770,8 +770,8 @@ binop("uhadd", tuint, _2src_commutative, "(src0 & src1) + ((src0 ^ src1) >> 1)") # # (x + y + 1) >> 1 = (x | y) + (-(x ^ y) + 1) >> 1) # = (x | y) - ((x ^ y) >> 1) -binop("irhadd", tint, _2src_commutative, "(src0 | src1) + ((src0 ^ src1) >> 1)") -binop("urhadd", tuint, _2src_commutative, "(src0 | src1) + ((src0 ^ src1) >> 1)") +binop("irhadd", tint, _2src_commutative, "(src0 | src1) - ((src0 ^ src1) >> 1)") +binop("urhadd", tuint, _2src_commutative, "(src0 | src1) - ((src0 ^ src1) >> 1)") binop("umod", tuint, "", "src1 == 0 ? 0 : src0 % src1")