summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-27 10:53:42 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-27 10:53:42 +0000
commitd80f2fa31a307fa76ccfa2826d677a57a6c99ebe (patch)
tree4404472f065eec87480bf9ced280f25e45717203
parentfe7be149f78b8eafb73b5eae65e4ed8b00d833b7 (diff)
downloadgcc-d80f2fa31a307fa76ccfa2826d677a57a6c99ebe.tar.gz
PR target/54703
* simplify-rtx.c (simplify_binary_operation_1): Perform (x - (x & y)) -> (x & ~y) optimization only for integral modes. * gcc.target/i386/pr54703.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@191802 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/simplify-rtx.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr54703.c36
4 files changed, 50 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cfe1ea7c1b4..f619d91cf85 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/54703
+ * simplify-rtx.c (simplify_binary_operation_1): Perform
+ (x - (x & y)) -> (x & ~y) optimization only for integral
+ modes.
+
2012-09-24 Eric Botcazou <ebotcazou@adacore.com>
* tree-streamer-in.c (unpack_ts_type_common_value_fields): Stream in
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index bba565ddfd3..ed1dddcdcdf 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1,7 +1,7 @@
/* RTL simplification functions for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
- 2011 Free Software Foundation, Inc.
+ 2011, 2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -2239,7 +2239,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
neg_const_int (mode, op1));
/* (x - (x & y)) -> (x & ~y) */
- if (GET_CODE (op1) == AND)
+ if (INTEGRAL_MODE_P (mode) && GET_CODE (op1) == AND)
{
if (rtx_equal_p (op0, XEXP (op1, 0)))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3a4f48e1854..100a36c4c0d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/54703
+ * gcc.target/i386/pr54703.c: New test.
+
2012-09-24 Janis Johnson <janisjo@codesourcery.com>
Backport from mainline:
diff --git a/gcc/testsuite/gcc.target/i386/pr54703.c b/gcc/testsuite/gcc.target/i386/pr54703.c
new file mode 100644
index 00000000000..e30c293c076
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr54703.c
@@ -0,0 +1,36 @@
+/* PR target/54703 */
+/* { dg-do run { target sse2_runtime } } */
+/* { dg-options "-O -msse2" } */
+/* { dg-additional-options "-mavx -mtune=bdver1" { target avx_runtime } } */
+
+extern void abort (void);
+typedef double V __attribute__((vector_size(16)));
+
+union {
+ unsigned long long m[2];
+ V v;
+} u = { { 0xffffffffff000000ULL, 0xffffffffff000000ULL } };
+
+static inline V
+foo (V x)
+{
+ V y = __builtin_ia32_andpd (x, u.v);
+ V z = __builtin_ia32_subpd (x, y);
+ return __builtin_ia32_mulpd (y, z);
+}
+
+void
+test (V *x)
+{
+ V a = { 2.1, 2.1 };
+ *x = foo (foo (a));
+}
+
+int
+main ()
+{
+ test (&u.v);
+ if (u.m[0] != 0x3acbf487f0a30550ULL || u.m[1] != u.m[0])
+ abort ();
+ return 0;
+}