From d668512f88498237a9c9f2fcdfb9a614f545ab4d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 7 Nov 2022 23:24:24 -0800 Subject: [PATCH] intel/compiler: Fix signed integer range analysis of imax and imin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some review feedback of an earlier commit caused me to rearrange some code quite a bit. I wasn't paying enough attention while applying the later commits, and these breaks should have been returns. As it is, the result of the imin or imax analysis is overwritten by the default case handling... effectively the original commit does nothing. :( Tiger Lake and Ice Lake had similar results. (Ice Lake shown) total instructions in shared programs: 19914090 -> 19904772 (-0.05%) instructions in affected programs: 121258 -> 111940 (-7.68%) helped: 445 / HURT: 0 total cycles in shared programs: 855291535 -> 855266659 (<.01%) cycles in affected programs: 2737005 -> 2712129 (-0.91%) helped: 426 / HURT: 17 LOST: 0 GAINED: 3 Skylake and Broadwell had similar results. (Skylake shown) total cycles in shared programs: 842395356 -> 842338259 (<.01%) cycles in affected programs: 5460985 -> 5403888 (-1.05%) helped: 458 / HURT: 0 Haswell and Ivy Bridge had similar results. (Haswell shown) total instructions in shared programs: 16710449 -> 16708449 (-0.01%) instructions in affected programs: 44101 -> 42101 (-4.54%) helped: 75 / HURT: 0 total cycles in shared programs: 882760230 -> 882727923 (<.01%) cycles in affected programs: 2867797 -> 2835490 (-1.13%) helped: 62 / HURT: 10 No shader-db change on any other Intel platform. No fossil-db changes on any Intel platform. Fixes: 5ec75ca10d3 ("intel/compiler: Teach signed integer range analysis about imax and imin") Reviewed-by: Marcin Ĺšlusarz Part-of: --- src/intel/compiler/brw_nir_opt_peephole_imul32x16.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_nir_opt_peephole_imul32x16.c b/src/intel/compiler/brw_nir_opt_peephole_imul32x16.c index fb2522befae..2c68fca2068 100644 --- a/src/intel/compiler/brw_nir_opt_peephole_imul32x16.c +++ b/src/intel/compiler/brw_nir_opt_peephole_imul32x16.c @@ -135,7 +135,8 @@ signed_integer_range_analysis(nir_shader *shader, struct hash_table *range_ht, *lo = MAX2(src0_lo, src1_lo); *hi = MAX2(src0_hi, src1_hi); - break; + + return non_unary; } case nir_op_imin: { @@ -151,7 +152,8 @@ signed_integer_range_analysis(nir_shader *shader, struct hash_table *range_ht, *lo = MIN2(src0_lo, src1_lo); *hi = MIN2(src0_hi, src1_hi); - break; + + return non_unary; } default: