IBM Support

LI76623: INLINE ISNAN, isinf FUNCTIONs

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • ANSI C function isnan() is not inlined, which provides
    sub-optimal performance. If isnan() is inlined, it will provide
    better performance when software uses NaN values as a "missing
    value" indicator needs a fast check for "missing values".
    Use the test case to see the sub-optimal performance of the
    current non-inlined isnan().
     Can xlc inline isnan() to provide the performance and
    convenience?
    
    
    ===== TESTCASE:
    $cat slowisnan.c
       #include <stdio.h>
       #include <math.h>
    
       int myisnan(double x)
       {
       #ifdef FASTWAY
         return (x) != (x);
       #else
         return isnan(x);
       #endif
       }
    
       int main()
       {
          int i, s;
          s = 0;
          for (i = 0; i < 100*1000*1000; i++)
             s += myisnan(1.2);
          printf("%d\n", s);
          return 0;
       }
    
    ===== WORKAROUND:
    use own function/macro.
    
    ===== ACTUAL OUTPUT:
    On P6:
        * xlc -O           slowisnan.c -lm && timex ./a.out
        * user    0m1.16s
        *
        * xlc -O -DFASTWAY slowisnan.c -lm && timex ./a.out
        * user    0m0.48
    

Local fix

  • use own function/macro.
    

Problem summary

  • PROBLEM DESCRIPTION: Certain functions (such as isnan and
    isinf) in the math library are not inlined, even if they are
    very small.  The overhead of the function call causes them to
    take twice as long as they need to in run time performance.
    
    USERS AFFECTED: Users who call these routines many times in hot
    areas of the code.
    

Problem conclusion

  • The compiler will now inline isnan and isinf.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76623

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5724X1400

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2012-02-06

  • Closed date

    2012-02-06

  • Last modified date

    2012-02-06

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

    IV07277

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5724X1400

Applicable component levels



Document information

More support for: XL C/C++ for Linux

Software version: B10

Reference #: LI76623

Modified date: 06 February 2012