From: Isabella Basso Date: Fri, 10 Mar 2023 20:20:10 +0000 (-0300) Subject: nir/algebraic: make patterns for float conversion lowerings imprecise X-Git-Tag: upstream/23.3.3~11794 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a553d3cd2985b604f92ef02568b2164880d1fe7f;p=platform%2Fupstream%2Fmesa.git nir/algebraic: make patterns for float conversion lowerings imprecise As noted on [1], lowering patterns of the form floatS -> floatB -> floatS ==> floatS cannot require precision since this may cause flush denorming. [1] 3f779013 ("nir: Add an algebraic optimization for float->double->float") Fixes: b86305bb ("nir/algebraic: collapse conversion opcodes (many patterns)") Acked-by: Alyssa Rosenzweig Reviewed-by: Georg Lehmann Signed-off-by: Isabella Basso Part-of: --- diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 0c9c5c4..a9493cb 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -994,7 +994,7 @@ for s in [16, 32, 64]: optimizations.extend([ # S = smaller, B = bigger # floatS -> floatB -> floatS ==> identity - (('f2f{}'.format(s), ('f2f{}'.format(B), 'a@{}'.format(s))), a), + (('~f2f{}'.format(s), ('f2f{}'.format(B), 'a@{}'.format(s))), a), # bool1 -> typeB -> typeS ==> bool1 -> typeS (('f2f{}'.format(s), ('b2f{}'.format(B), 'a@1')), ('b2f{}'.format(s), a)), @@ -1514,10 +1514,6 @@ optimizations.extend([ (('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), - (('ffloor', 'a(is_integral)'), a), (('fceil', 'a(is_integral)'), a), (('ftrunc', 'a(is_integral)'), a),