Commit a32b5891 authored by Rhys Perry's avatar Rhys Perry
Browse files

nir/algebraic: optimize some code generated by nir_lower_bit_size

fossil-db (Navi):
Totals from 193 (28.26% of 683) affected shaders:
SGPRs: 8680 -> 8848 (+1.94%)
SpillVGPRs: 1165 -> 1189 (+2.06%)
CodeSize: 1072588 -> 1058232 (-1.34%)
Instrs: 188630 -> 185726 (-1.54%)
Signed-off-by: Rhys Perry's avatarRhys Perry <>
parent 6962fa75
Pipeline #183755 waiting for manual action with stages
......@@ -1419,6 +1419,18 @@ optimizations.extend([
(('imul24', a, '#b@32(is_pos_power_of_two)'), ('ishl', a, ('find_lsb', b)), '!options->lower_bitops'),
(('imul24', a, '#b@32(is_neg_power_of_two)'), ('ineg', ('ishl', a, ('find_lsb', ('iabs', b)))), '!options->lower_bitops'),
(('imul24', a, 0), (0)),
# Cleanups and optimizations for nir_lower_bit_size
(('i2i8', 'a@32'), ('u2u8', a)),
(('i2i16', 'a@32'), ('u2u16', a)),
(('undef_extend32', ('u2u8', 'a@32')), a),
(('undef_extend32', ('u2u16', 'a@32')), a),
(('ushr', ('u2u32', ('u2u16', 'a@32')), '#b'), ('ubitfield_extract', a, b, ('isub', 16, b))),
(('ishr', ('i2i32', ('u2u16', 'a@32')), '#b'), ('ibitfield_extract', a, b, ('isub', 16, b))),
(('ushr', ('u2u32', ('u2u8', 'a@32')), '#b'), ('ubitfield_extract', a, b, ('isub', 8, b))),
(('ishr', ('i2i32', ('u2u8', 'a@32')), '#b'), ('ibitfield_extract', a, b, ('isub', 8, b))),
# bit_size dependent lowerings
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment