[PATCH] RISC-V: Fix zvl effective-target check cache collision

Jin Ma <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
The rvv_zvl*_ok checks use the same check_runtime property despite
testing different vector lengths.  Whichever check runs first supplies
the cached result for all of them.  Thus a VLEN=128 check can control
VLEN=256 tests and vice versa, causing unsupported tests to run or
supported tests to be skipped.

Give each check a unique property.  The existing tests already cover
the affected checks and expose this order-dependent intermittent
failure, so no new testcase is needed.

gcc/testsuite/ChangeLog:

	* lib/target-supports.exp (check_effective_target_rvv_zvl128b_ok):
	Use a unique check_runtime property name.
	(check_effective_target_rvv_zvl256b_ok): Likewise.
	(check_effective_target_rvv_zvl_ge_256b_ok): Likewise.
	(check_effective_target_rvv_zvl512b_ok): Likewise.

Signed-off-by: Jin Ma <[email protected]>
---
 gcc/testsuite/lib/target-supports.exp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 1727887d3f4..13a26910094 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2177,7 +2177,7 @@ proc check_effective_target_riscv_v { } {
 proc check_effective_target_rvv_zvl128b_ok { } {
     # Check if the target has a VLENB of 16.
     set gcc_march [riscv_get_arch]
-    return [check_runtime ${gcc_march}_exec {
+    return [check_runtime ${gcc_march}_zvl128b_exec {
        int main()
        {
          int vlenb = 0;
@@ -2195,7 +2195,7 @@ proc check_effective_target_rvv_zvl128b_ok { } {
 proc check_effective_target_rvv_zvl256b_ok { } {
     # Check if the target has a VLENB of 32.
     set gcc_march [riscv_get_arch]
-    return [check_runtime ${gcc_march}_exec {
+    return [check_runtime ${gcc_march}_zvl256b_exec {
 	int main()
 	{
 	  int vlenb = 0;
@@ -2213,7 +2213,7 @@ proc check_effective_target_rvv_zvl256b_ok { } {
 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 {
+    return [check_runtime ${gcc_march}_zvl_ge_256b_exec {
 	int main()
 	{
 	  int vlenb = 0;
@@ -2231,7 +2231,7 @@ proc check_effective_target_rvv_zvl_ge_256b_ok { } {
 proc check_effective_target_rvv_zvl512b_ok { } {
     # Check if the target has a VLENB of 64.
     set gcc_march [riscv_get_arch]
-    return [check_runtime ${gcc_march}_exec {
+    return [check_runtime ${gcc_march}_zvl512b_exec {
 	int main()
 	{
 	  int vlenb = 0;
-- 
2.52.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.