Altivec compatibility
This section describes the changes in compiler diagnosis on incompatible vector element order, vector types, and vector built-in functions for IBM Open XL C/C++ for AIX 17.1.4 in comparison to IBM® XL C/C++ for AIX® 16.1.0 or earlier releases.
Compatibility of vector types
Compiler diagnosis on incompatible vector typesIn IBM XL C/C++ for AIX
16.1.0 or earlier
releases, different vector types are incompatible. For example, if a variable of type vector
unsigned int is assigned to another variable of type vector signed int,
the compiler diagnoses the assignment. In IBM Open XL C/C++ for AIX 17.1.4, assignments
between variables of different vector types are not diagnosed by default, which might result in
programming errors. To enable the compiler diagnostic function in IBM Open XL C/C++ for AIX 17.1.4, specify the
-fno-lax-vector-conversions option.
IBM XL C/C++ for AIX
16.1.0 or earlier
releases treat operations on the vector bool and vector pixel
types differently. See the following two examples:
-
Example 1
In IBM XL C/C++ for AIX 16.1.0 or earlier releases, when a variable of the
vector pixelorvector booltype is to be initialized with a scalar value, all elements of the vector variable are initialized with the scalar value. However, the community Clang compiler initializes only the first element of the vector variable with the scalar value while initializes the rest of elements with zero. -
Example 2
In IBM XL C/C++ for AIX 16.1.0 or earlier releases, comparing two
vector boolvariables results in a scalar value. However, this comparison results in a vector variable in the community Clang compiler.
In IBM Open XL C/C++ for AIX 17.1.4, you can control the compiler behavior through the -faltivec-src-compat option. By default, the option value is -faltivec-src-compat=xl in IBM Open XL C/C++ for AIX 17.1.4 and the compiler behaves the same as IBM XL C/C++ for AIX 16.1.0 or earlier releases. However, you can change the compiler behavior to make it consistent with that of the community Clang compiler by specifying the -faltivec-src-compat=mixed option.
Compatibility of vector built-in functions
Built-in function argumentsvec_ctdvec_ctfvec_ctsvec_ctuvec_ctslvec_ctul
Some built-in functions expect the same argument types for two or more arguments. For
example, the prototype of the vec_add(a,b) built-in function requires that argument
b has the same type as argument a. However, in IBM XL C/C++ for AIX
16.1.0 or earlier
releases, the compiler tolerates the mismatching types of a and b.
In IBM Open XL C/C++ for AIX 17.1.4,
the mismatching types are not allowed and the compiler issues an error message for
it.
vec_ctf, vec_cts, and vec_ctu
built-in functions have the following prototypes:vector float vec_ctf(vector signed long long)vector float vec_ctf(vector unsigned long long)vector signed int vec_cts(vector double)vector unsigned int vec_ctu(vector double)
vector double vec_ctf(vector signed long long)vector double vec_ctf(vector unsigned long long)vector signed long long vec_cts(vector double)vector unsigned long long vec_ctu(vector double)
__XL_COMPAT_ALTIVEC__ macro. By default, IBM Open XL C/C++ for AIX 17.1.4 defines the
__XL_COMPAT_ALTIVEC__ macro and provides built-in prototypes that are identical to
those in IBM XL C/C++ for AIX
16.1.0 or earlier
releases. If compatibility with GCC is required, you can undefine this macro by specifying the
-U__XL_COMPAT_ALTIVEC__ option.__XL_COMPAT_ALTIVEC__ undefined by default. Unsupported built-in functions
- In IBM Open XL C/C++ for AIX 17.1.4, use
vec_signextiorvec_signextllas the replacement of thevec_extsbd,vec_extsbw,vec_extshd,vec_extshw, orvec_extswd. vec_xxsldiwas added in IBM XL C/C++ for AIX 16.1.0 invoked by xlclang or xlclang++. In IBM Open XL C/C++ for AIX 17.1.4, usevec_sldwas the replacement ofvec_xxsldi.