diff mbox series

Add new Fortran vector math header file.

Message ID 863ffa3b-af66-7d82-21a8-e809fd6c1b62@suse.cz
State New
Headers show
Series Add new Fortran vector math header file. | expand

Commit Message

Martin Liška Feb. 18, 2019, 2:31 p.m. UTC
Hi.

The patch adds support for Fortran vector math routines as added
into GCC 9.  The header files will be installed to the same
folder as math-vector.h.

Thanks,
Martin

ChangeLog:

2019-02-18  Martin Liska  <mliska@suse.cz>

	* math/Makefile: Install math-vector-fortran.h.
	* sysdeps/x86/fpu/bits/math-vector-fortran.h: New file.
---
 math/Makefile                              |  1 +
 sysdeps/x86/fpu/bits/math-vector-fortran.h | 43 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 sysdeps/x86/fpu/bits/math-vector-fortran.h

Comments

Joseph Myers Feb. 18, 2019, 5:55 p.m. UTC | #1
On Mon, 18 Feb 2019, Martin Liška wrote:

> Hi.
> 
> The patch adds support for Fortran vector math routines as added
> into GCC 9.  The header files will be installed to the same
> folder as math-vector.h.
> 
> Thanks,
> Martin
> 
> ChangeLog:
> 
> 2019-02-18  Martin Liska  <mliska@suse.cz>
> 
> 	* math/Makefile: Install math-vector-fortran.h.
> 	* sysdeps/x86/fpu/bits/math-vector-fortran.h: New file.

If a header is installed for all architectures, it also needs to exist for 
all architectures (presumably by having a dummy top-level 
bits/math-vector-fortran.h for use on other architectures, like the 
bits/math-vector.h there).
Martin Liška Feb. 19, 2019, 9:18 a.m. UTC | #2
On 2/18/19 6:55 PM, Joseph Myers wrote:
> On Mon, 18 Feb 2019, Martin Liška wrote:
> 
>> Hi.
>>
>> The patch adds support for Fortran vector math routines as added
>> into GCC 9.  The header files will be installed to the same
>> folder as math-vector.h.
>>
>> Thanks,
>> Martin
>>
>> ChangeLog:
>>
>> 2019-02-18  Martin Liska  <mliska@suse.cz>
>>
>> 	* math/Makefile: Install math-vector-fortran.h.
>> 	* sysdeps/x86/fpu/bits/math-vector-fortran.h: New file.
> 
> If a header is installed for all architectures, it also needs to exist for 
> all architectures (presumably by having a dummy top-level 
> bits/math-vector-fortran.h for use on other architectures, like the 
> bits/math-vector.h there).
> 

Sure, fixed in attached patch.

Thanks,
Martin
From 754e636c9feca886367e24b5ac1eb5416868add7 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 18 Feb 2019 15:24:12 +0100
Subject: [PATCH] Add new Fortran vector math header file.

ChangeLog:

2019-02-18  Martin Liska  <mliska@suse.cz>

	* math/Makefile: Install math-vector-fortran.h.
	* bits/math-vector-fortran.h: New file.
	* sysdeps/x86/fpu/bits/math-vector-fortran.h: New file.
---
 bits/math-vector-fortran.h                 | 19 ++++++++++
 math/Makefile                              |  1 +
 sysdeps/x86/fpu/bits/math-vector-fortran.h | 43 ++++++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 bits/math-vector-fortran.h
 create mode 100644 sysdeps/x86/fpu/bits/math-vector-fortran.h

diff --git a/bits/math-vector-fortran.h b/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..d34239ac5f
--- /dev/null
+++ b/bits/math-vector-fortran.h
@@ -0,0 +1,19 @@
+! Platform-specific Fortran SIMD declarations of math functions.
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.  */
+
+! Get default empty builtin definitiones.
diff --git a/math/Makefile b/math/Makefile
index 76e8edac19..fcaa2dbe9c 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -26,6 +26,7 @@ headers		:= math.h bits/mathcalls.h bits/mathinline.h \
 		   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
