Re: [patch 06/10] Immediate Value - i386 Optimization

H. Peter Anvin
2007-07-03T21:30:56Z

Chuck Ebbert wrote:
> On 07/03/2007 04:18 PM, H. Peter Anvin wrote:
>> One could, though, use an indirect jump to achieve, if not as good, at
>> least most of the effect:
>>
>> movl $<patchable>,<reg>
>> jmp *<reg>
>>
>
> Yeah, but there's this GCC bug:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22448
>
> You can't even dereference labels in an ASM statement.

I wouldn't to that, though, for the existing compiler. Instead, I
would do:

void (*func)(void); /* or what's appropriate */
asm(<magic movl> : "=rm" (func));
func();

-hpa