aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-10-22 08:27:04 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-10-22 08:27:04 +0000
commit92c52eab974ce9e1c81d770724adb56846bcaa4b (patch)
tree84842493f9d814e607d6df00c0278469f3159f10 /gcc/tree.c
parent7477de01a8c9c4f496d6f4daea90255ec0aad272 (diff)
downloadgcc-92c52eab974ce9e1c81d770724adb56846bcaa4b.zip
gcc-92c52eab974ce9e1c81d770724adb56846bcaa4b.tar.gz
gcc-92c52eab974ce9e1c81d770724adb56846bcaa4b.tar.bz2
Move more cproj simplifications to match.pd
Also make build_complex_cproj available globally and use it for the existing match.pd rules. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * builtins.c (fold_builtin_cproj): Delete. (fold_builtin_1): Handle constant arguments here. (build_complex_cproj): Move and rename to... * tree.c: (build_complex_inf): ...this. * tree.h (build_complex_inf): Declare. * match.pd: Fold cproj(x)->x if x has no infinity. Use build_complex_inf for existing cproj rules. From-SVN: r229164
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index adc8748..09df67e 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1986,6 +1986,21 @@ build_complex (tree type, tree real, tree imag)
return t;
}
+/* Build a complex (inf +- 0i), such as for the result of cproj.
+ TYPE is the complex tree type of the result. If NEG is true, the
+ imaginary zero is negative. */
+
+tree
+build_complex_inf (tree type, bool neg)
+{
+ REAL_VALUE_TYPE rinf, rzero = dconst0;
+
+ real_inf (&rinf);
+ rzero.sign = neg;
+ return build_complex (type, build_real (TREE_TYPE (type), rinf),
+ build_real (TREE_TYPE (type), rzero));
+}
+
/* Return the constant 1 in type TYPE. If TYPE has several elements, each
element is set to 1. In particular, this is 1 + i for complex types. */