http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50101

--- Comment #3 from Michael Meissner <meissner at gcc dot gnu.org> 2011-08-17 
15:43:00 UTC ---
(In reply to comment #2)
> I suppose the CTR is introduced after RA in machine-dependent reorg?  In which
> case can the issue be fixed on branches by adjusting register cost of the CTR?

No, the pattern would normally allocate the CTR, and has options to fall back
to register, and memory.  According to the comments in the source, because it
is a JUMP_INSN, it has to provide reloads from memory in case it can't find a
register.  Previously, GCC was able to allocate a register, but now it doesn't
seem to.

Here is the pattern from rs6000.md:

;; We need to be able to do this for any operand, including MEM, or we
;; will cause reload to blow up since we don't allow output reloads on
;; JUMP_INSNs.
;; For the length attribute to be calculated correctly, the
;; label MUST be operand 0.

(define_insn "*ctr<mode>_internal1"
  [(set (pc)
    (if_then_else (ne (match_operand:P 1 "register_operand" "c,*r,*r,*r")
              (const_int 1))
              (label_ref (match_operand 0 "" ""))
              (pc)))
   (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*q*c*l")
    (plus:P (match_dup 1)
         (const_int -1)))
   (clobber (match_scratch:CC 3 "=X,&x,&x,&x"))
   (clobber (match_scratch:P 4 "=X,X,&r,r"))]
  ""
  "*
{
  if (which_alternative != 0)
    return \"#\";
  else if (get_attr_length (insn) == 4)
    return \"{bdn|bdnz} %l0\";
  else
    return \"bdz $+8\;b %l0\";
}"
  [(set_attr "type" "branch")
   (set_attr "length" "*,12,16,16")])

I will upload the rtl dump files as attachments.

Reply via email to