Re: libgcc: strange optimization

2011-08-02 Thread Michael Walle
Hi, > To confirm that try -fno-tree-ter. "lm32-gcc -O1 -fno-tree-ter -S -c test.c" generates the following working assembly code: f2: addi sp, sp, -4 sw (sp+4), ra addi r2, r0, 10 calli__ashrsi3 addi r8, r0, 10 scall

Re: libgcc: strange optimization

2011-08-01 Thread Michael Walle
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

libgcc: strange optimization

2011-08-01 Thread Michael Walle
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' (se