IBM Support

IV43942: INEFFICIENT DOUBLE TO 32-BIT UNSIGNED INT CONVERSION

Fixes are available

XL C/C++ for AIX Fix Pack 5 (September 2013 PTF) for 12.1
XL C/C++ for AIX Fix Pack 7 (January 2014 PTF) for 12.1
XL C for AIX Fix Pack 8 (March 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 8 (March 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C/C++ for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C for AIX Fix Pack 5 (September 2013 PTF) for 12.1
XL C for AIX Fix Pack 6 (December 2013 PTF) for 12.1
XL C/C++ for AIX Fix Pack 6 (December 2013 PTF) for 12.1
XL C for AIX Fix Pack 7 (January 2014 PTF) for 12.1
XL C for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 21 (January 2019 Update) for 12.1
XL C for AIX Fix Pack 21 (January 2019 Update) for 12.1

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

    IV43942

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-06-10

  • Closed date

    2013-09-18

  • Last modified date

    2013-09-20

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

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

    LI77577 LI77666

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels

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

Document Information

Modified date:
02 October 2021