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/TMS320F28377S: compiler output wrong code when float point compare to zero

Part Number: TMS320F28377S


Tool/software: TI C/C++ Compiler

source as below:

float A, B;

int main(void)

{

if(A >= 0) B = 0;

return 0;

}

I use compiler V18.1.1.LTS and get the wrong result as below:

MOV32     R0H,@_A

MOVB      AL,#0

MINF32    R0H,#0

MOV32     @_B,R0H

...

if I use compiler V6.4.12, I get the right result:

MOV32     R0H,@_A

CMPF32    R0H,#0

MOVST0    ZF, NF

BF        $C$L1,LT

ZERO      R0H

MOV32     @_B,R0H

$C$L1:   

MOVB      AL,#0

...

why?