aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2020-11-13 09:57:57 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2020-11-13 14:58:58 +0100
commitd975d6dce98a3e26ddd304d50dad2786b3acecc4 (patch)
tree8cf58c1b5f6da63b055ade7469a7ebb6be4002c0
parent5d4b824faf1e5846ec684a74f93912cf347928df (diff)
downloadgcc-d975d6dce98a3e26ddd304d50dad2786b3acecc4.zip
gcc-d975d6dce98a3e26ddd304d50dad2786b3acecc4.tar.gz
gcc-d975d6dce98a3e26ddd304d50dad2786b3acecc4.tar.bz2
d: Explicitly determine which built-in copysign function to call.
For some targets, mathfn_built_in returns NULL as copysign is not implicitly available, causing an ICE. Now copysign is explicitly requested when expanding the intrinsic. gcc/d/ChangeLog: * intrinsics.cc (expand_intrinsic_copysign): Explicitly determine which built-in copysign function to call.
-rw-r--r--gcc/d/intrinsics.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc
index a629472..a7de910 100644
--- a/gcc/d/intrinsics.cc
+++ b/gcc/d/intrinsics.cc
@@ -466,11 +466,14 @@ expand_intrinsic_copysign (tree callexp)
from = fold_convert (type, from);
/* Which variant of __builtin_copysign* should we call? */
- tree builtin = mathfn_built_in (type, BUILT_IN_COPYSIGN);
- gcc_assert (builtin != NULL_TREE);
+ built_in_function code = (type == float_type_node) ? BUILT_IN_COPYSIGNF
+ : (type == double_type_node) ? BUILT_IN_COPYSIGN
+ : (type == long_double_type_node) ? BUILT_IN_COPYSIGNL
+ : END_BUILTINS;
- return call_builtin_fn (callexp, DECL_FUNCTION_CODE (builtin), 2,
- to, from);
+ gcc_assert (code != END_BUILTINS);
+
+ return call_builtin_fn (callexp, code, 2, to, from);
}
/* Expand a front-end intrinsic call to pow(). This takes two arguments, the