/* Compile branch test like this: mipsel-linux-gcc -Os -g btest.c btest2.S Original code failing with emulation: 218: 8d090000 lw t1,0(t0) 21c: 31290001 andi t1,t1,0x1 220: 1120fffd beqz t1,0x218 224: 03e00008 jr ra 228: 3c088000 lui t0,0x8000 22c: 3c093c1a lui t1,0x3c1a AR7 router: # ./a.out 0 1100 1000 qemu-system-mipsel (unmodified): # ./a.out 0 # (program hangs) qemu-system-mipsel (unmodified): # ./a.out 0 1221 1221 */ #include extern int test1(int i); extern int test2(int i); int main(void) { int i = 0; printf("%d\n", i); i = test1(0); printf("%d\n", i); i = test2(0); printf("%d\n", i); return 0; }