From 6418b07737eb2dc44e9941812c665dc91fa962ed Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 19 Dec 2016 21:23:08 +0100 Subject: [PATCH] i386.md (*popcounthi2_1): New insn_and_split pattern. * config/i386/i386.md (*popcounthi2_1): New insn_and_split pattern. testsuite/ChangeLog: * gcc.target/i386/pr59874-3.c: New test. From-SVN: r243811 --- gcc/ChangeLog | 9 +++++--- gcc/config/i386/i386.md | 18 +++++++++++++++ gcc/testsuite/ChangeLog | 27 +++++++++++++---------- gcc/testsuite/gcc.target/i386/pr59874-3.c | 10 +++++++++ 4 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr59874-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 69ef89b0e30..49484d79407 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,10 @@ +2016-12-19 Uros Bizjak + + * config/i386/i386.md (*popcounthi2_1): New insn_and_split pattern. + 2016-12-19 Sandra Loosemore - * doc/cpp.texi: Clean up anachronistic C99 references and remove + * doc/cpp.texi: Clean up anachronistic C99 references and remove discussion of very old GCC versions. (Differences from previous versions): Delete entire section. @@ -183,8 +187,7 @@ * config/arc/arc.md (mulsidi_600): Change to insn_and_split, generate new mul64 insn for core multiplication work. (umulsidi_600): Likewise, but use mulu64 insn. - (mul64): New pattern, content taken from old mulsidi_600 insn - pattern. + (mul64): New pattern, content taken from old mulsidi_600 insn pattern. (mulu64): Likewise, but using umulsidi_600. (mulsidi3): Remove move to destination, this is now handled by mulsidi_600 insn_and_split. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 2123914bef9..a88c0b8c81a 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -13221,6 +13221,24 @@ (set_attr "type" "bitmanip") (set_attr "mode" "")]) +(define_insn_and_split "*popcounthi2_1" + [(set (match_operand:SI 0 "register_operand") + (popcount:SI + (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand")))) + (clobber (reg:CC FLAGS_REG))] + "TARGET_POPCNT + && can_create_pseudo_p ()" + "#" + "&& 1" + [(const_int 0)] +{ + rtx tmp = gen_reg_rtx (HImode); + + emit_insn (gen_popcounthi2 (tmp, operands[1])); + emit_insn (gen_zero_extendhisi2 (operands[0], tmp)); + DONE; +}) + (define_insn "popcounthi2" [(set (match_operand:HI 0 "register_operand" "=r") (popcount:HI diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4eb7ea7a911..cd0d954976a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,18 +1,21 @@ +2016-12-19 Uros Bizjak + + * gcc.target/i386/pr59874-3.c: New test. + 2016-12-19 Will Schmidt - * gcc.dg/vmx/mult-even-odd-be-order.c: Mark - variables as volatile. - * gcc.target/powerpc/fold-vec-mult-char.c: New. - * gcc.target/powerpc/fold-vec-mult-float.c: New. - * gcc.target/powerpc/fold-vec-mult-floatdouble.c: New. - * gcc.target/powerpc/fold-vec-mult-int.c: New. - * gcc.target/powerpc/fold-vec-mult-int128-p8.c: New. - * gcc.target/powerpc/fold-vec-mult-int128-p9.c: New. - * gcc.target/powerpc/fold-vec-mult-longlong.c: New. - * gcc.target/powerpc/fold-vec-mult-short.c: New. + * gcc.dg/vmx/mult-even-odd-be-order.c: Mark variables as volatile. + * gcc.target/powerpc/fold-vec-mult-char.c: New. + * gcc.target/powerpc/fold-vec-mult-float.c: New. + * gcc.target/powerpc/fold-vec-mult-floatdouble.c: New. + * gcc.target/powerpc/fold-vec-mult-int.c: New. + * gcc.target/powerpc/fold-vec-mult-int128-p8.c: New. + * gcc.target/powerpc/fold-vec-mult-int128-p9.c: New. + * gcc.target/powerpc/fold-vec-mult-longlong.c: New. + * gcc.target/powerpc/fold-vec-mult-short.c: New. 2016-12-19 Will Schmidt - + * gcc.target/powerpc/fold-vec-sub-char.c: New. * gcc.target/powerpc/fold-vec-sub-float.c: New. * gcc.target/powerpc/fold-vec-sub-floatdouble.c: New. @@ -39,7 +42,7 @@ 2016-12-17 Steven G. Kargl PR fortran/78746 - * charlen_03.f90: Remove test. + * charlen_03.f90: Remove test. * charlen_10.f90: Ditto. 2016-12-17 Jakub Jelinek diff --git a/gcc/testsuite/gcc.target/i386/pr59874-3.c b/gcc/testsuite/gcc.target/i386/pr59874-3.c new file mode 100644 index 00000000000..ec55a12e2a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr59874-3.c @@ -0,0 +1,10 @@ +/* PR target/59874 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mpopcnt -masm=att" } */ +/* { dg-final { scan-assembler "popcntw" } } */ + +unsigned int +foo (unsigned short x) +{ + return __builtin_popcount (x); +} -- 2.30.2