LoongArch failed to pass gcc.dg/pr104992.c with -mlsx and -mlasx. This test uses
different dg-final directives depending on the vect_int_mod result, LoongArch
SX/ASX supports this operations but corresponding description is not defined in
target-supports.exp. This patch solves the problem above with some
modification in proc check_effective_target_vect_int_mod.

gcc/testsuite/ChangeLog:

        * lib/target-supports.exp: Update check_effective_target_vect_int_mod 
according to
        LoongArch SX/ASX capabilities.
---
 gcc/testsuite/lib/target-supports.exp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 2de41cef2f6..b253dc578d2 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8586,6 +8586,8 @@ proc check_effective_target_vect_int_mod { } {
     return [check_cached_effective_target_indexed vect_int_mod {
       expr { ([istarget powerpc*-*-*]
              && [check_effective_target_has_arch_pwr10])
+            || ([istarget loongarch*-*-*]
+                && [check_effective_target_loongarch_sx])
              || [istarget amdgcn-*-*] }}]
 }
 
@@ -12656,6 +12658,22 @@ proc 
check_effective_target_const_volatile_readonly_section { } {
   return 1
 }
 
+proc check_effective_target_loongarch_sx { } {
+    return [check_no_compiler_messages loongarch_lsx assembly {
+       #if !defined(__loongarch_sx)
+       #error "LSX not defined"
+       #endif
+    }]
+}
+
+proc check_effective_target_loongarch_asx { } {
+    return [check_no_compiler_messages loongarch_asx assembly {
+       #if !defined(__loongarch_asx)
+       #error "LASX not defined"
+       #endif
+    }]
+}
+
 # Appends necessary Python flags to extra-tool-flags if Python.h is supported.
 # Otherwise, modifies dg-do-what.
 proc dg-require-python-h { args } {
-- 
2.36.0

Reply via email to