[gcc r10-9041] d: Explicitly determine which built-in copysign function to call.
Iain Buclaw
ibuclaw@gcc.gnu.org
Wed Nov 18 10:32:37 GMT 2020
https://gcc.gnu.org/g:472547275286886a79bc2fec4aa08d0293b7da28
commit r10-9041-g472547275286886a79bc2fec4aa08d0293b7da28
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Fri Nov 13 09:57:57 2020 +0100
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.
(cherry picked from commit d975d6dce98a3e26ddd304d50dad2786b3acecc4)
Diff:
---
gcc/d/intrinsics.cc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc
index c32819885bb..51cbd7b92fd 100644
--- a/gcc/d/intrinsics.cc
+++ b/gcc/d/intrinsics.cc
@@ -430,11 +430,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
More information about the Gcc-cvs
mailing list