From ae37237713681121d7fa83489ef9370e3fdcce2a Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Fri, 17 May 2019 13:46:38 -0700 Subject: nir: Add a no wrapping bits to nir_alu_instr They indicate the operation does not cause overflow or underflow. This is motivated by SPIR-V decorations NoSignedWrap and NoUnsignedWrap. Change the storage of `exact` to be a single bit, so they pack together. v2: Handle no_wrap in nir_instr_set. (Karol) v3: Use two separate flags, since the NIR SSA values and certain instructions are typeless, so just no_wrap would be insufficient to know which one was referred to. (Connor) v4: Don't use nir_instr_set to propagate the flags, unlike `exact`, consider the instructions different if the flags have different values. Fix hashing/comparing. (Jason) Reviewed-by: Karol Herbst [v1] Reviewed-by: Jason Ekstrand --- src/compiler/nir/nir.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/compiler/nir/nir.h') diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 94995ec37da..9b0d13910d4 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -961,7 +961,14 @@ typedef struct nir_alu_instr { * it must ensure that the resulting value is bit-for-bit identical to the * original. */ - bool exact; + bool exact:1; + + /** + * Indicates that this instruction do not cause wrapping to occur, in the + * form of overflow or underflow. + */ + bool no_signed_wrap:1; + bool no_unsigned_wrap:1; nir_alu_dest dest; nir_alu_src src[]; -- cgit v1.2.3