From: jakub Date: Fri, 1 Apr 2016 16:08:21 +0000 (+0000) Subject: PR rtl-optimization/70467 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0edb9bfe8b60013cc0d6aa6dfc4039b2213f1f6d;p=thirdparty%2Fgcc.git PR rtl-optimization/70467 * config/i386/i386.md (*add3_doubleword, *sub3_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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234679 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de3b8c575434..81d887974727 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-04-01 Jakub Jelinek + + PR rtl-optimization/70467 + * config/i386/i386.md (*add3_doubleword, *sub3_doubleword): + If low word of the last operand is 0, just emit addition/subtraction + for the high word. + 2016-04-01 Andreas Krebbel PR target/70404 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index f324ea7ea419..09da69e7e44d 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 (mode, &operands[0], 3, &operands[0], &operands[3]);") +{ + split_double_mode (mode, &operands[0], 3, &operands[0], &operands[3]); + if (operands[2] == const0_rtx) + { + ix86_expand_binary_operator (PLUS, mode, &operands[3]); + DONE; + } +}) (define_insn "*add_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 (mode, &operands[0], 3, &operands[0], &operands[3]);") +{ + split_double_mode (mode, &operands[0], 3, &operands[0], &operands[3]); + if (operands[2] == const0_rtx) + { + ix86_expand_binary_operator (MINUS, mode, &operands[3]); + DONE; + } +}) (define_insn "*sub_1" [(set (match_operand:SWI 0 "nonimmediate_operand" "=m,") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4a1df51afcf..e908caaf4d1e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-01 Jakub Jelinek + + PR rtl-optimization/70467 + * gcc.target/i386/pr70467-2.c: New test. + 2016-04-01 Jakub Jelinek Marek Polacek 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 000000000000..4c1715c87e53 --- /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\]*%" } } */