Michael Walle schrieb:
Hi list,

consider the following test code:
 static void inline f1(int arg)
 {
   register int a1 asm("r8") = 10;
   register int a2 asm("r1") = arg;

   asm("scall" : : "r"(a1), "r"(a2));
 }

 void f2(int arg)
 {
   f1(arg >> 10);
 }


If you compile this code with 'lm32-gcc -O1 -S -c test.c' (see end of this
email), the a1 = 10; assignment is optimized away.

Your asm has no output operands and no side effects, with more aggressive optimization the whole ask would disappear.

What you want is maybe something like

   asm volatile ("scall" : : "r"(a1), "r"(a2));

Johann

Reply via email to