public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-01 18:08 ` foreese at gcc dot gnu.org
2020-04-01 18:08 ` foreese at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 10+ messages in thread
From: foreese at gcc dot gnu.org @ 2020-04-01 18:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
Fritz Reese <foreese at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #47883|0 |1
is obsolete| |
Attachment #47913|0 |1
is obsolete| |
--- Comment #44 from Fritz Reese <foreese at gcc dot gnu.org> ---
Created attachment 48164
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48164&action=edit
Patch for trunk
Final version of patch submitted, pending final review.
cf. https://gcc.gnu.org/pipermail/fortran/2020-March/054162.html and the
containing thread for details.
The patch includes and extends Steve's changes which rework the degree-valued
trigonometric functions.
COTAN is implemented as -TAN(x+pi/2) for REAL values, and COS(x)/SIN(x) for
complex values. COTAND is implemented as -TAND(x+90). These are equivalent to
1/TAN[D] but should be faster than division. SIND, COSD, and TAND are rewritten
to use Steve's range folding technique into [0, 45] both at runtime from
libgfortran and at simplification time for constant expressions.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
2020-04-01 18:08 ` [Bug libfortran/93871] COTAN is slow for complex types foreese at gcc dot gnu.org
@ 2020-04-01 18:08 ` foreese at gcc dot gnu.org
2020-04-07 17:18 ` cvs-commit at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 10+ messages in thread
From: foreese at gcc dot gnu.org @ 2020-04-01 18:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
Fritz Reese <foreese at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |WAITING
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
2020-04-01 18:08 ` [Bug libfortran/93871] COTAN is slow for complex types foreese at gcc dot gnu.org
2020-04-01 18:08 ` foreese at gcc dot gnu.org
@ 2020-04-07 17:18 ` cvs-commit at gcc dot gnu.org
2020-04-07 17:20 ` foreese at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-07 17:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
--- Comment #45 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Fritz Reese <foreese@gcc.gnu.org>:
https://gcc.gnu.org/g:57391ddaf39f7cb85825c32e83feb1435889da51
commit r10-7603-g57391ddaf39f7cb85825c32e83feb1435889da51
Author: Fritz Reese <foreese@gcc.gnu.org>
Date: Tue Apr 7 11:59:36 2020 -0400
Fix PR fortran/93871 and re-implement degree-valued trigonometric
intrinsics.
2020-04-01 Fritz Reese <foreese@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/ChangeLog
PR fortran/93871
* gfortran.h (GFC_ISYM_ACOSD, GFC_ISYM_ASIND, GFC_ISYM_ATAN2D,
GFC_ISYM_ATAND, GFC_ISYM_COSD, GFC_ISYM_COTAND, GFC_ISYM_SIND,
GFC_ISYM_TAND): New.
* intrinsic.c (add_functions): Remove check for flag_dec_math.
Give degree trig functions simplification and name resolution
functions (e.g, gfc_simplify_atrigd () and gfc_resolve_atrigd ()).
(do_simplify): Remove special casing of degree trig functions.
* intrinsic.h (gfc_simplify_acosd, gfc_simplify_asind,
gfc_simplify_atand, gfc_simplify_cosd, gfc_simplify_cotand,
gfc_simplify_sind, gfc_simplify_tand, gfc_resolve_trigd2): Add new
prototypes.
(gfc_simplify_atrigd, gfc_simplify_trigd, gfc_resolve_cotan,
resolve_atrigd): Remove prototypes of deleted functions.
* iresolve.c (is_trig_resolved, copy_replace_function_shallow,
gfc_resolve_cotan, get_radians, get_degrees, resolve_trig_call,
gfc_resolve_atrigd, gfc_resolve_atan2d): Delete functions.
(gfc_resolve_trigd, gfc_resolve_trigd2): Resolve to library
functions.
* simplify.c (rad2deg, deg2rad, gfc_simplify_acosd,
gfc_simplify_asind,
gfc_simplify_atand, gfc_simplify_atan2d, gfc_simplify_cosd,
gfc_simplify_sind, gfc_simplify_tand, gfc_simplify_cotand): New
functions.
(gfc_simplify_atan2): Fix error message.
(simplify_trig_call, gfc_simplify_trigd, gfc_simplify_atrigd,
radians_f): Delete functions.
* trans-intrinsic.c: Add LIB_FUNCTION decls for sind, cosd, tand.
(rad2deg, gfc_conv_intrinsic_atrigd, gfc_conv_intrinsic_cotan,
gfc_conv_intrinsic_cotand, gfc_conv_intrinsic_atan2d): New
functions.
(gfc_conv_intrinsic_function): Handle ACOSD, ASIND, ATAND, COTAN,
COTAND, ATAN2D.
* trigd_fe.inc: New file. Included by simplify.c to implement
simplify_sind, simplify_cosd, simplify_tand with code common to the
libgfortran implementation.
gcc/testsuite/ChangeLog
PR fortran/93871
* gfortran.dg/dec_math.f90: Extend coverage to real(10) and
real(16).
* gfortran.dg/dec_math_2.f90: New test.
* gfortran.dg/dec_math_3.f90: Likewise.
* gfortran.dg/dec_math_4.f90: Likewise.
* gfortran.dg/dec_math_5.f90: Likewise.
libgfortran/ChangeLog
PR fortran/93871
* Makefile.am, Makefile.in: New make rule for intrinsics/trigd.c.
* gfortran.map: New routines for {sind, cosd, tand}X{r4, r8, r10,
r16}.
* intrinsics/trigd.c, intrinsics/trigd_lib.inc,
intrinsics/trigd.inc:
New files. Defines native degree-valued trig functions.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-04-07 17:18 ` cvs-commit at gcc dot gnu.org
@ 2020-04-07 17:20 ` foreese at gcc dot gnu.org
2020-04-08 15:56 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 10+ messages in thread
From: foreese at gcc dot gnu.org @ 2020-04-07 17:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
Fritz Reese <foreese at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|WAITING |RESOLVED
--- Comment #46 from Fritz Reese <foreese at gcc dot gnu.org> ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-04-07 17:20 ` foreese at gcc dot gnu.org
@ 2020-04-08 15:56 ` cvs-commit at gcc dot gnu.org
2020-04-20 14:22 ` ktkachov at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-08 15:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
--- Comment #47 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:
https://gcc.gnu.org/g:faa0817311f43e0d4d223d53c816b0c74ec35c4e
commit r10-7631-gfaa0817311f43e0d4d223d53c816b0c74ec35c4e
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Wed Apr 8 17:54:04 2020 +0200
Move gfortran.dg/dec_math_5.f90 to ./ieee/
PR fortran/93871
* gfortran.dg/dec_math_5.f90: Move to ...
* gfortran.dg/ieee/dec_math_1.f90: ... here; change
dg-options to dg-additional-options.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2020-04-08 15:56 ` cvs-commit at gcc dot gnu.org
@ 2020-04-20 14:22 ` ktkachov at gcc dot gnu.org
2020-04-20 23:39 ` foreese at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2020-04-20 14:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
ktkachov at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ktkachov at gcc dot gnu.org
--- Comment #48 from ktkachov at gcc dot gnu.org ---
(In reply to CVS Commits from comment #45)
> The master branch has been updated by Fritz Reese <foreese@gcc.gnu.org>:
>
> https://gcc.gnu.org/g:57391ddaf39f7cb85825c32e83feb1435889da51
>
> commit r10-7603-g57391ddaf39f7cb85825c32e83feb1435889da51
> Author: Fritz Reese <foreese@gcc.gnu.org>
> Date: Tue Apr 7 11:59:36 2020 -0400
>
> Fix PR fortran/93871 and re-implement degree-valued trigonometric
> intrinsics.
>
> 2020-04-01 Fritz Reese <foreese@gcc.gnu.org>
> Steven G. Kargl <kargl@gcc.gnu.org>
>
> gcc/fortran/ChangeLog
>
> PR fortran/93871
> * gfortran.h (GFC_ISYM_ACOSD, GFC_ISYM_ASIND, GFC_ISYM_ATAN2D,
> GFC_ISYM_ATAND, GFC_ISYM_COSD, GFC_ISYM_COTAND, GFC_ISYM_SIND,
> GFC_ISYM_TAND): New.
> * intrinsic.c (add_functions): Remove check for flag_dec_math.
> Give degree trig functions simplification and name resolution
> functions (e.g, gfc_simplify_atrigd () and gfc_resolve_atrigd
> ()).
> (do_simplify): Remove special casing of degree trig functions.
> * intrinsic.h (gfc_simplify_acosd, gfc_simplify_asind,
> gfc_simplify_atand, gfc_simplify_cosd, gfc_simplify_cotand,
> gfc_simplify_sind, gfc_simplify_tand, gfc_resolve_trigd2): Add
> new
> prototypes.
> (gfc_simplify_atrigd, gfc_simplify_trigd, gfc_resolve_cotan,
> resolve_atrigd): Remove prototypes of deleted functions.
> * iresolve.c (is_trig_resolved, copy_replace_function_shallow,
> gfc_resolve_cotan, get_radians, get_degrees, resolve_trig_call,
> gfc_resolve_atrigd, gfc_resolve_atan2d): Delete functions.
> (gfc_resolve_trigd, gfc_resolve_trigd2): Resolve to library
> functions.
> * simplify.c (rad2deg, deg2rad, gfc_simplify_acosd,
> gfc_simplify_asind,
> gfc_simplify_atand, gfc_simplify_atan2d, gfc_simplify_cosd,
> gfc_simplify_sind, gfc_simplify_tand, gfc_simplify_cotand): New
> functions.
> (gfc_simplify_atan2): Fix error message.
> (simplify_trig_call, gfc_simplify_trigd, gfc_simplify_atrigd,
> radians_f): Delete functions.
> * trans-intrinsic.c: Add LIB_FUNCTION decls for sind, cosd, tand.
> (rad2deg, gfc_conv_intrinsic_atrigd, gfc_conv_intrinsic_cotan,
> gfc_conv_intrinsic_cotand, gfc_conv_intrinsic_atan2d): New
> functions.
> (gfc_conv_intrinsic_function): Handle ACOSD, ASIND, ATAND, COTAN,
> COTAND, ATAN2D.
> * trigd_fe.inc: New file. Included by simplify.c to implement
> simplify_sind, simplify_cosd, simplify_tand with code common to
> the
> libgfortran implementation.
>
> gcc/testsuite/ChangeLog
>
> PR fortran/93871
> * gfortran.dg/dec_math.f90: Extend coverage to real(10) and
> real(16).
> * gfortran.dg/dec_math_2.f90: New test.
> * gfortran.dg/dec_math_3.f90: Likewise.
> * gfortran.dg/dec_math_4.f90: Likewise.
> * gfortran.dg/dec_math_5.f90: Likewise.
>
> libgfortran/ChangeLog
>
> PR fortran/93871
> * Makefile.am, Makefile.in: New make rule for intrinsics/trigd.c.
> * gfortran.map: New routines for {sind, cosd, tand}X{r4, r8,
> r10, r16}.
> * intrinsics/trigd.c, intrinsics/trigd_lib.inc,
> intrinsics/trigd.inc:
> New files. Defines native degree-valued trig functions.
I think this broke the build for bare-metal (newlib) targets like
aarch64-none-elf:
libgfortran/intrinsics/trigd_lib.inc:55:56: error: implicit declaration of
function 'copysignl' [-Werror=implicit-function-declaration]
55 | #define mpfr_copysign(rop, op1, op2, rnd) rop = SUFFIX(copysign)((op1),
(op2))
| ^~~~~~~~
I think newlib doesn't support long double functions well so likely doesn't
have copysignl. Is there some way this use can be conditionalised on library
support?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2020-04-20 14:22 ` ktkachov at gcc dot gnu.org
@ 2020-04-20 23:39 ` foreese at gcc dot gnu.org
2020-04-21 14:39 ` akrl at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 10+ messages in thread
From: foreese at gcc dot gnu.org @ 2020-04-20 23:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
--- Comment #49 from Fritz Reese <foreese at gcc dot gnu.org> ---
(In reply to ktkachov from comment #48)
> (In reply to CVS Commits from comment #45)
[...]
>
> I think this broke the build for bare-metal (newlib) targets like
> aarch64-none-elf:
>
> libgfortran/intrinsics/trigd_lib.inc:55:56: error: implicit declaration of
> function 'copysignl' [-Werror=implicit-function-declaration]
> 55 | #define mpfr_copysign(rop, op1, op2, rnd) rop =
> SUFFIX(copysign)((op1), (op2))
> | ^~~~~~~~
>
> I think newlib doesn't support long double functions well so likely doesn't
> have copysignl. Is there some way this use can be conditionalised on library
> support?
I believe I should use HAVE_* macros from libgfortran/config.h to check
availability of the required functions fmod[x], fabs[x], and copysign[x]. I
will check this out and patch a fix shortly, thanks for the report.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2020-04-20 23:39 ` foreese at gcc dot gnu.org
@ 2020-04-21 14:39 ` akrl at gcc dot gnu.org
2020-04-21 15:35 ` jakub at gcc dot gnu.org
2020-04-21 15:36 ` akrl at gcc dot gnu.org
9 siblings, 0 replies; 10+ messages in thread
From: akrl at gcc dot gnu.org @ 2020-04-21 14:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
--- Comment #50 from akrl at gcc dot gnu.org ---
Hi,
I've opened a dedicated bug for the discussed build issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2020-04-21 14:39 ` akrl at gcc dot gnu.org
@ 2020-04-21 15:35 ` jakub at gcc dot gnu.org
2020-04-21 15:36 ` akrl at gcc dot gnu.org
9 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-21 15:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #51 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
You meant PR94694, right?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libfortran/93871] COTAN is slow for complex types
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2020-04-21 15:35 ` jakub at gcc dot gnu.org
@ 2020-04-21 15:36 ` akrl at gcc dot gnu.org
9 siblings, 0 replies; 10+ messages in thread
From: akrl at gcc dot gnu.org @ 2020-04-21 15:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93871
--- Comment #52 from akrl at gcc dot gnu.org ---
Yeah sorry
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-04-21 15:36 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-93871-4@http.gcc.gnu.org/bugzilla/>
2020-04-01 18:08 ` [Bug libfortran/93871] COTAN is slow for complex types foreese at gcc dot gnu.org
2020-04-01 18:08 ` foreese at gcc dot gnu.org
2020-04-07 17:18 ` cvs-commit at gcc dot gnu.org
2020-04-07 17:20 ` foreese at gcc dot gnu.org
2020-04-08 15:56 ` cvs-commit at gcc dot gnu.org
2020-04-20 14:22 ` ktkachov at gcc dot gnu.org
2020-04-20 23:39 ` foreese at gcc dot gnu.org
2020-04-21 14:39 ` akrl at gcc dot gnu.org
2020-04-21 15:35 ` jakub at gcc dot gnu.org
2020-04-21 15:36 ` akrl at gcc dot gnu.org
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).