Message ID | 613ff2b6-068d-41ee-bd23-17c8b2ccc9dc@gmail.com |
---|---|
State | New |
Headers | show |
Series | RISC-V: testsuite: Fix popcount test. | expand |
Mhm, not so obvious after all. We vectorize 250 instances with rv32gcv, 229 with rv64gcv and 250 with rv64gcv_zbb. Will have another look tomorrow. Regards Robin
> Mhm, not so obvious after all. We vectorize 250 instances with > rv32gcv, 229 with rv64gcv and 250 with rv64gcv_zbb. Will have > another look tomorrow. The problem is that tree-vect-patterns is more restrictive than necessary and does not vectorize everything it could. Therefore I'm going to commit the attached with a TODO comment and a separate check for zbb. Regards Robin Subject: [PATCH v2] RISC-V: testsuite: Fix popcount test. Due to Jakub's recent middle-end changes we now vectorize some more popcount instances. This patch just adjusts the dump check. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/unop/popcount.c: Adjust check. * lib/target-supports.exp: Add riscv_zbb. --- .../gcc.target/riscv/rvv/autovec/unop/popcount.c | 10 +++++++++- gcc/testsuite/lib/target-supports.exp | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c index 585a522aa81..ca1319c2e7e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c @@ -1461,4 +1461,12 @@ main () RUN_ALL () } -/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 229 "vect" } } */ +/* TODO: Due to an over-zealous check in tree-vect-patterns we do not vectorize + e.g. + uint64_t dst[]; + uint32_t src[]; + dst[i] = __builtin_popcountll (src[i]); + even though we could. Therefore, for now, adjust the following checks. + This difference was exposed in r14-5557-g6dd4c703be17fa. */ +/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 229 "vect" { target { { rv64 } && { ! riscv_zbb } } } } } */ +/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 250 "vect" { target { { rv32 } || { riscv_zbb } } } } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f3cd0311e27..87b2ae58720 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1983,6 +1983,17 @@ proc check_effective_target_riscv_ztso { } { }] } +# Return 1 if the target arch supports the Zbb extension, 0 otherwise. +# Cache the result. + +proc check_effective_target_riscv_zbb { } { + return [check_no_compiler_messages riscv_ext_zbb assembly { + #ifndef __riscv_zbb + #error "Not __riscv_zbb" + #endif + }] +} + # Return 1 if we can execute code when using dg-add-options riscv_v proc check_effective_target_riscv_v_ok { } {
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c index 585a522aa81..7323dfa0031 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c @@ -1461,4 +1461,4 @@ main () RUN_ALL () } -/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 229 "vect" } } */ +/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 250 "vect" } } */