This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

Compiler/BEAGLEBN: Minor code generation issue with PRU compiler

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

  • Thank you for notifying us of this problem, and submitting a test case.  I can reproduce the problem.  I filed CODEGEN-4180 in the SDOWP system to have this addressed.  You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George


    TI C/C++ Compiler Forum Moderator
    Please click This Resolved My Issue on the best reply to your question
    The CCS Youtube Channel
     has short how-to videos
    The 
    Compiler Wiki answers most common questions
    Track an issue with SDOWP. Enter your bug id in the Search box.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.