nir: Add an option to lower 64bit iadd_sat.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15421>
This commit is contained in:
Georg Lehmann 2021-11-20 14:23:20 +01:00 committed by Marge Bot
parent 922916bf64
commit 16be909936
2 changed files with 3 additions and 2 deletions

View file

@ -3148,6 +3148,7 @@ typedef enum {
nir_lower_scan_reduce_iadd64 = (1 << 18),
nir_lower_vote_ieq64 = (1 << 19),
nir_lower_usub_sat64 = (1 << 20),
nir_lower_iadd_sat64 = (1 << 21),
} nir_lower_int64_options;
typedef enum {

View file

@ -1702,7 +1702,7 @@ optimizations.extend([
('ior', ('ior', ('ilt', a, 0), ('ilt', b, 0)), ('ige', ('iadd', a, b), 0)),
('iadd', a, b),
0x7fffffffffffffff)),
'(options->lower_int64_options & nir_lower_iadd64) != 0'),
'(options->lower_int64_options & nir_lower_iadd_sat64) != 0'),
# int64_t sum = a - b;
#
@ -1720,7 +1720,7 @@ optimizations.extend([
('ior', ('ior', ('ilt', a, 0), ('ige', b, 0)), ('ige', ('isub', a, b), 0)),
('isub', a, b),
0x7fffffffffffffff)),
'(options->lower_int64_options & nir_lower_iadd64) != 0'),
'(options->lower_int64_options & nir_lower_iadd_sat64) != 0'),
# These are done here instead of in the backend because the int64 lowering
# pass will make a mess of the patterns. The first patterns are