nir: replace .lower_sub with .has_fsub and .has_isub

This allows a more fine-grained control about whether
a backend supports one of these instructions.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597>
This commit is contained in:
Daniel Schürmann
2020-09-04 11:24:26 +01:00
committed by Marge Bot
parent b3ce55b445
commit bd8e84eb8d
22 changed files with 37 additions and 15 deletions

View File

@@ -2106,9 +2106,9 @@ late_optimizations = [
(('fneg', ('fneg', a)), a),
# Subtractions get lowered during optimization, so we need to recombine them
(('fadd', 'a', ('fneg', 'b')), ('fsub', 'a', 'b'), '!options->lower_sub'),
(('fadd', a, ('fneg', 'b')), ('fsub', 'a', 'b'), 'options->has_fsub'),
(('fneg', a), ('fmul', a, -1.0), 'options->lower_fneg'),
(('iadd', a, ('ineg', 'b')), ('isub', 'a', 'b'), '!options->lower_sub || options->lower_ineg'),
(('iadd', a, ('ineg', 'b')), ('isub', 'a', 'b'), 'options->has_isub || options->lower_ineg'),
(('ineg', a), ('isub', 0, a), 'options->lower_ineg'),
(('iabs', a), ('imax', a, ('ineg', a)), 'options->lower_iabs'),
(('~fadd@16', ('fmul', a, b), c), ('ffma', a, b, c), 'options->fuse_ffma16'),