nir: Add a saturated unsigned integer add opcode
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 6 Oct 2018 01:22:41 +0000 (20:22 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Thu, 13 Dec 2018 17:49:48 +0000 (17:49 +0000)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_opcodes.py

index ac2bb9cf7116c7b5d2d63d34f70581dd3a81c619..5458ddd8198a20887465092aa52fb5650b1b87d5 100644 (file)
@@ -462,6 +462,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")