]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: testsuite: Add zvl requirement to PR123626.
authorRobin Dapp <rdapp@oss.qualcomm.com>
Wed, 28 Jan 2026 16:54:42 +0000 (17:54 +0100)
committerRobin Dapp <rdapp@oss.qualcomm.com>
Thu, 29 Jan 2026 16:37:49 +0000 (17:37 +0100)
This adds a new require-effective-target check to pr123626.c.
As the test is a run test compiled with _zvl256b we need
to ensure the target actually supports 256b vectors.

We can only check for exactly 256b right now
(rvv_zvl256b_ok), i.e. "VLS".  Therefore, the patch also adds
a new target check rvv_zvl_ge_256b_ok where ge means greater
or equal.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp: Add rvv_zvl_ge_256b_ok.
* gcc.target/riscv/rvv/base/pr123626.c: Use new target check.

gcc/testsuite/gcc.target/riscv/rvv/base/pr123626.c
gcc/testsuite/lib/target-supports.exp

index ddf9b065d91e3513de86a6a3768f57fee0ee434f..b7ef113cbcc6439ab773cd787301936e6b1ec6a2 100644 (file)
@@ -1,6 +1,8 @@
 /* { dg-do run } */
 /* { dg-options "-march=rv64gcv_zvl256b -mabi=lp64d -O3 -fsigned-char -fno-strict-aliasing -fwrapv -std=gnu99" { target rv64 } } */
 /* { dg-options "-march=rv32gcv_zvl256b -mabi=ilp32 -O3 -fsigned-char -fno-strict-aliasing -fwrapv -std=gnu99" { target rv32 } } */
+/* { dg-require-effective-target rvv_zvl_ge_256b_ok } */
+
 short a;
 long long b;
 char c[3][3][17];
index 87c216644224c4662ef7648669f3211f568d80b5..72a8eebbcb115156599faa6ccb26afaaba64371e 100644 (file)
@@ -2163,6 +2163,24 @@ proc check_effective_target_rvv_zvl256b_ok { } {
       } "-march=${gcc_march}"]
 }
 
+# Return 1 if the target runtime supports at least 256-bit
+# vectors, 0 otherwise.  Cache the result.
+
+proc check_effective_target_rvv_zvl_ge_256b_ok { } {
+    # Check if the target has at least a VLENB of 32.
+    set gcc_march [riscv_get_arch]
+    return [check_runtime ${gcc_march}_exec {
+       int main()
+       {
+         int vlenb = 0;
+         asm ("csrr %0,vlenb" : "=r" (vlenb) : : );
+         if (vlenb >= 32)
+           return 0;
+         return 1;
+       }
+      } "-march=${gcc_march}"]
+}
+
 # Return 1 if the target runtime supports 512-bit vectors, 0 otherwise.
 # Cache the result.