https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57032

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ra                          |
                 CC|                            |rth at gcc dot gnu.org

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
This is not a LRA problem.

The problem is in definition of "Q" constraint, AKA "normal_memory_operand":

(define_constraint "Q"
  "@internal A normal_memory_operand"
  (match_operand 0 "normal_memory_operand"))

;; Return 1 is OP is a memory location that is not a reference
;; (using an AND) to an unaligned location.  Take into account
;; what reload will do.
(define_special_predicate "normal_memory_operand"
  (ior (match_test "op = resolve_reload_operand (op), 0")
       (and (match_code "mem")
        (match_test "GET_CODE (XEXP (op, 0)) != AND"))))

This constraint calls "resolve_reload_operand":

/* Used by aligned_memory_operand and unaligned_memory_operand to
   resolve what reload is going to do with OP if it's a register.  */

rtx
resolve_reload_operand (rtx op)
{
  if (reload_in_progress)
    {
      rtx tmp = op;
      if (GET_CODE (tmp) == SUBREG)
    tmp = SUBREG_REG (tmp);
      if (REG_P (tmp)
      && REGNO (tmp) >= FIRST_PSEUDO_REGISTER)
    {
      op = reg_equiv_memory_loc (REGNO (tmp));
      if (op == 0)
        return 0;
    }
    }
  return op;
}

LRA does not set reload_in_progress, and also doesn't allow to use
reg_equiv_memory_loc. So, the "Q" constraint is effectively dead when LRA is
used.

Using the "m" constraint instead of "Q" in:

(define_insn "*movdi"
  [(set (match_operand:DI 0 "nonimmediate_operand"
                "=r,r,r,r,r,r,r,r, m, *f,*f, Q, r,*f")
    (match_operand:DI 1 "input_operand"
                "rJ,K,L,T,s,n,s,m,rJ,*fJ, Q,*f,*f, r"))]
  "register_operand (operands[0], DImode)
   || reg_or_0_operand (operands[1], DImode)"

solves this particular failure.

Probably we need to redefine "Q" as a memory constraint. Also
{aligned,unaligned,normal}_memory_operand shouldn't use resolve_reload_operand
anymore. Richard, do you have any insight into this issue?

Reply via email to