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.
/* { 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];
} "-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.