+			 bits/math-vector-fortran.h \
 		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
 		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
 		   bits/long-double.h bits/mathcalls-helper-functions.h \
diff --git a/sysdeps/x86/fpu/bits/math-vector-fortran.h b/sysdeps/x86/fpu/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..f2d5e57085
--- /dev/null
+++ b/sysdeps/x86/fpu/bits/math-vector-fortran.h
@@ -0,0 +1,43 @@
+! Platform-specific Fortran SIMD declarations of math functions.
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.  */
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x32')
Joseph Myers Feb. 19, 2019, 5:59 p.m. UTC | #3
On Tue, 19 Feb 2019, Martin Liška wrote:

> Sure, fixed in attached patch.

This version is OK with the indentation in math/Makefile fixed to match 
the surrounding lines, presuming x86_64 and x32 are indeed mutually 
exclusive conditions for the purpose of this multilib selection.

*But* there could be potential interactions with Zack's patch 
<https://sourceware.org/ml/libc-alpha/2019-02/msg00446.html> to tokenize 
installed headers to check for obsolete typedefs, since that of course is 
tokenizing headers as C and this is adding a Fortran header to the 
installed headers.  (The existing check-installed-headers tests skip 
bits/* so wouldn't be affected.)  So maybe we should have a way to 
distinguish Fortran headers, or maybe no problems arise in practice from 
tokenizing this one as C and the new Python test could change to skip such 
headers (it already has checks for particular header names that shouldn't 
be checked) if they cause problems in future.
Zack Weinberg Feb. 19, 2019, 7:14 p.m. UTC | #4
On Tue, Feb 19, 2019 at 12:59 PM Joseph Myers <joseph@codesourcery.com> wrote:
> *But* there could be potential interactions with Zack's patch
> <https://sourceware.org/ml/libc-alpha/2019-02/msg00446.html> to tokenize
> installed headers to check for obsolete typedefs, since that of course is
> tokenizing headers as C and this is adding a Fortran header to the
> installed headers.

Good catch, I hadn't been paying attention to this discussion.  The
proposed math-vector-fortran.h is indeed a problem for the test
program in my patch, because of the use of $, which is not part of the
C basic source character set.  (If I remember correctly, GCC allows $
in identifiers as an extension to C, but my test program is
intentionally very picky.)

My first reaction is to wonder whether math-vector-fortran.h should
have an extension other than .h.  I don't know what conventions there
are for this sort of thing in Fortran, but if it could have some other
extension then it would be easy to exclude it from this test in the
makefiles.  Another possibility is to put an Emacs-style "mode"
annotation on the first line of the file:  -*- f90 -*- which I could
make my test program recognize and skip the file.

Incidentally, this looks like a copy-and-paste error:

+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.  */

Should that last line have a */ on it?

zw
Martin Liška Feb. 20, 2019, 9:43 a.m. UTC | #5
On 2/19/19 8:14 PM, Zack Weinberg wrote:
> On Tue, Feb 19, 2019 at 12:59 PM Joseph Myers <joseph@codesourcery.com> wrote:
>> *But* there could be potential interactions with Zack's patch
>> <https://sourceware.org/ml/libc-alpha/2019-02/msg00446.html> to tokenize
>> installed headers to check for obsolete typedefs, since that of course is
>> tokenizing headers as C and this is adding a Fortran header to the
>> installed headers.
> 
> Good catch, I hadn't been paying attention to this discussion.  The
> proposed math-vector-fortran.h is indeed a problem for the test
> program in my patch, because of the use of $, which is not part of the
> C basic source character set.  (If I remember correctly, GCC allows $
> in identifiers as an extension to C, but my test program is
> intentionally very picky.)
> 
> My first reaction is to wonder whether math-vector-fortran.h should
> have an extension other than .h.  I don't know what conventions there
> are for this sort of thing in Fortran, but if it could have some other
> extension then it would be easy to exclude it from this test in the
> makefiles.  Another possibility is to put an Emacs-style "mode"
> annotation on the first line of the file:  -*- f90 -*- which I could
> make my test program recognize and skip the file.

Hi.

I prefer to do the annotation instead of changing the file extension.
Can you please verify it's correct in the attached patch?

> 
> Incidentally, this looks like a copy-and-paste error:
> 
> +!   You should have received a copy of the GNU Lesser General Public
> +!   License along with the GNU C Library; if not, see
> +!   <http://www.gnu.org/licenses/>.  */
> 
> Should that last line have a */ on it?

No, copy&paste error :)

