0

I'm having trouble understanding a warning from IBM XL C/C++. I'm working on GCC119 from the compile farm, which is a AIX ppc64-be machine.

$ cat test.cxx
#if defined(__ALTIVEC__)
# include <altivec.h>
# undef vector
# undef pixel
# undef bool
#endif

__vector unsigned char VecLoad(unsigned char data[])
{
    return vec_ld(0, data);
}

Compiling it results in:

$ xlC -qarch=pwr5 -qaltivec test.cxx -c
1540-2142 (W) "-qaltivec" is not compatible with "-qarch=pwr5". "-qnoaltivec" is being set.
"test.cxx", line 8.10: 1540-0040 (S) The text "unsigned" is unexpected.  "__vector" may be undeclared or ambiguous.

Removing the -qarch does not resolve the issue as the compiler defaults to -qarch=pwr4.

I only see this problem on the AIX machine using the XLC compiler. GCC is OK on the same machine. And two other machines I use for testing are OK. In fact the AIX machine is an S822, and an identical S822 running Linux with XLC installed is OK.

What is the problem and how do I fix it? Why can't we engage Altivec with POWER5 on AIX with XLC?

jww
  • 97,681
  • 90
  • 411
  • 885
  • 1
    You could try `-qarch=pwr6` as AltiVec was intoduced in Power6 – Lorinczy Zsigmond Aug 05 '18 at 14:51
  • Thanks @Lorinczy. Correct me if I am wrong, but I believe Altivec predates POWER4, no? Or is this just an XLC limitation I am hitting? – jww Aug 05 '18 at 19:03
  • You might want to read this: https://en.m.wikipedia.org/wiki/AltiVec – Lorinczy Zsigmond Aug 05 '18 at 20:15
  • 1
    XLC lists the `-qarch` values that support vector on [this Knowledge Center page in Table 1](https://www.ibm.com/support/knowledgecenter/SSGH3R_13.1.3/com.ibm.xlcpp1313.aix.doc/compiler_ref/opt_arch.html) - see the column for "Vector processing support". `pwr5` is not supported, but `pwr6` is. – Nicole Trudeau Aug 06 '18 at 17:40
  • Thanks @Nicole. I guess the combinations used by XLC are due to OpenPOWER specification. I have an old PowerMac G5 with a POWER4 processor which provides an Altivec coprocessor. For the PowerMac, trying to use `-mcpu=power6 -maltivec` results in a compile error because the toolchain is so old. – jww Aug 06 '18 at 18:06
  • @jww You might give this a try: `-qaltivec -qarch=ppc970 or -qaltivec -qarch=auto`. If that doesn't work, I think you are out of luck, sorry! – Nicole Trudeau Aug 13 '18 at 15:23
  • @Nicole, you may as well answer and state IBM does not support the combination because OpenPOWER lacked the specification. I believe that is the root of the troubles. – jww Sep 18 '18 at 19:20

0 Answers0