diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-06-16 14:32:40 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-06-16 14:32:40 +0000 |
commit | 4c780a597b395eab77ea61593cc06e2842cc91b8 (patch) | |
tree | 1f9bd650692edc54f3159d746300856825bdcc5f | |
parent | bdc549ca303d08691a2786648dddaf3bdb0ea770 (diff) | |
download | gcc-4c780a597b395eab77ea61593cc06e2842cc91b8.tar.gz |
PR target/71242
* config/ia64/ia64.c (enum ia64_builtins) [IA64_BUILTIN_NANQ]: New.
[IA64_BUILTIN_NANSQ]: Ditto.
(ia64_fold_builtin): New function.
(TARGET_FOLD_BUILTIN): New define.
(ia64_init_builtins) Declare const_string_type node.
Add __builtin_nanq and __builtin_nansq builtin functions.
(ia64_expand_builtin): Handle IA64_BUILTIN_NANQ and IA64_BUILTIN_NANSQ.
testsuite/ChangeLog:
PR target/71242
* testsuite/gcc.dg/torture/float128-nan.c: Also run on ia64-*-*.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237530 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/config/ia64/ia64.c | 61 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/float128-nan.c | 2 |
4 files changed, 78 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f57c04ecfd4..c571db56f07 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2016-06-16 Uros Bizjak <ubizjak@gmail.com> + + PR target/71242 + * config/ia64/ia64.c (enum ia64_builtins) [IA64_BUILTIN_NANQ]: New. + [IA64_BUILTIN_NANSQ]: Ditto. + (ia64_fold_builtin): New function. + (TARGET_FOLD_BUILTIN): New define. + (ia64_init_builtins) Declare const_string_type node. + Add __builtin_nanq and __builtin_nansq builtin functions. + (ia64_expand_builtin): Handle IA64_BUILTIN_NANQ and IA64_BUILTIN_NANSQ. + 2016-06-16 Nick Clifton <nickc@redhat.com> * config/msp430/msp430-opts.h (msp430_hwmult_types): Add diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 7f439d3fe82..6ab34005869 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -323,6 +323,7 @@ static void ia64_trampoline_init (rtx, tree, rtx); static void ia64_override_options_after_change (void); static bool ia64_member_type_forces_blk (const_tree, machine_mode); +static tree ia64_fold_builtin (tree, int, tree *, bool); static tree ia64_builtin_decl (unsigned, bool); static reg_class_t ia64_preferred_reload_class (rtx, reg_class_t); @@ -372,6 +373,9 @@ static const struct attribute_spec ia64_attribute_table[] = #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS ia64_init_builtins +#undef TARGET_FOLD_BUILTIN +#define TARGET_FOLD_BUILTIN ia64_fold_builtin + #undef TARGET_EXPAND_BUILTIN #define TARGET_EXPAND_BUILTIN ia64_expand_builtin @@ -10325,6 +10329,8 @@ enum ia64_builtins IA64_BUILTIN_FLUSHRS, IA64_BUILTIN_INFQ, IA64_BUILTIN_HUGE_VALQ, + IA64_BUILTIN_NANQ, + IA64_BUILTIN_NANSQ, IA64_BUILTIN_max }; @@ -10353,6 +10359,9 @@ ia64_init_builtins (void) if (!TARGET_HPUX) { tree ftype; + tree const_string_type + = build_pointer_type (build_qualified_type + (char_type_node, TYPE_QUAL_CONST)); tree float128_type = make_node (REAL_TYPE); TYPE_PRECISION (float128_type) = 128; @@ -10372,6 +10381,21 @@ ia64_init_builtins (void) ia64_builtins[IA64_BUILTIN_HUGE_VALQ] = decl; ftype = build_function_type_list (float128_type, + const_string_type, + NULL_TREE); + decl = add_builtin_function ("__builtin_nanq", ftype, + IA64_BUILTIN_NANQ, BUILT_IN_MD, + "nanq", NULL_TREE); + TREE_READONLY (decl) = 1; + ia64_builtins[IA64_BUILTIN_NANQ] = decl; + + decl = add_builtin_function ("__builtin_nansq", ftype, + IA64_BUILTIN_NANSQ, BUILT_IN_MD, + "nansq", NULL_TREE); + TREE_READONLY (decl) = 1; + ia64_builtins[IA64_BUILTIN_NANSQ] = decl; + + ftype = build_function_type_list (float128_type, float128_type, NULL_TREE); decl = add_builtin_function ("__builtin_fabsq", ftype, @@ -10427,6 +10451,41 @@ ia64_init_builtins (void) } } +static tree +ia64_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, + tree *args, bool ignore ATTRIBUTE_UNUSED) +{ + if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) + { + enum ia64_builtins fn_code = (enum ia64_builtins) + DECL_FUNCTION_CODE (fndecl); + switch (fn_code) + { + case IA64_BUILTIN_NANQ: + case IA64_BUILTIN_NANSQ: + { + tree type = TREE_TYPE (TREE_TYPE (fndecl)); + const char *str = c_getstr (*args); + int quiet = fn_code == IA64_BUILTIN_NANQ; + REAL_VALUE_TYPE real; + + if (str && real_nan (&real, str, quiet, TYPE_MODE (type))) + return build_real (type, real); + return NULL_TREE; + } + + default: + break; + } + } + +#ifdef SUBTARGET_FOLD_BUILTIN + return SUBTARGET_FOLD_BUILTIN (fndecl, n_args, args, ignore); +#endif + + return NULL_TREE; +} + rtx ia64_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED, @@ -10469,6 +10528,8 @@ ia64_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, return target; } + case IA64_BUILTIN_NANQ: + case IA64_BUILTIN_NANSQ: case IA64_BUILTIN_FABSQ: case IA64_BUILTIN_COPYSIGNQ: return expand_call (exp, target, ignore); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8eff41d24a7..eb84aebab6d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-16 Uros Bizjak <ubizjak@gmail.com> + + PR target/71242 + * testsuite/gcc.dg/torture/float128-nan.c: Also run on ia64-*-*. + 2016-06-16 Jan Hubicka <hubicka@ucw.cz> * g++.dg/vect/pr36648.cc: Disable cunrolli diff --git a/gcc/testsuite/gcc.dg/torture/float128-nan.c b/gcc/testsuite/gcc.dg/torture/float128-nan.c index f9aa4578280..6e0d4744a45 100644 --- a/gcc/testsuite/gcc.dg/torture/float128-nan.c +++ b/gcc/testsuite/gcc.dg/torture/float128-nan.c @@ -1,5 +1,5 @@ /* Test __float128 NaN generation. */ -/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ /* { dg-require-effective-target fenv_exceptions } */ /* { dg-options "" } */ |