This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
gcc inline asm
- From: Rokas Masiulis <roma1390 at uosis dot mif dot vu dot lt>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 13 Aug 2007 11:40:32 +0300
- Subject: gcc inline asm
Hello,
gcc 3.4.6
binlutils 2.17
i having problem to pass pointer to inline block
test.c file:
-------------------------
void foo(void)
{
int y;
register int z;
asm("nop" : : ); /* simple marker */
asm("pause;movl %1,%0" : "=b" (z) : "o" (&y+100)); /* test case */
asm("pause;movl 0x184(%%ebp), %%ebx" : :); /* valid instruction */
asm("nop" : : ); /* simple marker */
}
-------------------------
objdump:
...
7: 90 nop # marker
8: 8d 85 84 01 00 00 lea 0x184(%ebp),%eax
e: 89 45 f8 mov %eax,0xfffffff8(%ebp)
11: f3 90 pause # marker
13: 8b 5d f8 mov 0xfffffff8(%ebp),%ebx
16: f3 90 pause # marker
18: 8b 9d 84 01 00 00 mov 0x184(%ebp),%ebx
1e: 90 nop # marker
...
-------------------------
expected result:
nop # marker
pause # marker
mov 0x184(%ebp), %ebx
pause # marker
mov 0x184(%ebp), %ebx
nop # marker
How to make it to compile to this code?
---------
I can't put (&y+100) to register becouse it uses another one
register. This register have another meaning on begining of the inline block.
roma1390
p.s. i tried also other Constraints:
"o" - warning: use of memory input without lvalue in asm operand 1 is deprecated
"m" - warning: use of memory input without lvalue in asm operand 1 is deprecated
"p" - error: invalid `asm': invalid expression as operand
"i" - warning: asm operand 1 probably doesn't match constraints
error: impossible constraint in `asm'
warning: 'z' might be used uninitialized in this function
"r" - no warning/error
uneeded register usage/register presure