Part Number: BEAGLEBN
Tool/software: TI C/C++ Compiler
Hi,
According to document SPRUHV7A, section 6.4.1.1 "Layout of Arguments Passed in Registers", structures with sizes 64-bits or less are passed in registers.
But using clpru version v2.1.5 for this C snippet:
struct S7 { char a[7]; };
char test_struct_pass(struct S7 s)
{
return s.a[2];
}
I get the following assembly:
||test_struct_pass||:
;* --------------------------------------------------------------------------*
SUB r2, r2, 0x02 ; [ALU_PRU]
SBBO &r13.b2, r2, 0, 2 ; [ALU_PRU]
LBBO &r13.b2, r2, 2, 7 ; [ALU_PRU] |10| s,s
LBBO &r13.b2, r2, 0, 2 ; [ALU_PRU]
ADD r2, r2, 0x02 ; [ALU_PRU]
JMP r3.w2 ; [ALU_PRU]
The way I read the documentation, I would expect the following code to be generated:
||test_struct_pass||:
;* --------------------------------------------------------------------------*
MOV R14.b0, R14.b2
JMP r3.w2 ; [ALU_PRU]
If the above discrepancy is confirmed, what will TI update - the documentation or the toolchain?
Thanks,
Dimitar