Mesa (master): nir: Saturating integer arithmetic is not associative
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 1 20:42:10 UTC 2019
Module: Mesa
Branch: master
Commit: 85e6865ff62390c632909a07a46deab54c742963
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=85e6865ff62390c632909a07a46deab54c742963
Author: Ian Romanick <ian.d.romanick at intel.com>
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 <kherbst at redhat.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
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)
More information about the mesa-commit
mailing list