From fe3c5182775b935b6fb8e75b9a94de9561349870 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 24 Jan 2020 17:10:07 -0800 Subject: [PATCH] nir/algebraic: Don't add reordered version of patterns for commutative instructions The reordered are automatically considered by nir_algebraic rules for commutative instructions. No shader-db or fossil-db changes on any Intel platform. Reviewed-by: Caio Marcelo de Oliveira Filho Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 5ff51f9746f..063a8579052 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1883,8 +1883,13 @@ for op in ['flt', 'fge', 'feq']: # which constant folding will eat for lunch. The resulting ternary will # further get cleaned up by the boolean reductions above and we will be # left with just the original variable "a". -for op in ['flt', 'fge', 'feq', 'fneu', - 'ilt', 'ige', 'ieq', 'ine', 'ult', 'uge']: +for op in ['feq', 'fneu', 'ieq', 'ine']: + optimizations += [ + ((op, ('bcsel', 'a', '#b', '#c'), '#d'), + ('bcsel', 'a', (op, 'b', 'd'), (op, 'c', 'd'))), + ] + +for op in ['flt', 'fge', 'ilt', 'ige', 'ult', 'uge']: optimizations += [ ((op, ('bcsel', 'a', '#b', '#c'), '#d'), ('bcsel', 'a', (op, 'b', 'd'), (op, 'c', 'd'))),