* [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX.
@ 2023-09-26 11:56 Chenghui Pan
2023-09-26 11:56 ` [PATCH v2 1/2] Enable vect.exp for LoongArch Chenghui Pan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chenghui Pan @ 2023-09-26 11:56 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
This is an update of:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630953.html
This version of patch set contains code that enable vect.exp for LoongArch
target when target environment is capable of running LASX instructions.
After some attemptions, we still need "check_effective_target_loongarch_sx"
in "proc check_effective_target_vect_int_mod {}" to choose correct dg-final
directives for LoongArch, because DEFAULT_VECTCFLAGS cannot affect pr104992.c
which is invoked by gcc.dg/dg.exp (not vect.exp).
Chenghui Pan (2):
Enable vect.exp for LoongArch.
Add LoongArch in check_effective_target_vect_int_mod according to ISA
capabilities.
gcc/testsuite/lib/target-supports.exp | 49 +++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
--
2.36.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] Enable vect.exp for LoongArch.
2023-09-26 11:56 [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX Chenghui Pan
@ 2023-09-26 11:56 ` Chenghui Pan
2023-09-26 11:56 ` [PATCH v2 2/2] Add LoongArch in check_effective_target_vect_int_mod according to ISA capabilities Chenghui Pan
2023-09-26 12:09 ` [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX Chenghui Pan
2 siblings, 0 replies; 4+ messages in thread
From: Chenghui Pan @ 2023-09-26 11:56 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
gcc/testsuite/ChangeLog:
* lib/target-supports.exp: Enable vect.exp for LoongArch.
---
gcc/testsuite/lib/target-supports.exp | 31 +++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 2de41cef2f6..17863288ff0 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -11174,6 +11174,13 @@ proc check_vect_support_and_set_flags { } {
lappend DEFAULT_VECTCFLAGS "--param" "riscv-vector-abi"
set dg-do-what-default compile
}
+ } elseif [istarget loongarch*-*-*] {
+ lappend DEFAULT_VECTCFLAGS "-mdouble-float" "-mlasx"
+ if [check_effective_target_loongarch_asx_hw] {
+ set dg-do-what-default run
+ } else {
+ set dg-do-what-default compile
+ }
} else {
return 0
}
@@ -12656,6 +12663,30 @@ proc check_effective_target_const_volatile_readonly_section { } {
return 1
}
+proc check_effective_target_loongarch_sx_hw { } {
+ return [check_runtime loongarch_sx_hw {
+ #include <lsxintrin.h>
+ int main (void)
+ {
+ __m128i a, b, c;
+ c = __lsx_vand_v (a, b);
+ return 0;
+ }
+ } "-mlsx"]
+}
+
+proc check_effective_target_loongarch_asx_hw { } {
+ return [check_runtime loongarch_asx_hw {
+ #include <lasxintrin.h>
+ int main (void)
+ {
+ __m256i a, b, c;
+ c = __lasx_xvand_v (a, b);
+ return 0;
+ }
+ } "-mlasx"]
+}
+
# 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] 4+ messages in thread
* [PATCH v2 2/2] Add LoongArch in check_effective_target_vect_int_mod according to ISA capabilities.
2023-09-26 11:56 [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX Chenghui Pan
2023-09-26 11:56 ` [PATCH v2 1/2] Enable vect.exp for LoongArch Chenghui Pan
@ 2023-09-26 11:56 ` Chenghui Pan
2023-09-26 12:09 ` [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX Chenghui Pan
2 siblings, 0 replies; 4+ messages in thread
From: Chenghui Pan @ 2023-09-26 11:56 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua, Chenghui Pan
gcc/testsuite/ChangeLog:
* lib/target-supports.exp: Add LoongArch in
check_effective_target_vect_int_mod according to ISA 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 17863288ff0..4a84dee430b 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-*-*] }}]
}
@@ -12663,6 +12665,14 @@ 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_sx_hw { } {
return [check_runtime loongarch_sx_hw {
#include <lsxintrin.h>
@@ -12675,6 +12685,14 @@ proc check_effective_target_loongarch_sx_hw { } {
} "-mlsx"]
}
+proc check_effective_target_loongarch_asx { } {
+ return [check_no_compiler_messages loongarch_asx assembly {
+ #if !defined(__loongarch_asx)
+ #error "LASX not defined"
+ #endif
+ }]
+}
+
proc check_effective_target_loongarch_asx_hw { } {
return [check_runtime loongarch_asx_hw {
#include <lasxintrin.h>
--
2.36.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX.
2023-09-26 11:56 [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX Chenghui Pan
2023-09-26 11:56 ` [PATCH v2 1/2] Enable vect.exp for LoongArch Chenghui Pan
2023-09-26 11:56 ` [PATCH v2 2/2] Add LoongArch in check_effective_target_vect_int_mod according to ISA capabilities Chenghui Pan
@ 2023-09-26 12:09 ` Chenghui Pan
2 siblings, 0 replies; 4+ messages in thread
From: Chenghui Pan @ 2023-09-26 12:09 UTC (permalink / raw)
To: gcc-patches; +Cc: xry111, i, chenglulu, xuchenghua
Correction: vect.exp will be set to run when target is capable of
running LASX instructions, otherwise it will be compiled only.
On Tue, 2023-09-26 at 19:56 +0800, Chenghui Pan wrote:
> This is an update of:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630953.html
>
> This version of patch set contains code that enable vect.exp for
> LoongArch
> target when target environment is capable of running LASX
> instructions.
>
> After some attemptions, we still need
> "check_effective_target_loongarch_sx"
> in "proc check_effective_target_vect_int_mod {}" to choose correct
> dg-final
> directives for LoongArch, because DEFAULT_VECTCFLAGS cannot affect
> pr104992.c
> which is invoked by gcc.dg/dg.exp (not vect.exp).
>
> Chenghui Pan (2):
> Enable vect.exp for LoongArch.
> Add LoongArch in check_effective_target_vect_int_mod according to
> ISA
> capabilities.
>
> gcc/testsuite/lib/target-supports.exp | 49
> +++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-26 12:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 11:56 [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX Chenghui Pan
2023-09-26 11:56 ` [PATCH v2 1/2] Enable vect.exp for LoongArch Chenghui Pan
2023-09-26 11:56 ` [PATCH v2 2/2] Add LoongArch in check_effective_target_vect_int_mod according to ISA capabilities Chenghui Pan
2023-09-26 12:09 ` [PATCH v2 0/2] Update target-supports.exp for LoongArch SX/ASX 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).