Thanks,
Martin

> 
> zw
>
From 832c91489f828948d1a827918b9d59e51a80262f Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 18 Feb 2019 15:24:12 +0100
Subject: [PATCH] Add new Fortran vector math header file.

ChangeLog:

2019-02-18  Martin Liska  <mliska@suse.cz>

	* math/Makefile: Install math-vector-fortran.h.
	* bits/math-vector-fortran.h: New file.
	* sysdeps/x86/fpu/bits/math-vector-fortran.h: New file.
---
 bits/math-vector-fortran.h                 | 20 ++++++++++
 math/Makefile                              |  1 +
 sysdeps/x86/fpu/bits/math-vector-fortran.h | 44 ++++++++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 bits/math-vector-fortran.h
 create mode 100644 sysdeps/x86/fpu/bits/math-vector-fortran.h

diff --git a/bits/math-vector-fortran.h b/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..ab0a060329
--- /dev/null
+++ b/bits/math-vector-fortran.h
@@ -0,0 +1,20 @@
+! -*- f90 -*-
+! Platform-specific Fortran SIMD declarations of math functions.
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.
+
+! Get default empty builtin definitiones.
diff --git a/math/Makefile b/math/Makefile
index 76e8edac19..fc4191089d 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -26,6 +26,7 @@ headers		:= math.h bits/mathcalls.h bits/mathinline.h \
 		   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
+		   bits/math-vector-fortran.h \
 		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
 		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
 		   bits/long-double.h bits/mathcalls-helper-functions.h \
diff --git a/sysdeps/x86/fpu/bits/math-vector-fortran.h b/sysdeps/x86/fpu/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..7b634c36a3
--- /dev/null
+++ b/sysdeps/x86/fpu/bits/math-vector-fortran.h
@@ -0,0 +1,44 @@
+! -*- f90 -*-
+! Platform-specific Fortran SIMD declarations of math functions.
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x32')
Zack Weinberg Feb. 20, 2019, 1:05 p.m. UTC | #6
On Wed, Feb 20, 2019 at 4:43 AM Martin Liška <mliska@suse.cz> wrote:
> On 2/19/19 8:14 PM, Zack Weinberg wrote:
> > My first reaction is to wonder whether math-vector-fortran.h should
> > have an extension other than .h.  I don't know what conventions there
> > are for this sort of thing in Fortran, but if it could have some other
> > extension then it would be easy to exclude it from this test in the
> > makefiles.  Another possibility is to put an Emacs-style "mode"
> > annotation on the first line of the file:  -*- f90 -*- which I could
> > make my test program recognize and skip the file.
>
> Hi.
>
> I prefer to do the annotation instead of changing the file extension.
> Can you please verify it's correct in the attached patch?

Yes, these annotations are correct.  You don't have to put them on a
line by themselves, though,

+! Platform-specific Fortran SIMD declarations of math functions. -*- f90 -*-

would also work.  As long as I'm looking at this patch, I have two
editorial notes:

In both new files, "Platform-specific Fortran SIMD declarations of
math functions" would be clearer with different word order: suggest
"Platform-specific declarations of SIMD math functions for Fortran."

In the generic file, "Get default empty builtin definitiones." has a
typo ("definitiones" should be "definitions"), and having a sentence
starting with "Get" on the last line of the file makes it look like
there's something missing.  Suggest instead "No SIMD math functions
are available for this platform."

zw
Martin Liška Feb. 20, 2019, 1:52 p.m. UTC | #7
On 2/20/19 2:05 PM, Zack Weinberg wrote:
> On Wed, Feb 20, 2019 at 4:43 AM Martin Liška <mliska@suse.cz> wrote:
>> On 2/19/19 8:14 PM, Zack Weinberg wrote:
>>> My first reaction is to wonder whether math-vector-fortran.h should
>>> have an extension other than .h.  I don't know what conventions there
>>> are for this sort of thing in Fortran, but if it could have some other
>>> extension then it would be easy to exclude it from this test in the
>>> makefiles.  Another possibility is to put an Emacs-style "mode"
>>> annotation on the first line of the file:  -*- f90 -*- which I could
>>> make my test program recognize and skip the file.
>>
>> Hi.
>>
>> I prefer to do the annotation instead of changing the file extension.
>> Can you please verify it's correct in the attached patch?
> 
> Yes, these annotations are correct.  You don't have to put them on a
> line by themselves, though,
> 
> +! Platform-specific Fortran SIMD declarations of math functions. -*- f90 -*-
> 
> would also work.  As long as I'm looking at this patch, I have two
> editorial notes:
> 
> In both new files, "Platform-specific Fortran SIMD declarations of
> math functions" would be clearer with different word order: suggest
> "Platform-specific declarations of SIMD math functions for Fortran."
> 
> In the generic file, "Get default empty builtin definitiones." has a
> typo ("definitiones" should be "definitions"), and having a sentence
> starting with "Get" on the last line of the file makes it look like
> there's something missing.  Suggest instead "No SIMD math functions
> are available for this platform."
> 
> zw
> 

Thank you for the corrections. I'm attaching final version of the patch
that I'm going to install.

Martin
From 4c3b0fd3da9ed3c6d69892cce37206e6f3405bc4 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 18 Feb 2019 15:24:12 +0100
Subject: [PATCH] Add new Fortran vector math header file.

ChangeLog:

2019-02-18  Martin Liska  <mliska@suse.cz>

	* math/Makefile: Install math-vector-fortran.h.
	* bits/math-vector-fortran.h: New file.
	* sysdeps/x86/fpu/bits/math-vector-fortran.h: New file.
---
 bits/math-vector-fortran.h                 | 19 ++++++++++
 math/Makefile                              |  1 +
 sysdeps/x86/fpu/bits/math-vector-fortran.h | 43 ++++++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 bits/math-vector-fortran.h
 create mode 100644 sysdeps/x86/fpu/bits/math-vector-fortran.h

diff --git a/bits/math-vector-fortran.h b/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..7c1e095094
--- /dev/null
+++ b/bits/math-vector-fortran.h
@@ -0,0 +1,19 @@
+! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*-
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.
+
+! No SIMD math functions are available for this platform.
diff --git a/math/Makefile b/math/Makefile
index 76e8edac19..fc4191089d 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -26,6 +26,7 @@ headers		:= math.h bits/mathcalls.h bits/mathinline.h \
 		   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
+		   bits/math-vector-fortran.h \
 		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
 		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
 		   bits/long-double.h bits/mathcalls-helper-functions.h \
diff --git a/sysdeps/x86/fpu/bits/math-vector-fortran.h b/sysdeps/x86/fpu/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..36051cc73e
--- /dev/null
+++ b/sysdeps/x86/fpu/bits/math-vector-fortran.h
@@ -0,0 +1,43 @@
+! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*-
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x32')
diff mbox series

Patch

diff --git a/math/Makefile b/math/Makefile
index 76e8edac19..fcaa2dbe9c 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -26,6 +26,7 @@  headers		:= math.h bits/mathcalls.h bits/mathinline.h \
 		   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
+			 bits/math-vector-fortran.h \
 		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
 		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
 		   bits/long-double.h bits/mathcalls-helper-functions.h \
diff --git a/sysdeps/x86/fpu/bits/math-vector-fortran.h b/sysdeps/x86/fpu/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..f2d5e57085
--- /dev/null
+++ b/sysdeps/x86/fpu/bits/math-vector-fortran.h
@@ -0,0 +1,43 @@ 
+! Platform-specific Fortran SIMD declarations of math functions.
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.  */
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x32')