Hi,

That was quick :)

> Your asm has no output operands and no side effects, with more
> aggressive optimization the whole ask would disappear.
Sorry, that was just a small test file, the original code has output operands.

The new test code:
 static int inline f1(int arg)
 {
   register int ret asm("r1");
   register int a1 asm("r8") = 10;
   register int a2 asm("r1") = arg;

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

   return ret;
 }

 int f2(int arg1, int arg2)
 {
   return f1(arg1 >> 10);
 }

translates to the same assembly:
f2:
        addi     sp, sp, -4
        sw       (sp+4), ra
        addi     r2, r0, 10
        calli    __ashrsi3
        scall
        lw       ra, (sp+4)
        addi     sp, sp, 4
        b        ra

PS. R1 is the return register in the target architecture ABI.

-- 
Michael

Reply via email to