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.

Compiler/TMS320F28379D: Upper 32bit of a 32*32 bit multiplication (1)

Part Number: TMS320F28379D

Tool/software: TI C/C++ Compiler

In my former post the attachment was missing.

Dokument2.pdf

  • Part Number: TMS320F28379D

    Tool/software: TI C/C++ Compiler

    Hello,

    I want to calculate the product of two 32 bit signed long variables (lt1, lt2). From the 64 bit result only the upper 32 bits are needed.

     

    The following code works, but contain additional instructions (IMPYL, MOV @T, ASR64 …)

     

     The instruction QMPYL alone would deliver already exact the desired value.

     

    Is it possible to write the C-code in this way, that only the QMPYL instruction is generated from the compiler?

     

     

    Thank you very much

    Ralf

  • Ralf,

    I don't believe there is a way to do what you ask.  The compiler does not recognize that the IMPY is negated by the ASR #32 (shift right by 32).  It leaves both of them in there.

    Regards,

    David

  • Hello David,

    thanks for your response.

     

    May be I have found a way to perform the desired calculation. In chapter 7.6 is a list of intrinsic instructions. With the code

     

    lt3=__IQmpy(lt1,lt2,32)

      

    it seems to be working. The first tests were positive.

     

    Can those intrinsic instructions be used anywhere in the code without destroying the C runtime environment?

     

     

    Best regards

    Ralf

     

  • Ralf,

    Good find.  I had checked the intrinsics but didn't catch this one.  It should work.  Yes, you can use intrinsics without destroying the C runtime environment.

    Regards,

    David