nir/algebraic: eliminate exact a*0.0 if float execution mode allow it
fossil-db (GFX10): Totals from 611 (0.44% of 139391) affected shaders: SGPRs: 40528 -> 40288 (-0.59%) VGPRs: 16136 -> 16152 (+0.10%); split: -0.15%, +0.25% CodeSize: 970192 -> 951036 (-1.97%) MaxWaves: 10561 -> 10557 (-0.04%); split: +0.08%, -0.11% Instrs: 174874 -> 172879 (-1.14%); split: -1.18%, +0.04% fossil-db (GFX10.3): Totals from 611 (0.44% of 139391) affected shaders: SGPRs: 40680 -> 40488 (-0.47%) VGPRs: 18368 -> 18276 (-0.50%); split: -0.57%, +0.07% CodeSize: 1050712 -> 1033624 (-1.63%); split: -1.64%, +0.02% MaxWaves: 8658 -> 8674 (+0.18%) Instrs: 205364 -> 201220 (-2.02%) Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5523>
This commit is contained in:
@@ -147,6 +147,9 @@ optimizations = [
|
||||
(('~fadd', a, ('fadd', ('fneg', a), b)), b),
|
||||
(('fadd', ('fsat', a), ('fsat', ('fneg', a))), ('fsat', ('fabs', a))),
|
||||
(('~fmul', a, 0.0), 0.0),
|
||||
# The only effect a*0.0 should have is when 'a' is infinity, -0.0 or NaN
|
||||
(('fmul', 'a@16', 0.0), 0.0, '!'+signed_zero_inf_nan_preserve_16),
|
||||
(('fmul', 'a@32', 0.0), 0.0, '!'+signed_zero_inf_nan_preserve_32),
|
||||
(('imul', a, 0), 0),
|
||||
(('umul_unorm_4x8', a, 0), 0),
|
||||
(('umul_unorm_4x8', a, ~0), a),
|
||||
@@ -165,6 +168,8 @@ optimizations = [
|
||||
(('fmul', ('fsign', a), ('fmul', a, a)), ('fmul', ('fabs', a), a)),
|
||||
(('fmul', ('fmul', ('fsign', a), a), a), ('fmul', ('fabs', a), a)),
|
||||
(('~ffma', 0.0, a, b), b),
|
||||
(('ffma@16(is_only_used_as_float)', 0.0, a, b), b, '!'+signed_zero_inf_nan_preserve_16),
|
||||
(('ffma@32(is_only_used_as_float)', 0.0, a, b), b, '!'+signed_zero_inf_nan_preserve_32),
|
||||
(('~ffma', a, b, 0.0), ('fmul', a, b)),
|
||||
(('ffma@16', a, b, 0.0), ('fmul', a, b), '!'+signed_zero_inf_nan_preserve_16),
|
||||
(('ffma@32', a, b, 0.0), ('fmul', a, b), '!'+signed_zero_inf_nan_preserve_32),
|
||||
|
Reference in New Issue
Block a user