[Bug inline-asm/47419] missed 'mov (base,index,scale),reg' optimization?
pluto at agmk dot net
gcc-bugzilla@gcc.gnu.org
Sun Jan 23 13:32:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47419
--- Comment #3 from Pawel Sikora <pluto at agmk dot net> 2011-01-23 13:02:02 UTC ---
(In reply to comment #2)
> Well there is no constraint for reg+reg*N really. You should do:
> asm /* reading has side-effects in hardware */ volatile (
> "movl %1, %0"
> : /* output operands */ "=r" ( value )
> : /* input operands */ "m" ( *(address + index) )
> : /* clobbers */
> );
>
>
> This will be the correct way of expressing it and not to mention will produce
> the code you want.
thanks, this assembly with "m" constraint produces one nice move i need.
> Though you might as well just do:
> unsigned __attribute__((regparm(2)))
> asm_read_mapped_register( unsigned* address, unsigned long index )
> {
> volatile *unsigned a = address + index;
> return *a;
> }
this access via volatile pointer produces unoptimal lea+mov combo.
i'll stay with improved asm inline.
More information about the Gcc-bugs
mailing list