nir: Add a couple of iand/ior optimizations

Spotted in a shader in Batman: Arkham City.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Jason Ekstrand 2018-07-23 00:35:02 -07:00
parent 2b3064c073
commit b3b170ade9
1 changed files with 4 additions and 0 deletions

View File

@ -377,6 +377,10 @@ optimizations = [
(('ixor', a, a), 0),
(('ixor', a, 0), a),
(('inot', ('inot', a)), a),
(('ior', ('iand', a, b), b), b),
(('ior', ('ior', a, b), b), ('ior', a, b)),
(('iand', ('ior', a, b), b), b),
(('iand', ('iand', a, b), b), ('iand', a, b)),
# DeMorgan's Laws
(('iand', ('inot', a), ('inot', b)), ('inot', ('ior', a, b))),
(('ior', ('inot', a), ('inot', b)), ('inot', ('iand', a, b))),