On Wed, 2023-09-20 at 09:15 +0800, Chenghui Pan wrote:
> 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.

I think we can just add -mdouble-float -mlasx into DEFAULT_VECTCFLAGS
and always enable vect_int_mod for LoongArch.  This will make vect.exp
tests automatically run for every "make check" on LoongArch.

> 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 } {

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to