Hi,

the attached patch fixes a segfault which might occur when evaluating
the insn conditions of three memory operation patterns in the s390
back-end after reloaded decided to pick an alternative where
clobbering a scratch isn't necessary.

Fixed by moving the mode check from the insn condition into the
match_scratch statement.

Committed to mainline.

Bye,

-Andreas-


2012-05-04  Andreas Krebbel  <andreas.kreb...@de.ibm.com>

        * config/s390/s390.md (*movmem_short, *clrmem_short)
        (*cmpmem_short): Move the mode check from the insn condition to
        the match_scratch.

---
 gcc/config/s390/s390.md |   15 !!!!!!!!!!!!!!!
 1 file changed, 15 modifications(!)

Index: gcc/config/s390/s390.md
===================================================================
*** gcc/config/s390/s390.md.orig
--- gcc/config/s390/s390.md
***************
*** 2658,2666 ****
          (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))
     (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
     (use (match_operand 3 "immediate_operand" "X,R,X,X"))
!    (clobber (match_scratch 4 "=X,X,X,&a"))]
!   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
!    && GET_MODE (operands[4]) == Pmode"
    "#"
    [(set_attr "type"         "cs")
     (set_attr "cpu_facility" "*,*,z10,*")])
--- 2658,2665 ----
          (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q"))
     (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
     (use (match_operand 3 "immediate_operand" "X,R,X,X"))
!    (clobber (match_scratch:P 4 "=X,X,X,&a"))]
!   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
    "#"
    [(set_attr "type"         "cs")
     (set_attr "cpu_facility" "*,*,z10,*")])
***************
*** 2867,2876 ****
          (const_int 0))
     (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
     (use (match_operand 2 "immediate_operand" "X,R,X,X"))
!    (clobber (match_scratch 3 "=X,X,X,&a"))
     (clobber (reg:CC CC_REGNUM))]
!   "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)
!    && GET_MODE (operands[3]) == Pmode"
    "#"
    [(set_attr "type" "cs")
     (set_attr "cpu_facility" "*,*,z10,*")])
--- 2866,2874 ----
          (const_int 0))
     (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
     (use (match_operand 2 "immediate_operand" "X,R,X,X"))
!    (clobber (match_scratch:P 3 "=X,X,X,&a"))
     (clobber (reg:CC CC_REGNUM))]
!   "(GET_MODE (operands[1]) == Pmode || GET_MODE (operands[1]) == VOIDmode)"
    "#"
    [(set_attr "type" "cs")
     (set_attr "cpu_facility" "*,*,z10,*")])
***************
*** 3040,3048 ****
                       (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")))
     (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
     (use (match_operand 3 "immediate_operand" "X,R,X,X"))
!    (clobber (match_scratch 4 "=X,X,X,&a"))]
!   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)
!    && GET_MODE (operands[4]) == Pmode"
    "#"
    [(set_attr "type" "cs")
     (set_attr "cpu_facility" "*,*,z10,*")])
--- 3038,3045 ----
                       (match_operand:BLK 1 "memory_operand" "Q,Q,Q,Q")))
     (use (match_operand 2 "nonmemory_operand" "n,a,a,a"))
     (use (match_operand 3 "immediate_operand" "X,R,X,X"))
!    (clobber (match_scratch:P 4 "=X,X,X,&a"))]
!   "(GET_MODE (operands[2]) == Pmode || GET_MODE (operands[2]) == VOIDmode)"
    "#"
    [(set_attr "type" "cs")
     (set_attr "cpu_facility" "*,*,z10,*")])

Reply via email to