diff mbox series

[FYI,Ada] enable sincos optimization on cygming targets

Message ID or8sby98pv.fsf@livre.home
State New
Headers show
Series [FYI,Ada] enable sincos optimization on cygming targets | expand

Commit Message

Alexandre Oliva Oct. 22, 2020, 4:37 a.m. UTC
The sincos transformation does not take place on all platforms,
because the libc_has_function target hook disables it by default.

Current w64-mingw's math library supports sincos, sincosl and sincosf,
in 32- and 64-bit modes.  I suppose this has been this way for long,
also with mingw32 and cygwin.

This patch enables the sincos optimization on these platforms.

Tested with builds targeting mingw-w64, also regstrapped along with
other patches on x86_64-linux-gnu.  Ok to install?


for  gcc/ChangeLog

	* config/i386/cygming.h (TARGET_LIBC_HAS_FUNCTION): Enable
	sincos optimization.
---
 gcc/config/i386/cygming.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre Oliva Oct. 22, 2020, 5:01 a.m. UTC | #1
Err, sorry, I mislabeled this patch as [FYI,Ada], but it is neither
about Ada nor pre-approved.  It does require a review before I can check
it in.

On Oct 22, 2020, Alexandre Oliva <oliva@adacore.com> wrote:

> for  gcc/ChangeLog

> 	* config/i386/cygming.h (TARGET_LIBC_HAS_FUNCTION): Enable
> 	sincos optimization.

> -#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
> +#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
Jonathan Yong Oct. 22, 2020, 8:52 a.m. UTC | #2
On 10/22/20 5:01 AM, Alexandre Oliva wrote:
> Err, sorry, I mislabeled this patch as [FYI,Ada], but it is neither
> about Ada nor pre-approved.  It does require a review before I can check
> it in.
> 

No objections for mingw-w64 since it has been tested, but I'm not 
certain if the original mingw.org version has it.

Please also do a test build for Cygwin, it uses a different runtime from 
mingw-w64.
Alexandre Oliva Oct. 22, 2020, 11:30 a.m. UTC | #3
On Oct 22, 2020, Jonathan Yong <10walls@gmail.com> wrote:

> No objections for mingw-w64 since it has been tested, but I'm not
> certain if the original mingw.org version has it.

Prompted by you, I looked into the original mingw32, and found it does
NOT have sincos, so I withdraw the patch, in favor of this one.  Since
this one affects only mingw-w64, I haven't checked whether cygwin has
it.  Hopefully someone with easier access to the platform can do so and
duplicate the change in the Cygwin-specific compiler configuration
header.


enable sincos optimization on mingw-w64

From: Alexandre Oliva <oliva@adacore.com>

The sincos transformation does not take place on all platforms,
because the libc_has_function target hook disables it by default.

Current mingw-w64's math library supports sincos, sincosl and sincosf,
in 32- and 64-bit modes.  I suppose this has been this way for long.

This patch enables the sincos optimization on this platform.


for  gcc/ChangeLog

	* config/i386/mingw-w64.h (TARGET_LIBC_HAS_FUNCTION): Enable
	sincos optimization.
---
 gcc/config/i386/mingw-w64.h |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 408e57c..0d0aa93 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -98,3 +98,9 @@ along with GCC; see the file COPYING3.  If not see
   %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
   " LINK_SPEC_LARGE_ADDR_AWARE "\
   %(shared_libgcc_undefs)"
+
+/* Enable sincos optimization, overriding cygming.h.  sincos, sincosf
+   and sincosl functions are available on mingw-w64, but not on the
+   original mingw32.  */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
Jonathan Yong Oct. 23, 2020, 12:17 a.m. UTC | #4
On 10/22/20 11:30 AM, Alexandre Oliva wrote:
> On Oct 22, 2020, Jonathan Yong wrote:
> 
>> No objections for mingw-w64 since it has been tested, but I'm not
>> certain if the original mingw.org version has it.
> 
> Prompted by you, I looked into the original mingw32, and found it does
> NOT have sincos, so I withdraw the patch, in favor of this one.  Since
> this one affects only mingw-w64, I haven't checked whether cygwin has
> it.  Hopefully someone with easier access to the platform can do so and
> duplicate the change in the Cygwin-specific compiler configuration
> header.
> 

Thanks this patch is acceptable.
diff mbox series

Patch

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 1b1ea7d..82fc4d6 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -182,7 +182,7 @@  along with GCC; see the file COPYING3.  If not see
 #define MATH_LIBRARY ""
 
 #undef TARGET_LIBC_HAS_FUNCTION
-#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
 
 #define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
 #define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")