IBM Support

LI77666: INEFFICIENT DOUBLE TO 32-BIT UNSIGNED INT CONVERSION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The compiler does not generate efficient code for double to
    32-bit unsigned int conversion seen in below  test case.
    cat dblToUint32.C
    unsigned int toUint32(double in)
    {
       return (unsigned int)in;
    }
    xlC_r -q64 -O2 -qlist -c dblToUint32.C -qarch=pwr5
    xlC_r -q64 -O2 -qlist -c dblToUint32.C -qarch=pwr7
    Currently, compiler generates:
         | 000000                           PDEF
    toUint32(double)
         | 000000                           AKA       toUint32__Fd
        3|                                  PROC      in,vs1
        0| 000000 mfspr    7C0802A6   1     LFLR      gr0=lr
        0| 000004 stdu     F821FF91   1     ST8U
    gr1,#stack(gr1,-112)=gr1
        0| 000008 std      F8010080   1     ST8
    #stack(gr1,128)=gr0
        5| 00000C bl       4BFFFFF5   1     CALLN
    gr3=__uitrunc,1,vs1,gr1,cr[01567]",gr0",gr4"-gr12",vs0"-vs13",mq
    ",lr",fcr",xer",fsr",ca",ctr",nj",vs0"-vs13",vs32"-vs51"
        5| 000010 ori      60000000   1
        5| 000014 rlwinm   5463003E   1     RN4
    gr3=gr3,0,0xFFFFFFFF
        6| 000018 ld       E9810080   1     L8
    gr12=#stack(gr1,128)
        6| 00001C addi     38210070   1     AI        gr1=gr1,112
        6| 000020 mtspr    7D8803A6   1     LLR       lr=gr12
        6| 000024 bclr     4E800020   1     BA        lr
        6|                              CL.2:
         |               Tag Table
         | 000028        00000000 00092001 80000000 00000028
         |               Instruction count           10
         |               Straight-line exec time     10
    For -qarch=pwr5, fctid[z] instruction is expected.
    For -qarch=pwr7, exploitation of xscvdpuxws is expected.
    

Local fix

  • Modify source code sequence.
    

Problem summary

  • PROBLEM DESCRIPTION: Using library call __uitrunc instead of
    using power 5 and power 7 provided instructions for float to
    unsigned word conversion which produces suboptimal performance.
    
    USERS AFFECTED: Anyone that casts a double to an unsigned int.
    

Problem conclusion

  • Replaced library calls with code generating instructions for
    each of the architectures.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77666

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-10-28

  • Closed date

    2013-10-28

  • Last modified date

    2013-10-28

  • APAR is sysrouted FROM one or more of the following:

    IV43942

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
14 October 2021