From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7924) id BB61C3858D33; Wed, 18 Oct 2023 01:03:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB61C3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697591012; bh=EDs6CMX7T6d4i4qCrSW1HGQLL9M3LD6Obes7cavYHq4=; h=From:To:Subject:Date:From; b=qszzP6bZNN7meR48w0ENQ+FOA+5oc7ACkfB09AzkbA5w9NhY78SbpUDpofwqgYjGQ ds4j6Vwb405Gh+CAWeQL6h+r/viQ2F/RBiTMpPJMmXquJ+b7twj1ETRpysVGXskRRP jIQC/ZnBTvsW/KfvrPh5LXG0LpsOBCvZdhi471to= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pan Li To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4700] RISC-V: Enable more tests for dynamic LMUL and bug fix[PR111832] X-Act-Checkin: gcc X-Git-Author: Juzhe-Zhong X-Git-Refname: refs/heads/master X-Git-Oldrev: fb69acffa95c4451dccbb2351fb6765fd5a8fd0b X-Git-Newrev: cf7739d4a6ba0b88068877d14439436c22b57630 Message-Id: <20231018010332.BB61C3858D33@sourceware.org> Date: Wed, 18 Oct 2023 01:03:32 +0000 (GMT) List-Id: https://gcc.gnu.org/g:cf7739d4a6ba0b88068877d14439436c22b57630 commit r14-4700-gcf7739d4a6ba0b88068877d14439436c22b57630 Author: Juzhe-Zhong Date: Tue Oct 17 15:30:39 2023 +0800 RISC-V: Enable more tests for dynamic LMUL and bug fix[PR111832] Last time, Robin has mentioned that dynamic LMUL will cause ICE in SPEC: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629992.html which is caused by assertion FAIL. When we enable more currents in rvv.exp with dynamic LMUL, such issue can be reproduced and has a PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111832 Now, we enable more tests in rvv.exp in this patch and fix the bug. PR target/111832 gcc/ChangeLog: * config/riscv/riscv-vector-costs.cc (get_biggest_mode): New function. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/rvv.exp: Enable more dynamic tests. Diff: --- gcc/config/riscv/riscv-vector-costs.cc | 19 +++++++++++++------ gcc/testsuite/gcc.target/riscv/rvv/rvv.exp | 10 ++++++++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/gcc/config/riscv/riscv-vector-costs.cc b/gcc/config/riscv/riscv-vector-costs.cc index 33061efb1d0e..af87388a1e4d 100644 --- a/gcc/config/riscv/riscv-vector-costs.cc +++ b/gcc/config/riscv/riscv-vector-costs.cc @@ -154,6 +154,14 @@ compute_local_program_points ( } } +static machine_mode +get_biggest_mode (machine_mode mode1, machine_mode mode2) +{ + unsigned int mode1_size = GET_MODE_BITSIZE (mode1).to_constant (); + unsigned int mode2_size = GET_MODE_BITSIZE (mode2).to_constant (); + return mode1_size >= mode2_size ? mode1 : mode2; +} + /* Compute local live ranges of each vectorized variable. Note that we only compute local live ranges (within a block) since local live ranges information is accurate enough for us to determine @@ -201,12 +209,12 @@ compute_local_live_ranges ( { unsigned int point = program_point.point; gimple *stmt = program_point.stmt; - machine_mode mode = biggest_mode; tree lhs = gimple_get_lhs (stmt); if (lhs != NULL_TREE && is_gimple_reg (lhs) && !POINTER_TYPE_P (TREE_TYPE (lhs))) { - mode = TYPE_MODE (TREE_TYPE (lhs)); + biggest_mode = get_biggest_mode (biggest_mode, + TYPE_MODE (TREE_TYPE (lhs))); bool existed_p = false; pair &live_range = live_ranges->get_or_insert (lhs, &existed_p); @@ -225,7 +233,9 @@ compute_local_live_ranges ( the future. */ if (is_gimple_val (var) && !POINTER_TYPE_P (TREE_TYPE (var))) { - mode = TYPE_MODE (TREE_TYPE (var)); + biggest_mode + = get_biggest_mode (biggest_mode, + TYPE_MODE (TREE_TYPE (var))); bool existed_p = false; pair &live_range = live_ranges->get_or_insert (var, &existed_p); @@ -238,9 +248,6 @@ compute_local_live_ranges ( live_range = pair (0, point); } } - if (GET_MODE_SIZE (mode).to_constant () - > GET_MODE_SIZE (biggest_mode).to_constant ()) - biggest_mode = mode; } if (dump_enabled_p ()) for (hash_map::iterator iter = live_ranges->begin (); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp index ff76e17d0e6c..674ba0d72b48 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp +++ b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp @@ -58,10 +58,12 @@ set AUTOVEC_TEST_OPTS [list \ {-ftree-vectorize -O3 --param riscv-autovec-lmul=m2} \ {-ftree-vectorize -O3 --param riscv-autovec-lmul=m4} \ {-ftree-vectorize -O3 --param riscv-autovec-lmul=m8} \ + {-ftree-vectorize -O3 --param riscv-autovec-lmul=dynamic} \ {-ftree-vectorize -O2 --param riscv-autovec-lmul=m1} \ {-ftree-vectorize -O2 --param riscv-autovec-lmul=m2} \ {-ftree-vectorize -O2 --param riscv-autovec-lmul=m4} \ - {-ftree-vectorize -O2 --param riscv-autovec-lmul=m8} ] + {-ftree-vectorize -O2 --param riscv-autovec-lmul=m8} \ + {-ftree-vectorize -O2 --param riscv-autovec-lmul=dynamic} ] foreach op $AUTOVEC_TEST_OPTS { dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/partial/*.\[cS\]]] \ "" "$op" @@ -104,18 +106,22 @@ set AUTOVEC_TEST_OPTS [list \ {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \ + {-ftree-vectorize -O3 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=dynamic -ffast-math} \ {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m1 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \ + {-ftree-vectorize -O2 --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=dynamic -ffast-math} \ {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m1 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \ + {-ftree-vectorize -O3 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=dynamic -ffast-math} \ {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m1 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m2 -fno-vect-cost-model -ffast-math} \ {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m4 -fno-vect-cost-model -ffast-math} \ - {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} ] + {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=m8 -fno-vect-cost-model -ffast-math} \ + {-ftree-vectorize -O2 --param riscv-autovec-preference=scalable --param riscv-autovec-lmul=dynamic -ffast-math} ] foreach op $AUTOVEC_TEST_OPTS { dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/gather-scatter/*.\[cS\]]] \ "" "$op"