From: Robin Dapp Date: Mon, 20 Nov 2023 16:12:14 +0000 (+0100) Subject: RISC-V: testsuite: Fix popcount test. X-Git-Tag: basepoints/gcc-15~4443 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=638c2f3caf01b1b570b403235ad6a28bd8245fc6;p=thirdparty%2Fgcc.git 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. --- 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 585a522aa812..ca1319c2e7ed 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 f3cd0311e274..87b2ae587209 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 { } {