aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2005-01-27 16:55:07 -0800
committerRichard Henderson <rth@gcc.gnu.org>2005-01-27 16:55:07 -0800
commit046625fab2932bdc6827d9abdd895824dfbc80eb (patch)
tree3611918a36fd9acca7d65920e977e8e47fd831c5 /gcc/builtins.c
parent17a7d6d75a9f752c68a64c1a4f1de8e11b8d3384 (diff)
downloadgcc-046625fab2932bdc6827d9abdd895824dfbc80eb.zip
gcc-046625fab2932bdc6827d9abdd895824dfbc80eb.tar.gz
gcc-046625fab2932bdc6827d9abdd895824dfbc80eb.tar.bz2
builtins.c (expand_builtin_copysign): New.
* 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. From-SVN: r94357
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 78076db..dada41e 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: