nir: add option to keep mul24_relaxed

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33871>
This commit is contained in:
Georg Lehmann 2025-03-04 15:29:28 +01:00 committed by Marge Bot
parent 47d08dbde7
commit 2b1fc1a7fe
2 changed files with 9 additions and 4 deletions

View file

@ -2649,12 +2649,12 @@ optimizations.extend([
'!options->has_umad24'),
# Relaxed 24bit ops
(('imul24_relaxed', a, b), ('imul24', a, b), 'options->has_imul24'),
(('imul24_relaxed', a, b), ('imul', a, b), '!options->has_imul24'),
(('imul24_relaxed', a, b), ('imul24', a, b), '!options->has_mul24_relaxed && options->has_imul24'),
(('imul24_relaxed', a, b), ('imul', a, b), '!options->has_mul24_relaxed && !options->has_imul24'),
(('umad24_relaxed', a, b, c), ('umad24', a, b, c), 'options->has_umad24'),
(('umad24_relaxed', a, b, c), ('iadd', ('umul24_relaxed', a, b), c), '!options->has_umad24'),
(('umul24_relaxed', a, b), ('umul24', a, b), 'options->has_umul24'),
(('umul24_relaxed', a, b), ('imul', a, b), '!options->has_umul24'),
(('umul24_relaxed', a, b), ('umul24', a, b), '!options->has_mul24_relaxed && options->has_umul24'),
(('umul24_relaxed', a, b), ('imul', a, b), '!options->has_mul24_relaxed && !options->has_umul24'),
(('imad24_ir3', a, b, 0), ('imul24', a, b)),
(('imad24_ir3', a, 0, c), (c)),

View file

@ -511,6 +511,11 @@ typedef struct nir_shader_compiler_options {
* to imul with masked inputs */
bool has_umul24;
/** Backend supports imul24_relaxed and umul24_relaxed, if not set they will be lowered
* to imul24, umul24 or imul.
*/
bool has_mul24_relaxed;
/** Backend supports 32-bit imad */
bool has_imad32;