re PR target/67317 ([x86] Silly code generation for _addcarry_u32/_addcarry_u64)
authorUros Bizjak <ubizjak@gmail.com>
Thu, 27 Aug 2015 18:29:37 +0000 (20:29 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 27 Aug 2015 18:29:37 +0000 (20:29 +0200)
commita443ee6e5b00626b6a149da61fb6120386c83f4d
tree6c980ba052c6d8c605e0bd7e6a43848413c0cd4e
parent2b6fb4aa47e25c530ee97c4354896443403da585
re PR target/67317 ([x86] Silly code generation for _addcarry_u32/_addcarry_u64)

PR target/67317
* config/i386/i386.md (*add<mode>3_cc): Remove insn pattern.
(addqi3_cc): Ditto.
(UNSPEC_ADD_CARRY): Remove.
(addqi3_cconly_overflow): New expander.
(*add<dwi>3_doubleword): Split to add<mode>3_cconly_overflow.
Adjust for changed add<mode>3_carry.
(*neg<dwi>2_doubleword): Adjust for changed add<mode>3_carry.
(*sub<dwi>3_doubleword): Adjust for changed sub<mode>3_carry.
(<plusminus_insn><mode>3_carry): Remove expander.
(*<plusminus_insn><mode>3_carry): Split insn pattern to
add<mode>3_carry and sub<mode>3_carry.
(plusminus_carry_mnemonic): Remove code attribute.
(add<mode>3_carry): Canonicalize insn pattern.
(*addsi3_carry_zext): Ditto.
(sub<mode>3_carry): Ditto.
(*subsi3_carry_zext): Ditto.
(adcx<mode>3): Remove insn pattern.
(addcarry<mode>): New insn pattern.
(subborrow<mode>): Ditto.
* config/i386/i386.c (ix86_expand_strlensi_unroll_1): Use
gen_addqi3_cconly_overflow instead of gen_addqi3_cc.
(ix86_expand_builtin) <case IX86_BUILTIN_SBB32,
case IX86_BUILTIN_SBB64, case IX86_BUILTIN_ADDCARRY32,
case IX86_BUILTIN_ADDCARRY64>: Use CODE_FOR_subborrowsi,
CODE_FOR_subborrowdi, CODE_FOR_addcarrysi and CODE_FOR_addcarrydi.
Rewrite expander to not clobber carry flag chains.

testsuite/ChangeLog:

PR target/67317
* gcc.target/i386/pr67317-1.c: New test.
* gcc.target/i386/pr67317-2.c: Ditto.
* gcc.target/i386/pr67317-3.c: Ditto.
* gcc.target/i386/pr67317-4.c: Ditto.
* gcc.target/i386/adx-addcarryx32-1.c: Also scan for adcl.
* gcc.target/i386/adx-addcarryx32-2.c: Also scan for adcq.

From-SVN: r227271
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c
gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c
gcc/testsuite/gcc.target/i386/pr67317-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr67317-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr67317-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr67317-4.c [new file with mode: 0644]