From: Andrew Pinski Date: Sat, 21 Jul 2012 11:05:04 +0000 (+0000) Subject: mips.md (*popcountdi2_trunc): New pattern to handle popcount of a truncation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c55963ebd6b75545dc9f79fd081c596ef5cbe568;p=gcc.git mips.md (*popcountdi2_trunc): New pattern to handle popcount of a truncation. 2012-07-21 Andrew Pinski * config/mips/mips.md (*popcountdi2_trunc): New pattern to handle popcount of a truncation. 2012-07-21 Andrew Pinski * gcc.target/mips/octeon-pop-2.c: New testcase. From-SVN: r189744 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 40277665f23..a2838d78727 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-07-21 Andrew Pinski + + * config/mips/mips.md (*popcountdi2_trunc): New pattern + to handle popcount of a truncation. + 2012-07-21 Andrew Pinski * config/mips/mips-protos.h (mips_expand_ext_as_unaligned_load): diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 0edc9d94986..af741ba2b82 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -2643,6 +2643,16 @@ "pop\t%0,%1" [(set_attr "type" "pop") (set_attr "mode" "")]) + +;; The POP instruction is special as it does not take into account the upper +;; 32bits and is documented that way. +(define_insn "*popcountdi2_trunc" + [(set (match_operand:SI 0 "register_operand" "=d") + (popcount:SI (truncate:SI (match_operand:DI 1 "register_operand" "d"))))] + "ISA_HAS_POP && TARGET_64BIT" + "pop\t%0,%1" + [(set_attr "type" "pop") + (set_attr "mode" "SI")]) ;; ;; .................... diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 75aa1141404..3dd4fb86c80 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-07-21 Andrew Pinski + + * gcc.target/mips/octeon-pop-2.c: New testcase. + 2012-07-21 Tobias Burnus PR fortran/48820 diff --git a/gcc/testsuite/gcc.target/mips/octeon-pop-2.c b/gcc/testsuite/gcc.target/mips/octeon-pop-2.c new file mode 100644 index 00000000000..8acd9359752 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/octeon-pop-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O -march=octeon -mgp64" } */ +/* The pop instruction does not depend on the word value to be sign extended. */ +/* { dg-final { scan-assembler-not "sll\t" } } */ + +long long f(long long i) +{ + return __builtin_popcount (i); +} +