diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-28 00:55:07 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-28 00:55:07 +0000 |
commit | 270436f389c1c862f9e0a2f3b3b928f15d8b380d (patch) | |
tree | 3611918a36fd9acca7d65920e977e8e47fd831c5 /gcc/builtins.c | |
parent | 89ea40075b3410afaa6100e82dc31632f0fbd6e1 (diff) | |
download | gcc-270436f389c1c862f9e0a2f3b3b928f15d8b380d.tar.gz |
* builtins.c (expand_builtin_copysign): New.
(expand_builtin): Call it.
* genopinit.c (optabs): Add copysign_optab.
* optabs.c (init_optabs): Initialize it.
(expand_copysign): New.
* optabs.h (OTI_copysign, copysign_optab): New.
(expand_copysign): Declare.
* config/alpha/alpha.md (UNSPEC_COPYSIGN): New.
(copysignsf3, ncopysignsf3, copysigndf3, ncopysigndf3): New.
* config/i386/i386.c (ix86_build_signbit_mask): Split from ...
(ix86_expand_fp_absneg_operator): ... here.
(ix86_split_copysign): New.
* config/i386/i386-protos.h: Update.
* config/i386/i386.md (UNSPEC_COPYSIGN): New.
(copysignsf3, copysigndf3): New.
* config/ia64/ia64.md (UNSPEC_COPYSIGN): New.
(copysignsf3, ncopysignsf3): New.
(copysigndf3, ncopysigndf3): New.
(copysignxf3, ncopysignxf3): New.
* config/ia64/ia64.c (rtx_needs_barrier): Handle UNSPEC_COPYSIGN.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94357 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 78076db2bf2..dada41ef848 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -4436,6 +4436,29 @@ expand_builtin_fabs (tree arglist, rtx target, rtx subtarget) return expand_abs (mode, op0, target, 0, safe_from_p (target, arg, 1)); } +/* Expand a call to copysign, copysignf, or copysignl with arguments ARGLIST. + Return NULL is a normal call should be emitted rather than expanding the + function inline. If convenient, the result should be placed in TARGET. + SUBTARGET may be used as the target for computing the operand. */ + +static rtx +expand_builtin_copysign (tree arglist, rtx target, rtx subtarget) +{ + rtx op0, op1; + tree arg; + + if (!validate_arglist (arglist, REAL_TYPE, REAL_TYPE, VOID_TYPE)) + return 0; + + arg = TREE_VALUE (arglist); + op0 = expand_expr (arg, subtarget, VOIDmode, 0); + + arg = TREE_VALUE (TREE_CHAIN (arglist)); + op1 = expand_expr (arg, NULL, VOIDmode, 0); + + return expand_copysign (op0, op1, target); +} + /* Create a new constant string literal and return a char* pointer to it. The STRING_CST value is the LEN characters at STR. */ static tree @@ -5065,6 +5088,14 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, return target; break; + case BUILT_IN_COPYSIGN: + case BUILT_IN_COPYSIGNF: + case BUILT_IN_COPYSIGNL: + target = expand_builtin_copysign (arglist, target, subtarget); + if (target) + return target; + break; + /* Just do a normal library call if we were unable to fold the values. */ case BUILT_IN_CABS: |