Part Number: BEAGLEBN
Tool/software: TI C/C++ Compiler
Hi,
I noticed a code generation inconsistency with TI PRU compiler v2.2.1 for a specific corner case.
struct A { }; struct A a; unsigned test_add(unsigned a, struct A s, unsigned b) { return a + b; }
Produces, as expected, references to R14 and R15:
||test_add||: ADD r14, r14, r15 ; [ALU_PRU] |32| a,b JMP r3.w2 ; [ALU_PRU]
But when calling such a function:
extern unsigned test_add2(unsigned a, struct A s, unsigned b); void test_call(void) { test_add2(1, a, 2); }
the second int argument is passed in R16:
||test_call||: SUB r2, r2, 0x02 ; LDI r14, 0x0001 ; ZERO &r15, 4 ; LDI r16, 0x0002 ; <---- Should have been R15 SBBO &r3.b2, r2, 0, 2 ; JAL r3.w2, ||test_add2|| ; LBBO &r3.b2, r2, 0, 2 ; ADD r2, r2, 0x02 ; JMP r3.w2 ;
Regards,
Dimitar