mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 23:00:11 +01:00
nir/algebraic: optimize (a & b) | (a | c) => a | c, (a & b) & (a | c) => a & b
No change in shader-db with ACO, but it doesn't seem to be optimized by any other patterns. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32449>
This commit is contained in:
parent
3670d42c74
commit
8752401e03
1 changed files with 4 additions and 0 deletions
|
|
@ -227,6 +227,10 @@ optimizations = [
|
|||
(('ior', ('ior', a, b), ('ior(is_used_once)', a, c)), ('ior', ('ior', a, b), c)),
|
||||
(('iand', ('ior(is_used_once)', a, b), ('ior(is_used_once)', a, c)), ('ior', a, ('iand', b, c))),
|
||||
(('ior', ('iand(is_used_once)', a, b), ('iand(is_used_once)', a, c)), ('iand', a, ('ior', b, c))),
|
||||
# (a & b) | (a | c) => ((a & b) | a) | c => a | c
|
||||
(('ior', ('iand', a, b), ('ior', a, c)), ('ior', a, c)),
|
||||
# (a & b) & (a | c) => b & (a & (a | c)) => b & a
|
||||
(('iand', ('iand', a, b), ('ior', a, c)), ('iand', a, b)),
|
||||
(('ieq', ('iand', a, '#b(is_pos_power_of_two)'), b), ('ine', ('iand', a, b), 0)),
|
||||
(('ine', ('iand', a, '#b(is_pos_power_of_two)'), b), ('ieq', ('iand', a, b), 0)),
|
||||
(('ieq', ('ushr(is_used_once)', a, '#b'), 0), ('ult', a, ('ishl', 1, b))),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue