-simple_float_conv


< Compile Options / Optimize Options >

[Format]

-simple_float_conv

[Description]

-

This option omits part of the type conversion processing for the floating type.

-

When this option is selected, the generation code that performs type conversion of the next floating-point number changes.

-

a) Type conversion from 32-bit floating type to unsigned integer type

-

b) Type conversion from unsigned integer type to 32-bit floating type

-

c) Type conversion from integer type to 64-bit floating type via 32-bit floating type

[Example]

-

< a) Type conversion from 32-bit floating type to unsigned integer type>

unsigned long func1(float f)
{
    return ((unsigned long)f);
}
When this option is not specified:
 _func1:
         FCMP   #4F000000H,R1
         BLT    L12
         FADD   #0CF800000H,R1
 L12:
         FTOI   R1,R1
         RTS

-

< b) Type conversion from unsigned integer type to 32-bit floating type>

float func2(unsigned long u)
{
       return ((float)u);
}
 
When this option is not specified:
 _func2:
         BTST   #31,R1
         BEQ    L15
         SHLR   #1,R1,R14
         AND    #1,R1
         OR     R14,R1
         ITOF   R1,R1
         FADD   R1,R1
         BRA    L16
 L15:
         ITOF   R1,R1
 L16:
         RTS

-

< c) Type conversion from integer type to 64-bit floating type via 32-bit floating type>

Does not apply when the dbl_size=8 specification is not valid.

double func3(long l)
 {
       return (double)(float)l;
 }
When this option is not specified:
_func3:
        ITOF    R1,R1
        BRA    __COM_CONVfd
When this option is specified:
        BRA    __COM_CONV32sd
 

[Remarks]

-

When this option is specified, code performance of the relevant type conversion processing is improved. The conversion result may, however, differ from C/C++ language specifications, so take care on this point.

-

This option of c) is invalid when optimize=0.