cbuilt-inxlcaltivec

Is there a XL C builtin for LXVD2X prior to 13.1.4?


I'm working from C/C++ using built-ins. I need the lvd2x instruction to load unaligned data into a VMX register. It looks like lvd2x is available on Power7 and Power8 processors.

GCC provides vec_vsx_ld built-in to perform the task. According to IBM XL C/C++ for Linux, V13.1.5, Chapter 4, Enhancements added in Version 13.1.4:

New built-in functions

The following GCC vector built-in functions are supported:

  • vec_vsx_ld
  • ...

The code is guarded for XL C, so I don't need GCC's built-ins. The problem is, I can't find XL C's built-in for lvd2x:

#if defined(__xlc__) || defined(__xlC__)
    uint8x16_p8 block = vec_vsx_ld(0, t);
#else
    uint64x2_p8 block = (uint64x2_p8)vec_vsx_ld(0, t);
#endif

The GCC compile farm provides AIX with XL C v13.1.3 (5725-C72, 5765-J07). Is there a XL C builtin for LXVD2X prior to 13.1.4? If there is a built-in, then what is it? If not, then how do we gain access to the instruction?

(I'm trying to avoid ASM and inline ASM. I don't know enough about the processor to write it. I've also had a fairly unpleasant experience, and I don't want to amplify the pain by trying to use asm).


Solution

  • The portable function that should be implemented by both GCC and XL is vec_xl. It's part of the PPC64-LE ABI.

    The older functions that XLC supported are vec_xld2 (for loading a vector containing 8-byte elements) and vec_xlw4 (for loading a vector containing 4-byte elements.)

    Note that if you require big-endian vector element order, you should use vec_xl_be, or compile with -qaltivec=be.