This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/47419] missed 'mov (base,index,scale),reg' optimization?
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Jan 2011 10:22:39 +0000
- Subject: [Bug inline-asm/47419] missed 'mov (base,index,scale),reg' optimization?
- Auto-submitted: auto-generated
- References: <bug-47419-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47419
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-01-23 10:22:37 UTC ---
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. 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;
}
---- CUT -----
The constraint r just means register and nothing else can match it.