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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com,
                   |                            |law at redhat dot com,
                   |                            |vmakarov at redhat dot com

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Martin Liška from comment #2)
> Confirmed, started with r273578.

Some analysis:

The reload failure happens with:

(insn 76 75 77 4 (parallel [
            (set (strict_low_part (subreg:QI (reg:DI 202 [ c+8 ]) 0))
                (xor:QI (reg:QI 198)
                    (subreg:QI (reg:DI 202 [ c+8 ]) 0)))
            (clobber (reg:CC 17 flags))
        ]) "pr91223.c":27:12 429 {*xorqi_1_slp}
     (expr_list:REG_DEAD (reg:QI 198)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

Previously, the pattern was defined as:

(define_insn "*<code>qi_1_slp"
  [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+q,m"))
        (any_or:QI (match_dup 0)
                   (match_operand:QI 1 "general_operand" "qmn,qn")))
   (clobber (reg:CC FLAGS_REG))]
  "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
   && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
  "<logic>{b}\t{%1, %0|%0, %1}"
  [(set_attr "type" "alu1")
   (set_attr "mode" "QI")])

and later, it was corrected/improved to:

(define_insn "*<code><mode>_1_slp"
  [(set (strict_low_part (match_operand:SWI12 0 "register_operand" "+<r>"))
        (any_or:SWI12 (match_operand:SWI12 1 "nonimmediate_operand" "%0")
                      (match_operand:SWI12 2 "general_operand" "<r>mn")))
   (clobber (reg:CC FLAGS_REG))]
  "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
   /* FIXME: without this LRA can't reload this pattern, see PR82524.  */
   && (rtx_equal_p (operands[0], operands[1])
       || rtx_equal_p (operands[0], operands[2]))"
  "<logic>{<imodesuffix>}\t{%2, %0|%0, %2}"
  [(set_attr "type" "alu")
   (set_attr "mode" "<MODE>")])

Please note that the output can match either input, taking "%" into
consideration. This is the reason for rtx_equal_p condition, effectively a
(match dup X) in the original pattern.

I suspect that this part of LRA doesn't consider "%" modifier, since insn
constraint should (according to PR82524) help LRA to resolve the reloading.

I don't see anything wrong with the pattern. Let's ask experts if it triggers
some (un)known limitation in LRA.

Reply via email to