public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* question about the constraint modifier '+'
@ 2012-04-04 23:38 Handong Ye
  2012-04-05  0:52 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Handong Ye @ 2012-04-04 23:38 UTC (permalink / raw)
  To: gcc

Hi, I'm new in gcc, and maybe misunderstand the constraint modifier '+'.
As the internal document says, '+' means an inout parameter. In my
mind, it means the instruction both reads and writes the pseudo
register.

Assuming I have a pattern like:

(define_insn "lssu"
   [(set (match_operand:m1 0 ...)
           (unspec:m1 [ (match_operand:SI 1 "register_operand" "+r")
(match_operand:SI 2 ...)] UNSPEC_XXX))]

and I have a sequence of code like

(insn 1 .... (set (reg:SI 100) (...)))
...
(insn 10 ... (set (reg:m1 200) (unspec:m1 [(reg:SI 100) (...)]
UNSPEC_XXX)) 33 {lssu} (nil))
...
(insn 30 ... (set (reg:SI 300) (reg:SI 100)

Can I expect that pseudo reg 100 in insn 30 has the new value written
by insn 10?

My experiments show that this is not true, and pseudo reg 100 in insn
30 still takes the value in insn 1.
Or maybe something else is wrong in our porting ?

--
Thanks.
Handong

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about the constraint modifier '+'
  2012-04-04 23:38 question about the constraint modifier '+' Handong Ye
@ 2012-04-05  0:52 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2012-04-05  0:52 UTC (permalink / raw)
  To: Handong Ye; +Cc: gcc

Handong Ye <yehandong@gmail.com> writes:

> Hi, I'm new in gcc, and maybe misunderstand the constraint modifier '+'.
> As the internal document says, '+' means an inout parameter. In my
> mind, it means the instruction both reads and writes the pseudo
> register.
>
> Assuming I have a pattern like:
>
> (define_insn "lssu"
>    [(set (match_operand:m1 0 ...)
>            (unspec:m1 [ (match_operand:SI 1 "register_operand" "+r")
> (match_operand:SI 2 ...)] UNSPEC_XXX))]
>
> and I have a sequence of code like
>
> (insn 1 .... (set (reg:SI 100) (...)))
> ...
> (insn 10 ... (set (reg:m1 200) (unspec:m1 [(reg:SI 100) (...)]
> UNSPEC_XXX)) 33 {lssu} (nil))
> ...
> (insn 30 ... (set (reg:SI 300) (reg:SI 100)
>
> Can I expect that pseudo reg 100 in insn 30 has the new value written
> by insn 10?
>
> My experiments show that this is not true, and pseudo reg 100 in insn
> 30 still takes the value in insn 1.
> Or maybe something else is wrong in our porting ?

Constraints, like +r, are only used by the register allocator and reload
and friends.  They do not mean anything to the RTL optimizers.  You
should write your RTL to explicitly set values that are changed.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-05  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04 23:38 question about the constraint modifier '+' Handong Ye
2012-04-05  0:52 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).