From a27bcd63d0bcde0e08197b1ac0b36c6c132af06c Mon Sep 17 00:00:00 2001 From: Isabella Basso Date: Fri, 10 Mar 2023 17:20:09 -0300 Subject: [PATCH] nir/algebraic: extend mediump patterns Acked-by: Alyssa Rosenzweig Suggested-by: Italo Nicola Signed-off-by: Isabella Basso Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index e8445246979..4857f62bdbe 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1488,11 +1488,17 @@ optimizations.extend([ (('i2i32', ('i2imp', 'a@32')), a), (('u2u32', ('i2imp', 'a@32')), a), + # typeA@32 -> typeB@16 -> typeB@32 ==> typeA@32 -> typeB@32 (('i2i32', ('f2imp', 'a@32')), ('f2i32', a)), (('u2u32', ('f2ump', 'a@32')), ('f2u32', a)), (('f2f32', ('i2fmp', 'a@32')), ('i2f32', a)), (('f2f32', ('u2fmp', 'a@32')), ('u2f32', a)), + # typeA@32 -> typeA@16 -> typeB@32 ==> typeA@32 -> typeB@32 + (('f2i32', ('f2fmp', 'a@32')), ('f2i32', a)), + (('f2u32', ('f2fmp', 'a@32')), ('f2u32', a)), + (('i2f32', ('i2imp', 'a@32')), ('i2f32', a)), + # Conversions from float32 to float64 and back can be removed as long as # it doesn't need to be precise, since the conversion may e.g. flush denorms (('~f2f32', ('f2f64', 'a@32')), a),