From: Jim Tsung-Chun Lin <j...@andestech.com> Re-sending this via git send-email to avoid the application/octet-stream attachement type that prevents Patchworks/CI from finding the patch.
--- 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 | 2 +- gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index babf00f34dc..e2abef1f544 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -1062,7 +1062,7 @@ 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) && (size - 1) > UNITS_PER_WORD) { machine_mode mode; fixed_size_mode candidate; diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c index 52e2580c53e..6549ae61c67 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113469.c @@ -51,5 +51,4 @@ void p(int buf, __builtin_va_list ab, int q) { } while (k); } -/* { dg-final { scan-assembler-times {vsetivli\tzero,\s*4,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 1 } } */ /* { dg-final { scan-assembler-times {vsetivli\tzero,\s*8,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 1 } } */ -- 2.34.1