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.

TMS320F28P650DH: Questions on EABI VS COFF

Part Number: TMS320F28P650DH

Tool/software:

Hi BU experts,

Here I have serveral detailed question on EABI and COFF difference from customer, could you please help clarifying them?

1. In the C codes, is suffix "f" represent float and "l" represent long double? 

2. When using FPU64 with EABI double(64 bit) vs FPU32 with COFF double (32 bit), which is faster? is there a comparison file?

3. Is there any document on FPU32 vs FPU64?

4, Regarding on the --fp_mode option. When using relaxed mode vs strict mode, is there a benchmark on precision and performance impact?

Regards,

Hang

  • Hello,

    I brought this thread to the attention of the compiler experts for further assistance.

    Thanks

    ki

  • In the C codes, is suffix "f" represent float and "l" represent long double? 

    I presume you refer to the suffixes that can be written after a floating point constant like 123.456.  The answer is yes.  This is true for both COFF and EABI.

    When using FPU64 with EABI double(64 bit) vs FPU32 with COFF double (32 bit), which is faster?

    The difference is very small.  This answer presumes you execute on a C28x CPU that has an instruction that can perform the floating point operation specified in the C code.  For instance, if you write a+b, and both variables are type long doublethen the C28x CPU is presumed to have an instruction that can perform a 64-bit floating point addition.

    is there a comparison file?

    No.

    Regarding on the --fp_mode option. When using relaxed mode vs strict mode, is there a benchmark on precision and performance impact?

    Unfortunately, there is no benchmark.  However, there is an article which discusses --fp_mode, and it may be helpful.  Please search the article Floating Point Optimization for --fp_mode.

    Thanks and regards,

    -George

  • Hi George,

    Thanks for the timely response! 

    This answer presumes you execute on a C28x CPU that has an instruction that can perform the floating point operation specified in the C code.

    Do you mean C28x CPU that has FPU64? They are using F28P65, so I think the CPU would have the instruction for basic math (they may refer to instruction set for specific instructions) correct?

    If they use float as parameter of a function that has a double parameter type. For example:

    double add(double A, double B){return A+B;}
    flaot x = 1.0;
    x = add(x,x);

    There would be type conversion (by means of calling FS$$TOFD and FD$$TOFS )when calling the function and returning, which takes extra time, correct? If x is a double in the above code, it would be faster?

    Additionally, is there a document on #3?

    3. Is there any document on FPU32 vs FPU64?

    Thanks,

    Hang.

  • Do you mean C28x CPU that has FPU64?

    Yes, for the case where the C code specifies 64-bit floating point operations.  One example would be operations of type double and EABI is used.

    They are using F28P65, so I think the CPU would have the instruction for basic math (they may refer to instruction set for specific instructions) correct?

    Compiler experts like me do not keep track of what hardware features are available on a specific devices.  I took a quick look at the datasheet, and it appears you are correct.

    There would be type conversion

    Yes.

    (by means of calling FS$$TOFD and FD$$TOFS )

    No.  There are instructions for converting between 64-bit and 32-bit floating point representations.

    If x is a double in the above code, it would be faster?

    Yes.  But only by a few cycles.

    I'm sorry I overlooked this question ...

    Is there any document on FPU32 vs FPU64?

    The compiler team never published anything.  And I've never seen anything myself.  

    Thanks and regards,

    -George

  • Hi George,

    Although you said

    No.  There are instructions for converting between 64-bit and 32-bit floating point representations
    Yes.  But only by a few cycles.

    I had example code from customer that the type conversion is done by means of calling functions and take lots cycles and result in a large performance difference. Could you help explain the difference here? 

    The code is:

    #define MAINS_SAMPLING_FREQ_HZ    19200.0L
    
    #define DCBUS_MAINS_SAMPLING_STEP_US  (F32)(1000000.0L/MAINS_SAMPLING_FREQ_HZ);
    // vs
    //#define DCBUS_MAINS_SAMPLING_STEP_US  (1000000.0L/MAINS_SAMPLING_FREQ_HZ); // without (F32)
    
    float x;
    x += DCBUS_MAINS_SAMPLING_STEP_US

    They are comparing the macro with or without the (F32) conversion statement.

    When with the F32 conversion, they got the assembly:

    Without the F32 conversion statement, they got the assembly:

    Not only it's longer, it also contains LCR that takes even more cycles.

  • Please prepare a test case that uses both variants of the macro DCBUS_MAINS_SAMPLING_STEP_US in a manner similar to how it appears in the actual application.  One variant uses the cast to F32, the other does not.  This test case only needs to be a single C file that compiles into one object file.  It does not need to run.  Build it with the compiler option --src_interlist.  This causes the compiler to keep the auto-generated assembly file.  This file has the same name as the source file, with the extension changed to .asm.  Inspect this assembly file to be sure it generates the code you show in the screenshots from the last post.  For this test case, please submit all the details described in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George