This is the mail archive of the gcc-bugs@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]

[Bug inline-asm/47419] missed 'mov (base,index,scale),reg' optimization?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47419

--- Comment #1 from Pawel Sikora <pluto at agmk dot net> 2011-01-23 09:36:57 UTC ---
(In reply to comment #0)
> following code...
> 
> unsigned __attribute__((regparm(2)))
> asm_read_mapped_register( unsigned* address, unsigned long index )
> {
>         unsigned value;
>         asm /* reading has side-effects in hardware */ volatile (
>                 "movl (%1), %0"
>                 : /* output operands */ "=r" ( value )
>                 : /* input operands */ "r" ( address + index )

btw.                                     ^^^ changing "r" to "g" doesn't help.

>                 : /* clobbers */
>         );
>         return value;
> }
> 
> produces...
> 
> asm_read_mapped_register:
>         leaq (%rdi,%rsi,4), %rax
>         movl (%rax), %eax
>         ret
> 
> is it a bug in asm inline? why the 'movl (%rdi,%rsi,4),%eax' isn't emitted?


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