* [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities.
@ 2023-09-20 1:15 Chenghui Pan
2023-09-24 10:05 ` Xi Ruoyao
0 siblings, 1 reply; 6+ messages in thread
From: Chenghui Pan @ 2023-09-20 1:15 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities.
2023-09-20 1:15 [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities Chenghui Pan
@ 2023-09-24 10:05 ` Xi Ruoyao
2023-09-25 3:33 ` Chenghui Pan
2023-09-25 9:38 ` Chenghui Pan
0 siblings, 2 replies; 6+ messages in thread
From: Xi Ruoyao @ 2023-09-24 10:05 UTC (permalink / raw)
To: Chenghui Pan, gcc-patches; +Cc: i, chenglulu, xuchenghua
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 <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities.
2023-09-24 10:05 ` Xi Ruoyao
@ 2023-09-25 3:33 ` Chenghui Pan
2023-09-25 9:38 ` Chenghui Pan
1 sibling, 0 replies; 6+ messages in thread
From: Chenghui Pan @ 2023-09-25 3:33 UTC (permalink / raw)
To: Xi Ruoyao, gcc-patches; +Cc: i, chenglulu, xuchenghua
Thanks for your advice! I will check it out and submit a new version of
patch.
On Sun, 2023-09-24 at 18:05 +0800, Xi Ruoyao wrote:
> 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 } {
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities.
2023-09-24 10:05 ` Xi Ruoyao
2023-09-25 3:33 ` Chenghui Pan
@ 2023-09-25 9:38 ` Chenghui Pan
2023-09-25 9:44 ` Xi Ruoyao
1 sibling, 1 reply; 6+ messages in thread
From: Chenghui Pan @ 2023-09-25 9:38 UTC (permalink / raw)
To: Xi Ruoyao, gcc-patches; +Cc: i, chenglulu, xuchenghua
Hi!
After some attemptions, I think we still ne to check
"check_effective_target_loongarch_sx" in vect_int_mod. I wrote some
temp logics in gcc/testsuite/lib/target-supports.exp like this:
diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index 2de41cef2f6..91e1c22a6e1 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8586,7 +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 amdgcn-*-*] }}]
+ || [istarget loongarch*-*-*]
+ || [istarget amdgcn-*-*] }}]
}
# Return 1 if the target supports vector even/odd elements extraction,
0 otherwise.
@@ -11174,6 +11175,12 @@ proc check_vect_support_and_set_flags { } {
lappend DEFAULT_VECTCFLAGS "--param" "riscv-vector-abi"
set dg-do-what-default compile
}
+ } elseif [istarget loongarch*-*-*] {
+ if [check_effective_target_loongarch_asx_hw] {
+ lappend DEFAULT_VECTCFLAGS "-mdouble-float" "-mlasx"
+ } elseif [check_effective_target_loongarch_sx_hw] {
+ lappend DEFAULT_VECTCFLAGS "-mdouble-float" "-mlsx"
+ }
} else {
return 0
}
\* temp impl of sx/asx hw proc *\
And then in make check without --target_board=unix/-mlasx, vect.exp is
invoked with expected vector isa options, but pr104992.c failed because
it expected result with "vect_int_mod returns 1" but it was compiled
without -mlsx/-mlasx. Seems pr104992.c is invoked by gcc.dg/dg.exp,
pr104992.c is not affected by DEFAULT_CFLAGS, so we still need to check
if LSX/LASX is available in vect_int_mod.
Other parts of new patch is still WIP.
On Sun, 2023-09-24 at 18:05 +0800, Xi Ruoyao wrote:
> 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 } {
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities.
2023-09-25 9:38 ` Chenghui Pan
@ 2023-09-25 9:44 ` Xi Ruoyao
2023-09-25 9:51 ` Chenghui Pan
0 siblings, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2023-09-25 9:44 UTC (permalink / raw)
To: Chenghui Pan, gcc-patches; +Cc: i, chenglulu, xuchenghua
On Mon, 2023-09-25 at 17:38 +0800, Chenghui Pan wrote:
> Hi!
>
> After some attemptions, I think we still ne to check
> "check_effective_target_loongarch_sx" in vect_int_mod. I wrote some
> temp logics in gcc/testsuite/lib/target-supports.exp like this:
>
> diff --git a/gcc/testsuite/lib/target-supports.exp
> b/gcc/testsuite/lib/target-supports.exp
> index 2de41cef2f6..91e1c22a6e1 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -8586,7 +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 amdgcn-*-*] }}]
> + || [istarget loongarch*-*-*]
> + || [istarget amdgcn-*-*] }}]
> }
>
> # Return 1 if the target supports vector even/odd elements extraction,
> 0 otherwise.
> @@ -11174,6 +11175,12 @@ proc check_vect_support_and_set_flags { } {
> lappend DEFAULT_VECTCFLAGS "--param" "riscv-vector-abi"
> set dg-do-what-default compile
> }
> + } elseif [istarget loongarch*-*-*] {
> + if [check_effective_target_loongarch_asx_hw] {
> + lappend DEFAULT_VECTCFLAGS "-mdouble-float" "-mlasx"
> + } elseif [check_effective_target_loongarch_sx_hw] {
> + lappend DEFAULT_VECTCFLAGS "-mdouble-float" "-mlsx"
> + }
I think we can always enable LASX in DEFAULT_VECTCFLAGS, but set dg-do-
what-default to "run" only if both the hardware and the kernel supports
LASX. If the kernel or the hardware is not capable we set dg-do-what-
default to "compile".
> } else {
> return 0
> }
> \* temp impl of sx/asx hw proc *\
>
> And then in make check without --target_board=unix/-mlasx, vect.exp is
> invoked with expected vector isa options, but pr104992.c failed because
> it expected result with "vect_int_mod returns 1" but it was compiled
> without -mlsx/-mlasx. Seems pr104992.c is invoked by gcc.dg/dg.exp,
> pr104992.c is not affected by DEFAULT_CFLAGS, so we still need to check
> if LSX/LASX is available in vect_int_mod.
>
> Other parts of new patch is still WIP.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities.
2023-09-25 9:44 ` Xi Ruoyao
@ 2023-09-25 9:51 ` Chenghui Pan
0 siblings, 0 replies; 6+ messages in thread
From: Chenghui Pan @ 2023-09-25 9:51 UTC (permalink / raw)
To: Xi Ruoyao, gcc-patches; +Cc: i, chenglulu, xuchenghua
Thanks! I will try to improve it.
On Mon, 2023-09-25 at 17:44 +0800, Xi Ruoyao wrote:
> On Mon, 2023-09-25 at 17:38 +0800, Chenghui Pan wrote:
> > Hi!
> >
> > After some attemptions, I think we still ne to check
> > "check_effective_target_loongarch_sx" in vect_int_mod. I wrote some
> > temp logics in gcc/testsuite/lib/target-supports.exp like this:
> >
> > diff --git a/gcc/testsuite/lib/target-supports.exp
> > b/gcc/testsuite/lib/target-supports.exp
> > index 2de41cef2f6..91e1c22a6e1 100644
> > --- a/gcc/testsuite/lib/target-supports.exp
> > +++ b/gcc/testsuite/lib/target-supports.exp
> > @@ -8586,7 +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 amdgcn-*-*] }}]
> > + || [istarget loongarch*-*-*]
> > + || [istarget amdgcn-*-*] }}]
> > }
> >
> > # Return 1 if the target supports vector even/odd elements
> > extraction,
> > 0 otherwise.
> > @@ -11174,6 +11175,12 @@ proc check_vect_support_and_set_flags { }
> > {
> > lappend DEFAULT_VECTCFLAGS "--param" "riscv-vector-abi"
> > set dg-do-what-default compile
> > }
> > + } elseif [istarget loongarch*-*-*] {
> > + if [check_effective_target_loongarch_asx_hw] {
> > + lappend DEFAULT_VECTCFLAGS "-mdouble-float" "-mlasx"
> > + } elseif [check_effective_target_loongarch_sx_hw] {
> > + lappend DEFAULT_VECTCFLAGS "-mdouble-float" "-mlsx"
> > + }
>
> I think we can always enable LASX in DEFAULT_VECTCFLAGS, but set dg-
> do-
> what-default to "run" only if both the hardware and the kernel
> supports
> LASX. If the kernel or the hardware is not capable we set dg-do-
> what-
> default to "compile".
>
> > } else {
> > return 0
> > }
> > \* temp impl of sx/asx hw proc *\
> >
> > And then in make check without --target_board=unix/-mlasx, vect.exp
> > is
> > invoked with expected vector isa options, but pr104992.c failed
> > because
> > it expected result with "vect_int_mod returns 1" but it was
> > compiled
> > without -mlsx/-mlasx. Seems pr104992.c is invoked by gcc.dg/dg.exp,
> > pr104992.c is not affected by DEFAULT_CFLAGS, so we still need to
> > check
> > if LSX/LASX is available in vect_int_mod.
> >
> > Other parts of new patch is still WIP.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-25 9:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 1:15 [PATCH v1] Update check_effective_target_vect_int_mod according to LoongArch SX/ASX capabilities Chenghui Pan
2023-09-24 10:05 ` Xi Ruoyao
2023-09-25 3:33 ` Chenghui Pan
2023-09-25 9:38 ` Chenghui Pan
2023-09-25 9:44 ` Xi Ruoyao
2023-09-25 9:51 ` Chenghui Pan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).