nir: Add a no wrapping bits to nir_alu_instr
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 17 May 2019 20:46:38 +0000 (13:46 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Wed, 26 Jun 2019 21:13:02 +0000 (14:13 -0700)
commitae37237713681121d7fa83489ef9370e3fdcce2a
treedff2088713308310e7d2ec9390a62d3d28866987
parentf97dcb7a55bac650e55bb58182d0af16ba384305
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 <kherbst@redhat.com> [v1]
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir.h
src/compiler/nir/nir_clone.c
src/compiler/nir/nir_instr_set.c
src/compiler/nir/nir_print.c
src/compiler/nir/nir_serialize.c