Module: Mesa Branch: main Commit: 17ecd0b31a1f2f58281c225efc843f14b36ce03d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=17ecd0b31a1f2f58281c225efc843f14b36ce03d
Author: Daniel Schürmann <[email protected]> Date: Thu Oct 7 20:21:24 2021 +0200 nir/opt_algebraic: lower fneg_hi/lo to fmul This pattern, found in the FSR upscaling shader, helps the vectorization efforts by keeping the chain of vectorized instructions intact. Radeon can optimize it to per-component fneg modifiers. Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13688> --- src/compiler/nir/nir_opt_algebraic.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 1fd7aa4ce7a..a500a4ca8bf 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -2492,6 +2492,10 @@ late_optimizations = [ (('iadd', ('isub(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), 'c(is_not_const)'), ('iadd3', a, ('ineg', b), c), 'options->has_iadd3'), (('isub', ('isub(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), 'c(is_not_const)'), ('iadd3', a, ('ineg', b), ('ineg', c)), 'options->has_iadd3'), + # fneg_lo / fneg_hi + (('vec2(is_only_used_as_float)', ('fneg@16', a), b), ('fmul', ('vec2', a, b), ('vec2', -1.0, 1.0)), 'options->vectorize_vec2_16bit'), + (('vec2(is_only_used_as_float)', a, ('fneg@16', b)), ('fmul', ('vec2', a, b), ('vec2', 1.0, -1.0)), 'options->vectorize_vec2_16bit'), + # These are duplicated from the main optimizations table. The late # patterns that rearrange expressions like x - .5 < 0 to x < .5 can create # new patterns like these. The patterns that compare with zero are removed
