nir: Saturating integer arithmetic is not associative
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 30 Apr 2019 15:00:32 +0000 (08:00 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 1 May 2019 16:07:47 +0000 (09:07 -0700)
commit85e6865ff62390c632909a07a46deab54c742963
tree40d1b6ebcaacde5a6b7424fcd445fe9c47119104
parent70da00ffd65e56c8c8cc6ecfcec462fb52ee5102
nir: Saturating integer arithmetic is not associative

In 8-bits,

    iadd_sat(iadd_sat(0x7f, 0x7f), -1) =
    iadd_sat(0x7f, -1) =
    0x7e

but,

    iadd_sat(0x7f, iadd_sat(0x7f, -1)) =
    iadd_sat(0x7f, 0x7e) =
    0x7f

Fixes: 272e927d0e9 ("nir/spirv: initial handling of OpenCL.std extension opcodes")
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_opcodes.py