aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorTsung Chun Lin <tclin914@gmail.com>2025-01-07 14:48:31 -0700
committerJeff Law <jlaw@ventanamicro.com>2025-01-07 14:48:31 -0700
commitd953c2c5714ed8503c4ae1b7d059a62e4e9a0624 (patch)
treef61a515981fa7bba2a81d75b0b2f0997aacec67b /gcc/expr.cc
parentc6b5398e9e3c387910e1736f06525a0724a84b3e (diff)
downloadgcc-d953c2c5714ed8503c4ae1b7d059a62e4e9a0624.zip
gcc-d953c2c5714ed8503c4ae1b7d059a62e4e9a0624.tar.gz
gcc-d953c2c5714ed8503c4ae1b7d059a62e4e9a0624.tar.bz2
Prefer scalar_int_mode if the size - 1 is equal to UNITS_PER_WORD.
Don't use the QI vector if its size is equal to UNITS_PER_WORD for better code generation. Before patch: vsetivli zero,4,e8,mf4,ta,ma vmv.v.i v1,0 addi a4,sp,12 vse8.v v1,0(a4) After patch: sw zero,12(sp) gcc/ * expr.cc (widest_fixed_size_mode_for_size): Prefer scalar modes over vector modes in more cases. gcc/testsuite/ * gcc.target/riscv/rvv/autovec/pr113469.c: Update expected output. * gcc.target/riscv/rvv/base/movqi-1.c: New test.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 635bb9e..235e795 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -1062,12 +1062,13 @@ widest_fixed_size_mode_for_size (unsigned int size, by_pieces_operation op)
gcc_checking_assert (size > 1);
/* Use QI vector only if size is wider than a WORD. */
- if (can_use_qi_vectors (op) && size > UNITS_PER_WORD)
+ if (can_use_qi_vectors (op))
{
machine_mode mode;
fixed_size_mode candidate;
FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_INT)
if (is_a<fixed_size_mode> (mode, &candidate)
+ && GET_MODE_SIZE (candidate) > UNITS_PER_WORD
&& GET_MODE_INNER (candidate) == QImode)
{
if (GET_MODE_SIZE (candidate) >= size)