This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] s390: fix doloop_di constraints


Hello,

the attached patch fixes 2 problems with the doloop_di pattern on s390.

The first problem occurs when a paradoxical subreg of a mem is passed as
second operand. In this case reload thinks it would need an output reload
what is not permitted since it is a CALL insn. Because in this case the operand
gets overwritten anyway and a move pattern is able to deal with everything
it doesn't matter in which shape the operand comes so I've replaced the "?*m*d"
with 'X' constraints.

The second problem is that we force the scratch register to match the first
operand for the alternative handled by a forced split. This caused problems
when the first operand is "somehow involved" in the second operand but does
not exactly match it. Then reload can't use the register used in operand 1
as scratch for operand 3 and complains about not being able to generate a
reload.
Fixing this needs an extra insn moving the first operand to the third. 
If the scratch register actually matches the first operand. The extra insn 
is hopefully removed by passes optimizing trivial sets away.

I do not have testcases in a gcc integrated language and unfortunately failed 
to convert the existing testcases to c :(

Bootstrapped on s390 and s390x.
No testsuite regressions.

Ok for mainline?

Bye,

-Andreas-


2006-06-14  Andreas Krebbel  <krebbel1@de.ibm.com>

	* config/s390/s390.md ("doloop_di"): Add a new alternative to the 
	constraint strings.


Index: gcc/config/s390/s390.md
===================================================================
*** gcc/config/s390/s390.md.orig	2006-06-13 13:27:37.000000000 +0200
--- gcc/config/s390/s390.md	2006-06-13 16:41:53.000000000 +0200
***************
*** 6882,6894 ****
  (define_insn_and_split "doloop_di"
    [(set (pc)
          (if_then_else
!           (ne (match_operand:DI 1 "register_operand" "d,d")
                (const_int 1))
            (label_ref (match_operand 0 "" ""))
            (pc)))
!    (set (match_operand:DI 2 "nonimmediate_operand" "=1,?*m*d")
          (plus:DI (match_dup 1) (const_int -1)))
!    (clobber (match_scratch:DI 3 "=X,&1"))
     (clobber (reg:CC CC_REGNUM))]
    "TARGET_64BIT"
  {
--- 6882,6894 ----
  (define_insn_and_split "doloop_di"
    [(set (pc)
          (if_then_else
!           (ne (match_operand:DI 1 "register_operand" "d,d,d")
                (const_int 1))
            (label_ref (match_operand 0 "" ""))
            (pc)))
!    (set (match_operand:DI 2 "nonimmediate_operand" "=1,?X,?X")
          (plus:DI (match_dup 1) (const_int -1)))
!    (clobber (match_scratch:DI 3 "=X,&1,&?d"))
     (clobber (reg:CC CC_REGNUM))]
    "TARGET_64BIT"
  {
***************
*** 6902,6908 ****
    "&& reload_completed
     && (! REG_P (operands[2])
         || ! rtx_equal_p (operands[1], operands[2]))"
!   [(parallel [(set (reg:CCAN CC_REGNUM)
                     (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
                                   (const_int 0)))
                (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])
--- 6902,6909 ----
    "&& reload_completed
     && (! REG_P (operands[2])
         || ! rtx_equal_p (operands[1], operands[2]))"
!   [(set (match_dup 3) (match_dup 1))
!    (parallel [(set (reg:CCAN CC_REGNUM)
                     (compare:CCAN (plus:DI (match_dup 3) (const_int -1))
                                   (const_int 0)))
                (set (match_dup 3) (plus:DI (match_dup 3) (const_int -1)))])


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]