Hi,

the attached patch fixes a problem with the population count expanders
on s390.  For operand 2 a scratch register is allocated in the
preparation code of the expander.  Nevertheless there has been a
match_operand for operand 2.  It should be just a match_dup instead.

Fixed with the attached patch.

Bootstrapped and regression tested on s390x.

Committed to 4.6 and mainline.

Bye,

-Andreas-


2011-04-15  Andreas Krebbel  <andreas.kreb...@de.ibm.com>

        * config/s390/s390.md (popcountdi2, popcountsi2, popcounthi2):
        Replace match_operand with match_dup for the third operand in
        these expanders.


Index: gcc/config/s390/s390.md
===================================================================
*** gcc/config/s390/s390.md.orig
--- gcc/config/s390/s390.md
***************
*** 9330,9336 ****
     (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
              (clobber (reg:CC CC_REGNUM))])
     ; sllg op2, op0, 16
!    (set (match_operand:DI 2 "register_operand" "")
        (ashift:DI (match_dup 0) (const_int 16)))
     ; agr op0, op2
     (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
--- 9330,9336 ----
     (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
              (clobber (reg:CC CC_REGNUM))])
     ; sllg op2, op0, 16
!    (set (match_dup 2)
        (ashift:DI (match_dup 0) (const_int 16)))
     ; agr op0, op2
     (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
***************
*** 9352,9358 ****
                              UNSPEC_POPCNT))
              (clobber (reg:CC CC_REGNUM))])
     ; sllk op2, op0, 16
!    (set (match_operand:SI 2 "register_operand" "")
        (ashift:SI (match_dup 0) (const_int 16)))
     ; ar op0, op2
     (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
--- 9352,9358 ----
                              UNSPEC_POPCNT))
              (clobber (reg:CC CC_REGNUM))])
     ; sllk op2, op0, 16
!    (set (match_dup 2)
        (ashift:SI (match_dup 0) (const_int 16)))
     ; ar op0, op2
     (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
***************
*** 9374,9380 ****
                              UNSPEC_POPCNT))
              (clobber (reg:CC CC_REGNUM))])
     ; sllk op2, op0, 8
!    (set (match_operand:SI 2 "register_operand" "")
        (ashift:SI (match_dup 0) (const_int 8)))
     ; ar op0, op2
     (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))
--- 9374,9380 ----
                              UNSPEC_POPCNT))
              (clobber (reg:CC CC_REGNUM))])
     ; sllk op2, op0, 8
!    (set (match_dup 2)
        (ashift:SI (match_dup 0) (const_int 8)))
     ; ar op0, op2
     (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))

Reply via email to