nir/int64: Properly handle imod/irem
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 1 Mar 2017 23:20:31 +0000 (15:20 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 3 Mar 2017 21:59:27 +0000 (13:59 -0800)
commitbc456749bda67369bccb6e4529c981d84507fa65
tree8134293b5307a656a15b5324e547fcface405115
parent9745bef3088694b13f040222a813a1c2ac9677f9
nir/int64: Properly handle imod/irem

The previous implementation was fine for GLSL which doesn't really have
a signed modulus/remainder.  They just leave the behavior undefined
whenever either source is negative.  However, in SPIR-V, there is a
defined behavior for negative arguments.  This commit beefs up the pass
so that it handles both correctly.  Tested using a hacked up version of
the Vulkan CTS test to get 64-bit support.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/compiler/nir/nir_lower_int64.c