Re: [patch 4/7] Immediate Values - i386 Optimization

Andi Kleen
2007-10-22T09:59:56Z

> - Either I use a "r" constraint and let gcc produce the instructions,
> that I need to assume to have correct size so I can align their
> immediate values (therefore, taking the offset from the end of the
> instruction will not help). Here, if gas changes its behavior
> dramatically for a given immediate value size, it will break.

I wouldn't expect it to do that, but you could perhaps add a self
test somewhere to check for it.

>
> - Second choice is to stick to a particular register, choosing the one
> with the less side-effect, and encoding the instruction ourselves. I
> start to think that this second solution might be safer, even though
> we wouldn't let the compiler select the register which has the less
> impact by itself.

Such effects caused occassional bugs in the alternative() implementation
which requires a maximum size for the replacement.

But in this case it should be safe enough to trust gas stability.

-Andi