summaryrefslogtreecommitdiffstats
path: root/src/compiler/Makefile.sources
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2018-05-22 18:19:16 -0700
committerIan Romanick <[email protected]>2019-03-28 15:35:53 -0700
commit2cf59861a8128a91bfdd6fe62bf69cb4593373e3 (patch)
tree33daec3329c0ccb028e108649ffbdc6dc5881879 /src/compiler/Makefile.sources
parentc6ee46a7532291fc8583400e174e77b1833daf23 (diff)
nir: Add partial redundancy elimination for compares
This pass attempts to dectect code sequences like if (x < y) { z = y - x; ... } and replace them with sequences like t = x - y; if (t < 0) { z = -t; ... } On architectures where the subtract can generate the flags used by the if-statement, this saves an instruction. It's also possible that moving an instruction out of the if-statement will allow nir_opt_peephole_select to convert the whole thing to a bcsel. Currently only floating point compares and adds are supported. Adding support for integer will be a challenge due to integer overflow. There are a couple possible solutions, but they may not apply to all architectures. v2: Fix a typo in the commit message and a couple typos in comments. Fix possible NULL pointer deref from result of push_block(). Add missing (-A + B) case. Suggested by Caio. v3: Fix is_not_const_zero to work correctly with types other than nir_type_float32. Suggested by Ken. v4: Add some comments explaining how this works. Suggested by Ken. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/Makefile.sources')
-rw-r--r--src/compiler/Makefile.sources1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index e542d86a37a..5fddb6d4db2 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -278,6 +278,7 @@ NIR_FILES = \
nir/nir_move_vec_src_uses_to_dest.c \
nir/nir_normalize_cubemap_coords.c \
nir/nir_opt_combine_stores.c \
+ nir/nir_opt_comparison_pre.c \
nir/nir_opt_conditional_discard.c \
nir/nir_opt_constant_folding.c \
nir/nir_opt_copy_prop_vars.c \