]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: testsuite: Fix popcount test.
authorRobin Dapp <rdapp@ventanamicro.com>
Mon, 20 Nov 2023 16:12:14 +0000 (17:12 +0100)
committerRobin Dapp <rdapp@ventanamicro.com>
Tue, 21 Nov 2023 20:06:13 +0000 (21:06 +0100)
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/testsuite/gcc.target/riscv/rvv/autovec/unop/popcount.c
gcc/testsuite/lib/target-supports.exp

index 585a522aa812dd609affd922e4bec5f66d55f64d..ca1319c2e7edc773eb2f8e508de38483f08af513 100644 (file)
@@ -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 } } } } } */
index f3cd0311e2741d3a559a4c81069bbe4a227ef446..87b2ae58720972cda5a62aa0a974340ab7f4b713 100644 (file)
@@ -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 { } {