aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-04-01 18:08:21 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-04-01 18:08:21 +0200
commit763cd859a1d87f361a88e380e849cf6f0eb10751 (patch)
tree5cab43b888420f1abb496d4e7cd4c3bc22851a4d
parente7067fcdb510d363ea8dd354eb6fe6d698a83240 (diff)
downloadgcc-763cd859a1d87f361a88e380e849cf6f0eb10751.zip
gcc-763cd859a1d87f361a88e380e849cf6f0eb10751.tar.gz
gcc-763cd859a1d87f361a88e380e849cf6f0eb10751.tar.bz2
re PR rtl-optimization/70467 (Useless "and [esp],-1" emitted on AND with uint64_t variable)
PR rtl-optimization/70467 * config/i386/i386.md (*add<dwi>3_doubleword, *sub<dwi>3_doubleword): If low word of the last operand is 0, just emit addition/subtraction for the high word. * gcc.target/i386/pr70467-2.c: New test. From-SVN: r234679
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386.md18
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr70467-2.c20
4 files changed, 48 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index de3b8c5..81d8879 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2016-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/70467
+ * config/i386/i386.md (*add<dwi>3_doubleword, *sub<dwi>3_doubleword):
+ If low word of the last operand is 0, just emit addition/subtraction
+ for the high word.
+
2016-04-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
PR target/70404
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index f324ea7..09da69e 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -5449,7 +5449,14 @@
(match_dup 4))
(match_dup 5)))
(clobber (reg:CC FLAGS_REG))])]
- "split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]);")
+{
+ split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]);
+ if (operands[2] == const0_rtx)
+ {
+ ix86_expand_binary_operator (PLUS, <MODE>mode, &operands[3]);
+ DONE;
+ }
+})
(define_insn "*add<mode>_1"
[(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm,r,r")
@@ -6379,7 +6386,14 @@
(ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)))
(match_dup 5)))
(clobber (reg:CC FLAGS_REG))])]
- "split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]);")
+{
+ split_double_mode (<DWI>mode, &operands[0], 3, &operands[0], &operands[3]);
+ if (operands[2] == const0_rtx)
+ {
+ ix86_expand_binary_operator (MINUS, <MODE>mode, &operands[3]);
+ DONE;
+ }
+})
(define_insn "*sub<mode>_1"
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>")
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a4a1df5..e908caa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,9 @@
2016-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/70467
+ * gcc.target/i386/pr70467-2.c: New test.
+
+2016-04-01 Jakub Jelinek <jakub@redhat.com>
Marek Polacek <polacek@redhat.com>
PR c++/70488
diff --git a/gcc/testsuite/gcc.target/i386/pr70467-2.c b/gcc/testsuite/gcc.target/i386/pr70467-2.c
new file mode 100644
index 0000000..4c1715c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr70467-2.c
@@ -0,0 +1,20 @@
+/* PR rtl-optimization/70467 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2" } */
+
+unsigned long long
+foo (unsigned long long x)
+{
+ return x + 0x12345600000000ULL;
+}
+
+unsigned long long
+bar (unsigned long long x)
+{
+ return x - 0x12345600000000ULL;
+}
+
+/* { dg-final { scan-assembler-not "addl\[ \t\]*.0," } } */
+/* { dg-final { scan-assembler-not "subl\[ \t\]*.0," } } */
+/* { dg-final { scan-assembler-not "adcl\[^\n\r\]*%" } } */
+/* { dg-final { scan-assembler-not "sbbl\[^\n\r\]*%" } } */