mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-24 22:20:38 +02:00
nir/algebraic: optimize ushr(a, ishl(iand(b, 3), 3))
nir_lower_mem_access_bit_sizes creates this. No fossil-db changes. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31904>
This commit is contained in:
parent
e95a3364b8
commit
0c7830eb85
1 changed files with 3 additions and 2 deletions
|
|
@ -1193,7 +1193,7 @@ for op in ['iand', 'ior', 'ixor']:
|
|||
|
||||
# Integer sizes
|
||||
for s in [8, 16, 32, 64]:
|
||||
last_shift_bit = int(math.log2(s)) - 1
|
||||
amount_bits = int(math.log2(s))
|
||||
|
||||
lower_umin = 'options->lower_umin'
|
||||
lower_umax = 'options->lower_umax'
|
||||
|
|
@ -1231,7 +1231,8 @@ for s in [8, 16, 32, 64]:
|
|||
(('ishl', 'a@{}'.format(s), ('iand', s - 1, b)), ('ishl', a, b)),
|
||||
(('ishr', 'a@{}'.format(s), ('iand', s - 1, b)), ('ishr', a, b)),
|
||||
(('ushr', 'a@{}'.format(s), ('iand', s - 1, b)), ('ushr', a, b)),
|
||||
(('ushr', 'a@{}'.format(s), ('ishl(is_used_once)', ('iand', b, 1), last_shift_bit)), ('ushr', a, ('ishl', b, last_shift_bit))),
|
||||
(('ushr', 'a@{}'.format(s), ('ishl(is_used_once)', ('iand', b, 1), amount_bits - 1)), ('ushr', a, ('ishl', b, amount_bits - 1))),
|
||||
(('ushr', 'a@{}'.format(s), ('ishl(is_used_once)', ('iand', b, 3), amount_bits - 2)), ('ushr', a, ('ishl', b, amount_bits - 2))),
|
||||
])
|
||||
|
||||
optimizations.extend([
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue