IV43942: 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

    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

  • RC10 PSY U861595

       UP C



Rate this page:

(0 users)Average rating

Document information


More support for:

XL C for AIX
Compiler

Software version:

12.1

Reference #:

IV43942

Modified date:

2013-09-20

Translate my page

Machine Translation

Content navigation