[Mesa-dev] [PATCH v3 3/7] nir: Add a saturated unsigned integer add opcode

Jason Ekstrand jason at jlekstrand.net
Mon Oct 29 15:00:09 UTC 2018


From: Ian Romanick <ian.d.romanick at intel.com>

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/compiler/nir/nir_opcodes.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 209f0c5509b..1a52b3b4228 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -437,6 +437,8 @@ 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("uadd_sat", tuint, commutative,
+      "(src0 + src1) < src0 ? UINT64_MAX : (src0 + src1)")
 binop("fsub", tfloat, "", "src0 - src1")
 binop("isub", tint, "", "src0 - src1")
 
-- 
2.19.1



More information about the mesa-dev mailing list