diff options
author | Alexandre Oliva <oliva@adacore.com> | 2020-10-08 17:12:18 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2020-10-08 17:12:18 -0300 |
commit | a500588aa523f1f04ae51809e476e3ebfcb081d3 (patch) | |
tree | 15e5f671a4efdb0fe4f0dd74cd0a87b1c84b165b /gcc/builtins.h | |
parent | d1c566d72d9361b37213881222c7e2713cdf05b7 (diff) | |
download | gcc-a500588aa523f1f04ae51809e476e3ebfcb081d3.tar.gz |
take type from intrinsic in sincos pass
This is a first step towards enabling the sincos optimization in Ada.
The issue this patch solves is that sincos takes the type to be looked
up with mathfn_built_in from variables or temporaries passed as
arguments to SIN and COS intrinsics. In Ada, different float types
may be used but, despite their representation equivalence, their
distinctness causes the optimization to be skipped, because they are
not the types that mathfn_built_in expects.
This patch introduces a function that maps intrinsics to the type
they're associated with, and uses that type, obtained from the
intrinsics used in calls to be optimized, to look up the correspoding
CEXPI intrinsic.
For the sake of defensive programming, when using the type obtained
from the intrinsic, it now checks that, if different types are found
for the used argument, or for other calls that use it, that the types
are interchangeable.
for gcc/ChangeLog
* builtins.c (mathfn_built_in_type): New.
* builtins.h (mathfn_built_in_type): Declare.
* tree-ssa-math-opts.c (execute_cse_sincos_1): Use it to
obtain the type expected by the intrinsic.
Diffstat (limited to 'gcc/builtins.h')
-rw-r--r-- | gcc/builtins.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/builtins.h b/gcc/builtins.h index 504c618b851..72012a28e03 100644 --- a/gcc/builtins.h +++ b/gcc/builtins.h @@ -109,6 +109,7 @@ extern void expand_builtin_setjmp_receiver (rtx); extern void expand_builtin_update_setjmp_buf (rtx); extern tree mathfn_built_in (tree, enum built_in_function fn); extern tree mathfn_built_in (tree, combined_fn); +extern tree mathfn_built_in_type (combined_fn); extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, scalar_int_mode); extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, scalar_int_mode); extern rtx expand_builtin_saveregs (void); |