This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preventing scheduling of normal operations across calls to built-ins


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]