From 3ba66ebbc8207a24282b3aab57a2d691d10199f9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 6 Aug 2021 14:16:24 -0700 Subject: [PATCH] nir/opcodes: Use u_intN_(min|max) uadd_sat was updated using sed, so I didn't even notice the surrounding opcodes. Oops. Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_opcodes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 2897a68f826..17a1508c4d5 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -629,15 +629,15 @@ if (nir_is_rounding_mode_rtz(execution_mode, bit_size)) { binop("iadd", tint, _2src_commutative + associative, "(uint64_t)src0 + (uint64_t)src1") binop("iadd_sat", tint, _2src_commutative, """ src1 > 0 ? - (src0 + src1 < src0 ? (1ull << (bit_size - 1)) - 1 : src0 + src1) : - (src0 < src0 + src1 ? (1ull << (bit_size - 1)) : src0 + src1) + (src0 + src1 < src0 ? u_intN_max(bit_size) : src0 + src1) : + (src0 < src0 + src1 ? u_intN_min(bit_size) : src0 + src1) """) binop("uadd_sat", tuint, _2src_commutative, "(src0 + src1) < src0 ? u_uintN_max(sizeof(src0) * 8) : (src0 + src1)") binop("isub_sat", tint, "", """ src1 < 0 ? - (src0 - src1 < src0 ? (1ull << (bit_size - 1)) - 1 : src0 - src1) : - (src0 < src0 - src1 ? (1ull << (bit_size - 1)) : src0 - src1) + (src0 - src1 < src0 ? u_intN_max(bit_size) : src0 - src1) : + (src0 < src0 - src1 ? u_intN_min(bit_size) : src0 - src1) """) binop("usub_sat", tuint, "", "src0 < src1 ? 0 : src0 - src1")