Module: Mesa Branch: master Commit: 85e6865ff62390c632909a07a46deab54c742963 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=85e6865ff62390c632909a07a46deab54c742963
Author: Ian Romanick <[email protected]> Date: Tue Apr 30 08:00:32 2019 -0700 nir: Saturating integer arithmetic is not associative In 8-bits, iadd_sat(iadd_sat(0x7f, 0x7f), -1) = iadd_sat(0x7f, -1) = 0x7e but, iadd_sat(0x7f, iadd_sat(0x7f, -1)) = iadd_sat(0x7f, 0x7e) = 0x7f Fixes: 272e927d0e9 ("nir/spirv: initial handling of OpenCL.std extension opcodes") Reviewed-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> --- src/compiler/nir/nir_opcodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index d35d820aa5b..246d3d40381 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -482,7 +482,7 @@ def binop_reduce(name, output_size, output_type, src_type, prereduce_expr, binop("fadd", tfloat, commutative + associative, "src0 + src1") binop("iadd", tint, commutative + associative, "src0 + src1") -binop("iadd_sat", tint, commutative + associative, """ +binop("iadd_sat", tint, commutative, """ src1 > 0 ? (src0 + src1 < src0 ? (1ull << (bit_size - 1)) - 1 : src0 + src1) : (src0 < src0 + src1 ? (1ull << (bit_size - 1)) : src0 + src1) _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
