This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: IRA changes rules of the game
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: paulo at matos-sorge dot com (Paulo J. Matos)
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 20 Oct 2011 17:25:44 +0200 (CEST)
- Subject: Re: IRA changes rules of the game
Paulo J. Matos wrote:
> (define_insn_and_split "neghi_internal"
> [(set (match_operand:QI 0 "register_operand" "=c")
> (neg:QI (match_dup 0)))
> (set (match_operand:QI 1 "register_operand" "=c")
> (plus:QI
> (plus:QI
> (ltu:QI (neg:QI (match_dup 0)) (const_int 0))
> (match_dup 1))
> (const_int 0)))
> (clobber (reg:CC RCC))]
> Am I missing something or something here is broken?
When reload looks at the above pattern, it will see just
two operands, both of which are output-only. So when it
decides to reload one of the operands, it will only provide
an output reload, no input reload.
For operands that are actually used for both input and
output, you need to provide two match_operand clauses,
and tie them using a matching constraint. Simply using
match_dup doesn't accomplish that.
Something along the lines of:
(define_insn_and_split "neghi_internal"
[(set (match_operand:QI 0 "register_operand" "=c")
(neg:QI (match_operand:QI 1 "register_operand" "0")))
(set (match_operand:QI 2 "register_operand" "=c")
(plus:QI
(plus:QI
(ltu:QI (neg:QI (match_dup 1)) (const_int 0))
(match_operand:QI 3 "register_operand" "2"))
(const_int 0)))
(clobber (reg:CC RCC))]
ought to work as expected.
(The remaining match_dup is fine, since reload already knows
operand 1 is used as input, so the dup doesn't introduce a
new type of use.)
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com