This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: md description for intruction that modifies multiple operands
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Eric Christopher <echristo at redhat dot com>
- Cc: fnf at intrinsity dot com, gcc at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Thu, 29 May 2003 10:28:33 +0100
- Subject: Re: md description for intruction that modifies multiple operands
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
>
> > That didn't seem to work. I also tried something like:
> >
> > (define_insn "block4"
> > [(set (match_operand:SI 0 "register_operand" "+d")
> > (unspec:SI [(match_operand:SI 1 "register_operand" "+d")
> > (match_operand:SI 2 "register_operand" "+d")
> > (match_operand:SI 3 "register_operand" "+d")] 123))
> > (set (match_dup 1) (unspec:SI [(match_dup 0) (match_dup 2) (match_dup 3)] 124))
> > (set (match_dup 2) (unspec:SI [(match_dup 0) (match_dup 1) (match_dup 3)] 125))
> > (set (match_dup 3) (unspec:SI [(match_dup 0) (match_dup 1) (match_dup 2)] 126))]
> > "TARGET_FOO"
> > "block4\\t%0 # %0,%1,%2,%3")
> >
> > which works a little better, but still seems to have some problems
> > with the compiler recognizing that every operand is both an input and
> > output.
> >
> > Am I totally off track here?
>
> I don't think so. Though it looks like you might want to define a single
> unspec number for the pattern and maybe use a parallel? *guesses*
>
You are probably better off if you only use match_dup to match inputs to
inputs and outputs to outputs. Use tied register allocation for inputs to
outputs. Ties are best done using adjacent number pairs. Hence something
like:
(define_insn "block4"
[(set (match_operand:SI 0 "register_operand" "=d")
(unspec:SI [(match_operand:SI 3 "register_operand" "2")
(match_operand:SI 5 "register_operand" "4")
(match_operand:SI 7 "register_operand" "6")] 123))
(set (match_operand:SI 2 "register_operand" "=d")
(unspec:SI [(match_operand:SI 1 "register_operand" "0")
(match_dup 5) (match_dup 7)] 124))
(set (match_operand:SI 4 "register_operand" "=d")
(unspec:SI [(match_dup 1) (match_dup 3) (match_dup 7)] 125))
(set (match_operand:SI 6 "register_operand" "=d")
(unspec:SI [(match_dup 1) (match_dup 3) (match_dup 7)] 126))]
"TARGET_FOO"
"block4\\t%0 # %0,%2,%4,%6")