This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Preventing scheduling of normal operations across calls to built-ins
- From: Mohamed Shafi <shafitvm at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Ayonam Ray <ayonam at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Tue, 21 Feb 2012 20:55:00 +0530
- Subject: Re: Preventing scheduling of normal operations across calls to built-ins
- Authentication-results: mr.google.com; spf=pass (google.com: domain of shafitvm@gmail.com designates 10.68.224.9 as permitted sender) smtp.mail=shafitvm@gmail.com; dkim=pass header.i=shafitvm@gmail.com
- References: <CA+V5N8=s2Q5rdZRYWGqrx=MzuiQySLfC5HbDxJQKAGkKpy54sg@mail.gmail.com> <mcrd398q29l.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
On 21 February 2012 09:14, Ian Lance Taylor <iant@google.com> wrote:
> Ayonam Ray <ayonam@gmail.com> writes:
>
>> I have a set of built-ins implemented using unspec_volatile which set
>> various processor control modes for rounding, overflow, etc.
>> Now what I see is that if I call these builtins in between the
>> arithmetic operations in C code, at -O1 and -O2, it puts together all
>> those calls to the built-ins at the top of the function body and sends
>> all the arithmetic operations below. ?Effectively, the arithmetic
>> operations do not conform to the processor modes that I am setting.
>> The same code works fine at -O0, i.e., the operations are not
>> reordered (as expected).
>
> Your RTL is not expressing the dependencies between these instructions.
> Using UNSPEC_VOLATILE doesn't prevent instructions from moving, it only
> pevents them from being deleted. ?The usual way to express this would be
> to have your process control insns set some fixed register and have your
> match insns refer to that fixed register. ?By set and refer I only mean
> in the RTL, not in the generated assembler code.
>
Ian,
When you say UNSPEC_VOLATILE doesn't prevent instructions from moving,
do you mean to say that such patterns will get reordered by the
scheduler?
Shafi