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.

intrinsic missing

Hi,

it seems that we miss the _cmpeq intrinsic. It's not listed in the c6x.h while this instruction is available since 62x days ...

Is there a reason why this is missing?

Thanks and regards,

one and zero

  • Not every instruction is made available via an intrinsic.  In general, intrinsics are supplied for instructions which perform operations difficult to represent in C.  As to this specific instruction, I just can't say.  The C62x intrinsics were chosen over 10 years ago.

    Thanks and regards,

    -George

     

  • George,

    thanks for your answer. What I hear you saying is that the compiler does a good job in scheduling the CMPEQ instruction itself so there's no need for the intrinsic.

    I'll turn that statement around and would pose the question: Does it mean all instructions listed as intrinsics are hard to be used by the C-Compiler and therefore target for optimization?

    Thanks and regards,

    one and zero

  • one and zero said:
    Does it mean all instructions listed as intrinsics are hard to be used by the C-Compiler and therefore target for optimization?

    Well, it just isn't that simple.  I think you are combining some concepts that are best kept separate.

    A compiler decomposes the process of generating code into many different phases.  I'll only discuss 2 of them here.  One is instruction selection, and the other is instruction optimization (which itself decomposes into many phases).  During instruction selection, the compiler selects which instructions to use to carry out the operation expressed in the original source.  During optimization, the compiler takes many steps aimed at making those instructions run fast.  Instructions listed as intrinsics are difficult to target in the instruction selection sense.  When it comes to optimization, they are no different than other instructions.

    Thanks and regards,

    -George

     

  • Hi George,

    I think you misunderstood me. I guess I didn't phrase that very well.

    What I tried to say is if the compiler has a hard time selecting instructions they're likely to show up in c6x.h as instrinsic while the instructions that are easy to be selected by the compiler won't be offered as intrinsic.

    So my conclusion was that if you code an algorithm in C and you do e.g. compare 16 or 8 bit values you might want to check if the comiler actually uses the respective instructions (_cmpeq2 and _cmpeq4) and if not use the intrinsics in your C-Code to optimize the performance.

    Do you agree with that?

    Kind regards,

    one and zero

  • one and zero said:
    Do you agree with that?

    Yes.  That's a reasonable way to think about it.

    Thanks and regards,

    -George