Migrating program containing vector built-in functions from big endian systems

When migrating the programs that contain the Vector Multimedia Extension (VMX) and Vector Scalar Extension (VSX) built-in functions from big endian systems, you can use -qaltivec=be or -maltivec=be to minimize program changes, but you need to pay attention in specific cases.

The following table shows what users need to pay attention when migrating code from big endian systems by using -qaltivec=be or -maltivec=be.

Table 1. Attention when -qaltivec=be and -maltivec=be
Case Attention
If the existing program contains only VMX load and store built-in functions Using -qaltivec=be or -maltivec=be may affect the program performance; using -qaltivec=le or -maltivec=le may affect the performance in different ways.
If the existing program contains only VSX load and store built-in functions In the existing programs, you can use the vec_xl and vec_xst functions to replace the VSX load and store built-in functions to maximally simplify the code changes.
If the existing program contains both VMX and VSX load and store built-in functions You need to pay attention to the differences of the element order of vectors that are operated by the VMX and VSX built-in functions in little endian systems.
If the existing program contains the vector initialization by using union with arrays You need to use the vec_ld or vec_xl function to load the vectors explicitly, instead of using the union with arrays, or you can reverse the element order of the array used for vector initialization.
Vector literals Based on the meaning and usage of vector literals, the user must change the code properly.


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us