AW: Help with "unable to generate reloads for" atomic_exchangesi
stefan@franke.ms
stefan@franke.ms
Tue Sep 24 16:52:00 GMT 2019
> -----Ursprüngliche Nachricht-----
> Von: gcc-help-owner@gcc.gnu.org <gcc-help-owner@gcc.gnu.org> Im
> Auftrag von William Tambe
> Gesendet: Dienstag, 24. September 2019 18:34
> An: Segher Boessenkool <segher@kernel.crashing.org>
> Cc: gcc-help <gcc-help@gcc.gnu.org>
> Betreff: Re: Help with "unable to generate reloads for" atomic_exchangesi
>
> On Tue, Sep 24, 2019 at 10:52 AM Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> >
> > On Tue, Sep 24, 2019 at 04:31:49AM -0500, William Tambe wrote:
> > > I have defined atomic_exchangesi as follow in the machine description:
> > >
> > > (define_insn "atomic_exchangesi"
> > > [(set (match_operand:SI 0 "register_operand" "=r,r")
> > > (match_operand:SI 1 "memory_operand" "+B,W"))
> > > (set (match_dup 1)
> > > (unspec:SI
> > > [(match_operand:SI 2 "register_operand" "0,0")
> > > (match_operand:SI 3 "const_int_operand")]
> > > 0))]
> > > ""
> > > "@
> > > ...
> > > ...")
> >
> > Don't use "+", just use matching constraints, like the "0" you already
> > have, but then "1"? Like
> >
> > (define_insn "atomic_exchangesi"
> > [(set (match_operand:SI 0 "register_operand" "=r,r")
> > (match_operand:SI 1 "memory_operand" "B,W"))
> > (set (match_operand:SI 2 "memory_operand" "=1,1")
> > (unspec:SI
> > [(match_operand:SI 3 "register_operand" "0,0")
> > (match_operand:SI 4 "const_int_operand")]
> > 0))]
> >
> Per https://gcc.gnu.org/onlinedocs/gccint/Standard-Names.html ,
> atomic_exchangesi only has 4 operands instead of 5 operands as it is the
> case in your example.
>
> I did try the following, but I get "repeated operand number 1"
>
> (define_insn "atomic_exchangesi"
> [(set (match_operand:SI 0 "register_operand" "=r,r")
> (match_operand:SI 1 "memory_operand" "B,W"))
> (set (match_operand:SI 1 "memory_operand" "=1,1")
> (unspec:SI
> [(match_operand:SI 2 "register_operand" "0,0")
> (match_operand:SI 3 "const_int_operand")]
> 0))]
> ""
> "@
> ...
> ...")
>
> Any other suggestions that I could try ?
>
> >
> > Segher
I'm also a noob, but I'd try:
(define_insn "atomic_exchangesi"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(match_dup 2))
(set (match_operand:SI 2 "memory_operand" "=B,W")
(unspec:SI
[(match_dup 0)
(match_operand:SI 4 "const_int_operand")]
0))]
""
"@
...
...")
And if this still does not work, don't use match_dup, define 5 operands (0..4) and add a condition to force equality of 1==2 and 0==3:
(define_insn "atomic_exchangesi"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(match_operand:SI 1 "memory_operand" "B,W"))
(set (match_operand:SI 2 "memory_operand" "=B,W")
(unspec:SI
[(match_operand:SI 3 "register_operand" "=r,r")
(match_operand:SI 4 "const_int_operand")]
0))]
"operands[0] == operands[3] && operands[1] == operands[2]"
"@
...
...")
...
Bebbo
More information about the Gcc-help
mailing list