On Mon, Dec 09, 2024 at 06:05:10PM +0100, Robin Dapp wrote:
> > +/* { dg-additional-options "-mabi=lp64d" { target { rv64 } } } */
> > +/* { dg-additional-options "-mabi=ilp32d" { target { rv32 } } } */
> 
> Wouldn't skipping those tests also be reasonable?
> I.e. adding a target to the compile directive instead.  I'd find that a bit
> more intuitive than overriding the ABI.
> The same might apply to the other cases you touched.  In the end it's probably
> a question of taste but why if your test target mandates an ABI that cannot
> compile vector tests, why compile them at all?

Yes, it's perfectly reasonable to skip such tests for ILP32E default
ABI.  I can prepare a patch to filter with "check_effective_target_riscv_e".

But instead of adding a new effective_target filter to hundreds of test
cases, we could simply prune the test results.  Would the bellow
approach be acceptable?

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 312db38203d..ee1868e2f12 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -423,6 +423,10 @@ proc gcc-dg-prune { system text } {
        return "::unsupported::memory full"
     }
 
+    if { [regexp "(^|\n)\[^\n\]*error: ILP32E ABI does not support the 
\[^\n\]* extension" $text]
+         && [check_effective_target_riscv_e] } {
+       return "::unsupported::ilp32e extension"
+    }
     if { [string match "*error: function pointers not supported*" $text]
          && ![check_effective_target_function_pointers] } {
        # The format here is important.  See dg.exp.
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index f2edbef92da..4f7107b5490 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1904,6 +1904,18 @@ proc check_effective_target_riscv_a { } {
     }]
 }
 
+# Return 1 if the target arch has the E extension, 0 otherwise.
+# Such support implies that default ABI is either ILP32E or ILP64E.
+# Cache the result.
+
+proc check_effective_target_riscv_e { } {
+    return [check_no_compiler_messages riscv_ext_e assembly {
+       #ifndef __riscv_e
+       #error "Not __riscv_e"
+       #endif
+    }]
+}
+
 # Return 1 if the target arch supports the atomic LRSC extension, 0 otherwise.
 # Cache the result.
 
diff --git a/gcc/testsuite/lib/target-utils.exp 
b/gcc/testsuite/lib/target-utils.exp
index 6140ad7cf9f..9a14e4db8e5 100644
--- a/gcc/testsuite/lib/target-utils.exp
+++ b/gcc/testsuite/lib/target-utils.exp
@@ -48,5 +48,9 @@ proc ${tool}_check_unsupported_p { output } {
          && ![check_effective_target_large_return_values] } {
        return "large return values not supported"
     }
+    if { [string match "(^|\n)\[^\n\]*error: ILP32E ABI does not support the 
\[^\n\]* extension" $output]
+         && [check_effective_target_riscv_e] } {
+       return "ILP32E ABI does not support an extension"
+    }
     return ""
 }

Reply via email to