public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work029)] PowerPC: Add long double target-supports.
@ 2020-12-04 1:18 Michael Meissner
0 siblings, 0 replies; 4+ messages in thread
From: Michael Meissner @ 2020-12-04 1:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3efbeeb7ff100e8c55a3b56e2e7da0eb51c73de4
commit 3efbeeb7ff100e8c55a3b56e2e7da0eb51c73de4
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Thu Dec 3 20:16:08 2020 -0500
PowerPC: Add long double target-supports.
This patch adds 6 target supports to test what type of PowerPC long double is
used by the test:
1) Long double uses the IBM 128-bit extended double format;
2) Long double uses the IEEE 128-bit format;
3) We can force long double to use IBM 128-bit and GLIBC works;
4) We can force long double to use IEEE 128-bit and GLIBC works;
5) Long double uses one of the 128-bit formats; (and)
6) Long double uses the 64-bit format.
gcc/testsuite/
2020-12-03 Michael Meissner <meissner@linux.ibm.com>
* lib/target-supports.exp
(check_effective_target_ppc_long_double_ibm): New function.
(check_effective_target_ppc_long_double_ieee): New function.
(check_effective_target_ppc_long_double_override_ibm): New function.
(check_effective_target_ppc_long_double_override_ieee): New function.
(check_effective_target_ppc_long_double_128bit): New function.
(check_effective_target_ppc_long_double_64bit): New function.
Diff:
---
gcc/testsuite/lib/target-supports.exp | 122 ++++++++++++++++++++++++++++++++++
1 file changed, 122 insertions(+)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ff6bc5f4b92..01b82843bf5 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2348,6 +2348,128 @@ proc check_effective_target_ppc_ieee128_ok { } {
}]
}
+# See if the target is a powerpc with the long double format that uses the IBM
+# extended double format.
+
+proc check_effective_target_ppc_long_double_ibm { } {
+ return [check_cached_effective_target ppc_long_double_ibm {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IBM128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that uses the IEEE
+# 128-bit format.
+
+proc check_effective_target_ppc_long_double_ieee { } {
+ return [check_cached_effective_target ppc_long_double_ieee {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IEEE128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }]
+}
+
+# Like check_effective_target_ppc_long_double_ibm, but check if we can
+# explicitly override the long double format to use the IBM 128-bit extended
+# double format, and GLIBC supports doing this override by switching the
+# sprintf to handle long double.
+
+proc check_effective_target_ppc_long_double_override_ibm { } {
+ set options "-mlong-double-128 -mabi=ibmlongdouble -Wno-psabi"
+ check_runtime_nocache ppc_long_double_ovveride_ibm {
+ #include <string.h>
+ #include <stdio.h>
+ volatile __ibm128 a = (__ibm128) 3.0;
+ volatile long double one = 1.0L;
+ volatile long double two = 2.0L;
+ volatile long double b;
+ char buffer[20];
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IBM128__)
+ return 1;
+ #else
+ b = one + two;
+ if (memcmp ((void *)&a, (void *)&b, sizeof (long double)) != 0)
+ return 1;
+ sprintf (buffer, "%lg", b);
+ return strcmp (buffer, "3") != 0;
+ #endif
+ }
+ } $options
+}
+
+# Like check_effective_target_ppc_long_double_ieee, but check if we can
+# explicitly override the long double format to use the IEEE 128-bit format,
+# and GLIBC supports doing this override by switching the sprintf to handle
+# long double.
+
+proc check_effective_target_ppc_long_double_override_ieee { } {
+ set options "-mlong-double-128 -mabi=ieeelongdouble -Wno-psabi"
+ check_runtime_nocache ppc_long_double_ovveride_ieee {
+ #include <string.h>
+ #include <stdio.h>
+ volatile _Float128 a = 3.0f128;
+ volatile long double one = 1.0L;
+ volatile long double two = 2.0L;
+ volatile long double b;
+ char buffer[20];
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IEEE128__)
+ return 1;
+ #else
+ b = one + two;
+ if (memcmp ((void *)&a, (void *)&b, sizeof (long double)) != 0)
+ return 1;
+ sprintf (buffer, "%lg", b);
+ return strcmp (buffer, "3") != 0;
+ #endif
+ }
+ } $options
+}
+
+# See if the target is a powerpc with the long double format that is 128-bits.
+
+proc check_effective_target_ppc_long_double_128bit { } {
+ return [check_cached_effective_target ppc_long_double_128bit {
+ int main()
+ {
+ #ifndef _ARCH_PPC
+ return 1;
+ #else
+ return sizeof (long double) != 16;
+ #endif
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that is 64-bit.
+
+proc check_effective_target_ppc_long_double_64bit { } {
+ return [check_cached_effective_target ppc_long_double_64bit {
+ int main()
+ {
+ #ifndef _ARCH_PPC
+ return 1;
+ #else
+ return sizeof (long double) != 8;
+ #endif
+ }
+ }]
+}
+
# Return 1 if the target supports executing VSX instructions, 0
# otherwise. Cache the result.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/meissner/heads/work029)] PowerPC: Add long double target-supports.
@ 2020-12-03 21:38 Michael Meissner
0 siblings, 0 replies; 4+ messages in thread
From: Michael Meissner @ 2020-12-03 21:38 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c8641f4384a45de97985c220d2f4cc923a5c5edb
commit c8641f4384a45de97985c220d2f4cc923a5c5edb
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Thu Dec 3 16:37:46 2020 -0500
PowerPC: Add long double target-supports.
This patch adds 3 target supports to test what type of PowerPC long double is
used by the test:
1) Long double uses the IBM 128-bit extended double format;
2) Long double uses the IEEE 128-bit format; (and)
3) Long double uses the 64-bit format.
gcc/testsuite/
2020-12-03 Michael Meissner <meissner@linux.ibm.com>
* lib/target-supports.exp
(check_effective_target_ppc_long_double_ibm): New function.
(check_effective_target_ppc_long_double_ieee): New function.
(check_effective_target_ppc_long_double_128bit): New function.
(check_effective_target_ppc_long_double_64bit): New function.
Diff:
---
gcc/testsuite/lib/target-supports.exp | 151 ++++++++++++++++++++++++++++++++++
1 file changed, 151 insertions(+)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ff6bc5f4b92..0871970efe6 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2348,6 +2348,77 @@ proc check_effective_target_ppc_ieee128_ok { } {
}]
}
+# See if the target is a powerpc with the long double format that uses the IBM
+# extended double format.
+
+proc check_effective_target_ppc_long_double_ibm { } {
+ return [check_cached_effective_target ppc_long_double_ibm {
+ check_runtime_nocache ppc_long_double_ibm {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IBM128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that uses the IEEE
+# 128-bit format.
+
+proc check_effective_target_ppc_long_double_ieee { } {
+ return [check_cached_effective_target ppc_long_double_ieee {
+ check_runtime_nocache ppc_long_double_ieee {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IEEE128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that is one of the
+# two 128-bit types (i.e. IEEE 128-bit or IBM 128-bit extended double).
+
+proc check_effective_target_ppc_long_double_128bit { } {
+ return [check_cached_effective_target ppc_long_double_128bit {
+ check_runtime_nocache ppc_long_double_128bit {
+ int main()
+ {
+ #ifndef _ARCH_PPC
+ return 1;
+ #else
+ return sizeof (long double) != 128;
+ #endif
+ }
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that is 64-bit.
+
+proc check_effective_target_ppc_long_double_64bit { } {
+ return [check_cached_effective_target ppc_long_double_64bit {
+ check_runtime_nocache ppc_long_double_64bit {
+ int main()
+ {
+ #ifndef _ARCH_PPC
+ return 1;
+ #else
+ return sizeof (long double) != 64;
+ #endif
+ }
+ }
+ }]
+}
+
# Return 1 if the target supports executing VSX instructions, 0
# otherwise. Cache the result.
@@ -10662,3 +10733,83 @@ proc check_effective_target_no_fsanitize_address {} {
}
return 0;
}
+
+# Return 1 if this target supports 'R' flag in .section directive, 0
+# otherwise. Cache the result.
+
+proc check_effective_target_R_flag_in_section { } {
+ global tool
+ global GCC_UNDER_TEST
+
+ # Need auto-host.h to check linker support.
+ if { ![file exists ../../auto-host.h ] } {
+ return 0
+ }
+
+ return [check_cached_effective_target R_flag_in_section {
+
+ set src pie[pid].c
+ set obj pie[pid].o
+
+ set f [open $src "w"]
+ puts $f "#include \"../../auto-host.h\""
+ puts $f "#if HAVE_GAS_SHF_GNU_RETAIN == 0"
+ puts $f "# error Assembler does not support 'R' flag in .section directive."
+ puts $f "#endif"
+ close $f
+
+ verbose "check_effective_target_R_flag_in_section compiling testfile $src" 2
+ set lines [${tool}_target_compile $src $obj assembly ""]
+
+ file delete $src
+ file delete $obj
+
+ if [string match "" $lines] then {
+ verbose "check_effective_target_R_flag_in_section testfile compilation passed" 2
+ return 1
+ } else {
+ verbose "check_effective_target_R_flag_in_section testfile compilation failed" 2
+ return 0
+ }
+ }]
+}
+
+# Return 1 if this target supports 'o' flag in .section directive, 0
+# otherwise. Cache the result.
+
+proc check_effective_target_o_flag_in_section { } {
+ global tool
+ global GCC_UNDER_TEST
+
+ # Need auto-host.h to check linker support.
+ if { ![file exists ../../auto-host.h ] } {
+ return 0
+ }
+
+ return [check_cached_effective_target o_flag_in_section {
+
+ set src pie[pid].c
+ set obj pie[pid].o
+
+ set f [open $src "w"]
+ puts $f "#include \"../../auto-host.h\""
+ puts $f "#if HAVE_GAS_SECTION_LINK_ORDER == 0"
+ puts $f "# error Assembler does not support 'o' flag in .section directive."
+ puts $f "#endif"
+ close $f
+
+ verbose "check_effective_target_o_flag_in_section compiling testfile $src" 2
+ set lines [${tool}_target_compile $src $obj object ""]
+
+ file delete $src
+ file delete $obj
+
+ if [string match "" $lines] then {
+ verbose "check_effective_target_o_flag_in_section testfile compilation passed" 2
+ return 1
+ } else {
+ verbose "check_effective_target_o_flag_in_section testfile compilation failed" 2
+ return 0
+ }
+ }]
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/meissner/heads/work029)] PowerPC: Add long double target-supports.
@ 2020-12-03 21:27 Michael Meissner
0 siblings, 0 replies; 4+ messages in thread
From: Michael Meissner @ 2020-12-03 21:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:cc49b698925058b3bf0dee0ef7cbc1ff69fd6af7
commit cc49b698925058b3bf0dee0ef7cbc1ff69fd6af7
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Thu Dec 3 16:27:23 2020 -0500
PowerPC: Add long double target-supports.
This patch adds 3 target supports to test what type of PowerPC long double is
used by the test:
1) Long double uses the IBM 128-bit extended double format;
2) Long double uses the IEEE 128-bit format; (and)
3) Long double uses the 64-bit format.
gcc/testsuite/
2020-12-03 Michael Meissner <meissner@linux.ibm.com>
* lib/target-supports.exp
(check_effective_target_ppc_long_double_ibm): New function.
(check_effective_target_ppc_long_double_ieee): New function.
(check_effective_target_ppc_long_double_64bit): New function.
Diff:
---
gcc/testsuite/lib/target-supports.exp | 133 ++++++++++++++++++++++++++++++++++
1 file changed, 133 insertions(+)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ff6bc5f4b92..2909d7ea8b9 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2348,6 +2348,59 @@ proc check_effective_target_ppc_ieee128_ok { } {
}]
}
+# See if the target is a powerpc with the long double format that uses the IBM
+# extended double format.
+
+proc check_effective_target_ppc_long_double_ibm { } {
+ return [check_cached_effective_target ppc_long_double_ibm {
+ check_runtime_nocache ppc_long_double_ibm {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IBM128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that uses the IEEE
+# 128-bit format.
+
+proc check_effective_target_ppc_long_double_ieee { } {
+ return [check_cached_effective_target ppc_long_double_ieee {
+ check_runtime_nocache ppc_long_double_ieee {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IEEE128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that is 64-bit.
+
+proc check_effective_target_ppc_long_double_64bit { } {
+ return [check_cached_effective_target ppc_long_double_64bit {
+ check_runtime_nocache ppc_long_double_64bit {
+ int main()
+ {
+ #ifndef _ARCH_PPC
+ return 1;
+ #else
+ return sizeof (long double) != 64;
+ #endif
+ }
+ }
+ }]
+}
+
# Return 1 if the target supports executing VSX instructions, 0
# otherwise. Cache the result.
@@ -10662,3 +10715,83 @@ proc check_effective_target_no_fsanitize_address {} {
}
return 0;
}
+
+# Return 1 if this target supports 'R' flag in .section directive, 0
+# otherwise. Cache the result.
+
+proc check_effective_target_R_flag_in_section { } {
+ global tool
+ global GCC_UNDER_TEST
+
+ # Need auto-host.h to check linker support.
+ if { ![file exists ../../auto-host.h ] } {
+ return 0
+ }
+
+ return [check_cached_effective_target R_flag_in_section {
+
+ set src pie[pid].c
+ set obj pie[pid].o
+
+ set f [open $src "w"]
+ puts $f "#include \"../../auto-host.h\""
+ puts $f "#if HAVE_GAS_SHF_GNU_RETAIN == 0"
+ puts $f "# error Assembler does not support 'R' flag in .section directive."
+ puts $f "#endif"
+ close $f
+
+ verbose "check_effective_target_R_flag_in_section compiling testfile $src" 2
+ set lines [${tool}_target_compile $src $obj assembly ""]
+
+ file delete $src
+ file delete $obj
+
+ if [string match "" $lines] then {
+ verbose "check_effective_target_R_flag_in_section testfile compilation passed" 2
+ return 1
+ } else {
+ verbose "check_effective_target_R_flag_in_section testfile compilation failed" 2
+ return 0
+ }
+ }]
+}
+
+# Return 1 if this target supports 'o' flag in .section directive, 0
+# otherwise. Cache the result.
+
+proc check_effective_target_o_flag_in_section { } {
+ global tool
+ global GCC_UNDER_TEST
+
+ # Need auto-host.h to check linker support.
+ if { ![file exists ../../auto-host.h ] } {
+ return 0
+ }
+
+ return [check_cached_effective_target o_flag_in_section {
+
+ set src pie[pid].c
+ set obj pie[pid].o
+
+ set f [open $src "w"]
+ puts $f "#include \"../../auto-host.h\""
+ puts $f "#if HAVE_GAS_SECTION_LINK_ORDER == 0"
+ puts $f "# error Assembler does not support 'o' flag in .section directive."
+ puts $f "#endif"
+ close $f
+
+ verbose "check_effective_target_o_flag_in_section compiling testfile $src" 2
+ set lines [${tool}_target_compile $src $obj object ""]
+
+ file delete $src
+ file delete $obj
+
+ if [string match "" $lines] then {
+ verbose "check_effective_target_o_flag_in_section testfile compilation passed" 2
+ return 1
+ } else {
+ verbose "check_effective_target_o_flag_in_section testfile compilation failed" 2
+ return 0
+ }
+ }]
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/meissner/heads/work029)] PowerPC: Add long double target-supports.
@ 2020-11-30 18:29 Michael Meissner
0 siblings, 0 replies; 4+ messages in thread
From: Michael Meissner @ 2020-11-30 18:29 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:330f6cfaebdb8cdc0a73cb605667fe53549d151e
commit 330f6cfaebdb8cdc0a73cb605667fe53549d151e
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Mon Nov 30 13:29:09 2020 -0500
PowerPC: Add long double target-supports.
This patch adds 3 target supports to test what type of PowerPC long double is
used by the test:
1) Long double uses the IBM 128-bit extended double format;
2) Long double uses the IEEE 128-bit format; (and)
3) Long double uses the 64-bit format.
gcc/testsuite/
2020-11-30 Michael Meissner <meissner@linux.ibm.com>
* lib/target-supports.exp (check_ppc_long_double_ibm): New
function.
(check_ppc_long_double_ieee): New function.
(check_ppc_long_double_64bit): New function.
(is-effective-target): Add ppc_long_double_ibm,
ppc_long_double_ieee, and ppc_long_double_64bit.
Diff:
---
gcc/testsuite/lib/target-supports.exp | 56 +++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ff6bc5f4b92..e07fde804b4 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2348,6 +2348,59 @@ proc check_effective_target_ppc_ieee128_ok { } {
}]
}
+# See if the target is a powerpc with the long double format that uses the IBM
+# extended double format.
+
+proc check_ppc_long_double_ibm { } {
+ return [check_cached_effective_target ppc_long_double_ibm {
+ check_runtime_nocache ppc_long_double_ibm {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IBM128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that uses the IEEE
+# 128-bit format.
+
+proc check_ppc_long_double_ieee { } {
+ return [check_cached_effective_target ppc_long_double_ieee {
+ check_runtime_nocache ppc_long_double_ieee {
+ int main()
+ {
+ #if !defined(_ARCH_PPC) || !defined(__LONG_DOUBLE_IEEE128__)
+ return 1;
+ #else
+ return 0;
+ #endif
+ }
+ }
+ }]
+}
+
+# See if the target is a powerpc with the long double format that is 64-bit.
+
+proc check_ppc_long_double_64bit { } {
+ return [check_cached_effective_target ppc_long_double_64bit {
+ check_runtime_nocache ppc_long_double_64bit {
+ int main()
+ {
+ #ifndef _ARCH_PPC
+ return 1;
+ #else
+ return sizeof (long double) != 64;
+ #endif
+ }
+ }
+ }]
+}
+
# Return 1 if the target supports executing VSX instructions, 0
# otherwise. Cache the result.
@@ -7951,6 +8004,9 @@ proc is-effective-target { arg } {
"power10_hw" { set selected [check_power10_hw_available] }
"ppc_float128_sw" { set selected [check_ppc_float128_sw_available] }
"ppc_float128_hw" { set selected [check_ppc_float128_hw_available] }
+ "ppc_long_double_ibm" { set selected [check_ppc_long_double_ibm] }
+ "ppc_long_double_ieee" { set selected [check_ppc_long_double_ieee] }
+ "ppc_long_double_64bit" { set selected [check_ppc_long_double_64bit] }
"ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
"ppc_cpu_supports_hw" { set selected [check_ppc_cpu_supports_hw_available] }
"ppc_mma_hw" { set selected [check_ppc_mma_hw_available] }
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-04 1:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 1:18 [gcc(refs/users/meissner/heads/work029)] PowerPC: Add long double target-supports Michael Meissner
-- strict thread matches above, loose matches on Subject: below --
2020-12-03 21:38 Michael Meissner
2020-12-03 21:27 Michael Meissner
2020-11-30 18:29 Michael Meissner
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).