nir: add strength reduction pattern for imod/irem with pow2 divisor.
Affected games are Detroit : Become Human and Doom : Eternal. Totals from 6262 (4.54% of 138013) affected shaders (RAVEN): SGPRs: 678472 -> 678640 (+0.02%) VGPRs: 498288 -> 498360 (+0.01%) CodeSize: 67064196 -> 65926000 (-1.70%) MaxWaves: 19390 -> 19382 (-0.04%) Instrs: 13175372 -> 12932517 (-1.84%) Cycles: 1444043256 -> 1443022576 (-0.07%); split: -0.08%, +0.01% VMEM: 929560 -> 908726 (-2.24%); split: +0.39%, -2.63% SMEM: 406207 -> 400062 (-1.51%); split: +0.46%, -1.97% VClause: 215168 -> 215031 (-0.06%) SClause: 443312 -> 442324 (-0.22%); split: -0.25%, +0.03% Copies: 1350793 -> 1344326 (-0.48%); split: -0.52%, +0.04% Branches: 506432 -> 506370 (-0.01%); split: -0.02%, +0.01% PreSGPRs: 619652 -> 619619 (-0.01%) PreVGPRs: 473212 -> 473168 (-0.01%) Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/175>
This commit is contained in:

committed by
Daniel Schürmann

parent
e96afeeb7b
commit
0ef5f3552f
@@ -102,10 +102,17 @@ optimizations = [
|
||||
(('idiv', a, 1), a),
|
||||
(('umod', a, 1), 0),
|
||||
(('imod', a, 1), 0),
|
||||
(('imod', a, -1), 0),
|
||||
(('irem', a, 1), 0),
|
||||
(('irem', a, -1), 0),
|
||||
(('udiv', a, '#b(is_pos_power_of_two)'), ('ushr', a, ('find_lsb', b)), '!options->lower_bitops'),
|
||||
(('idiv', a, '#b(is_pos_power_of_two)'), ('imul', ('isign', a), ('ushr', ('iabs', a), ('find_lsb', b))), '!options->lower_bitops'),
|
||||
(('idiv', a, '#b(is_neg_power_of_two)'), ('ineg', ('imul', ('isign', a), ('ushr', ('iabs', a), ('find_lsb', ('iabs', b))))), '!options->lower_bitops'),
|
||||
(('umod', a, '#b(is_pos_power_of_two)'), ('iand', a, ('isub', b, 1))),
|
||||
(('imod', a, '#b(is_pos_power_of_two)'), ('iand', a, ('isub', b, 1))),
|
||||
(('imod', a, '#b(is_neg_power_of_two)'), ('ior', a, b)),
|
||||
(('irem', a, '#b(is_pos_power_of_two)'), ('bcsel', ('ige', a, 0), ('iand', a, ('isub', b, 1)), ('ior', a, ('ineg', b)))),
|
||||
(('irem', a, '#b(is_neg_power_of_two)'), ('bcsel', ('ige', a, 0), ('iand', a, ('inot', b)), ('ior', a, b))),
|
||||
|
||||
(('~fneg', ('fneg', a)), a),
|
||||
(('ineg', ('ineg', a)), a),
|
||||
|
Reference in New Issue
Block a user