IBM Support

IV65273: COMPILER DOES NOT USE VECTOR OPS FOR MEMSET

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • xlC does not take the opportunity to use vector splat immediate
    for memset.
    For input values -16..+15 for second parameter a single vspltisb
    instruction can be used to construct a vector.
    
    ===== COMPILE COMMAND:
    xlC -q64 -O2 -qlist test.cpp -qarch=pwr7 -qaltivec
    
    ===== TESTCASE:
    $ cat test.cpp
    #include <builtins.h>
    #include <string.h>
    
    void memset16(void *out)
    {
       __alignx(4,out);
       memset(out, 0, 16);
    }
    $
    
    
    ===== ACTUAL OUTPUT:
      VR's set/used:   ---- ---- ---- ----  ---- ---- ---- ----
         | 000000                           PDEF     memset16(void
    *)
         | 000000                           AKA       memset16__FPv
        4|                                  PROC      out,gr3
      398| 000000 addi     38000000   1     LI        gr0=0
      398| 000004 std      F8030000   1     ST8
    (char)(gr3,0)=gr0
      398| 000008 std      F8030008   1     ST8
    (char)(gr3,8)=gr0
        8| 00000C bclr     4E800020   1     BA        lr
         |               Tag Table
         | 000010        00000000 00092000 00000000 00000010
         |               Instruction count            4
    
    
    
    ===== EXPECTED OUTPUT:
    The output could also look like:
    xxlxor 0,0,0
    stvd2x 0,0,<out>
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users who use memset are affected by this issue.
    
    PROBLEM DESCRIPTION:
    The compiler was generating inefficient code for memset code
    when -qarch=pwr7 was specified.
    

Problem conclusion

  • The compiler has been fixed so that when changing memset into
    vector instructions, the compiler uses two other instructions
    for edge cases to generate 0x00 and 0xff to have one cycle saved
    on power 7.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV65273

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5725C7100

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2014-09-26

  • Closed date

    2014-09-26

  • Last modified date

    2014-09-26

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

    IV63941

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

    LI78244

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels

  • RD10 PSY

       UP

[{"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":"13.1"}]

Document Information

Modified date:
01 October 2021