static vector float __ATTRS_o_ai
vec_perm(vector float __a, vector float __b, vector unsigned char __c);
+#ifdef __VSX__
+static vector long long __ATTRS_o_ai
+vec_perm(vector long long __a, vector long long __b, vector unsigned char __c);
+
+static vector unsigned long long __ATTRS_o_ai
+vec_perm(vector unsigned long long __a, vector unsigned long long __b,
+ vector unsigned char __c);
+
+static vector double __ATTRS_o_ai
+vec_perm(vector double __a, vector double __b, vector unsigned char __c);
+#endif
+
static vector unsigned char __ATTRS_o_ai
vec_xor(vector unsigned char __a, vector unsigned char __b);
#endif
}
+/* vec_vpkudum */
+
+#ifdef __POWER8_VECTOR__
+#define __builtin_altivec_vpkudum vec_vpkudum
+
+static vector int __ATTRS_o_ai
+vec_vpkudum(vector long long __a, vector long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return (vector int)vec_perm(__a, __b, (vector unsigned char)
+ (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
+ 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
+#else
+ return (vector int)vec_perm(__a, __b, (vector unsigned char)
+ (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
+#endif
+}
+
+static vector unsigned int __ATTRS_o_ai
+vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return (vector unsigned int)vec_perm(__a, __b, (vector unsigned char)
+ (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
+ 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
+#else
+ return (vector unsigned int)vec_perm(__a, __b, (vector unsigned char)
+ (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
+#endif
+}
+
+static vector bool int __ATTRS_o_ai
+vec_vpkudum(vector bool long long __a, vector bool long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return (vector bool int)vec_perm((vector long long)__a,
+ (vector long long)__b,
+ (vector unsigned char)
+ (0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
+ 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
+#else
+ return (vector bool int)vec_perm((vector long long)__a,
+ (vector long long)__b,
+ (vector unsigned char)
+ (0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
+#endif
+}
+#endif
+
/* vec_packpx */
static vector pixel __attribute__((__always_inline__))
#endif
}
+#ifdef __POWER8_VECTOR__
+static vector int __ATTRS_o_ai
+vec_packs(vector long long __a, vector long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vpksdss(__b, __a);
+#else
+ return __builtin_altivec_vpksdss(__a, __b);
+#endif
+}
+
+static vector unsigned int __ATTRS_o_ai
+vec_packs(vector unsigned long long __a, vector unsigned long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vpkudus(__b, __a);
+#else
+ return __builtin_altivec_vpkudus(__a, __b);
+#endif
+}
+#endif
+
/* vec_vpkshss */
static vector signed char __attribute__((__always_inline__))
#endif
}
+/* vec_vpksdss */
+
+#ifdef __POWER8_VECTOR__
+static vector int __ATTRS_o_ai
+vec_vpksdss(vector long long __a, vector long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vpksdss(__b, __a);
+#else
+ return __builtin_altivec_vpksdss(__a, __b);
+#endif
+}
+#endif
+
/* vec_vpkuhus */
static vector unsigned char __attribute__((__always_inline__))
#endif
}
+/* vec_vpkudus */
+
+#ifdef __POWER8_VECTOR__
+static vector unsigned int __attribute__((__always_inline__))
+vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vpkudus(__b, __a);
+#else
+ return __builtin_altivec_vpkudus(__a, __b);
+#endif
+}
+#endif
+
/* vec_vpkswss */
static vector signed short __attribute__((__always_inline__))
#endif
}
+#ifdef __POWER8_VECTOR__
+static vector unsigned int __ATTRS_o_ai
+vec_packsu(vector long long __a, vector long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vpksdus(__b, __a);
+#else
+ return __builtin_altivec_vpksdus(__a, __b);
+#endif
+}
+
+static vector unsigned int __ATTRS_o_ai
+vec_packsu(vector unsigned long long __a, vector unsigned long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vpkudus(__b, __a);
+#else
+ return __builtin_altivec_vpkudus(__a, __b);
+#endif
+}
+#endif
+
/* vec_vpkshus */
static vector unsigned char __ATTRS_o_ai
#endif
}
+/* vec_vpksdus */
+
+#ifdef __POWER8_VECTOR__
+static vector unsigned int __ATTRS_o_ai
+vec_vpksdus(vector long long __a, vector long long __b)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vpksdus(__b, __a);
+#else
+ return __builtin_altivec_vpksdus(__a, __b);
+#endif
+}
+#endif
+
/* vec_perm */
// The vperm instruction is defined architecturally with a big-endian bias.
#endif
}
+#ifdef __POWER8_VECTOR__
+static vector long long __ATTRS_o_ai
+vec_unpackh(vector int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vupklsw(__a);
+#else
+ return __builtin_altivec_vupkhsw(__a);
+#endif
+}
+
+static vector bool long long __ATTRS_o_ai
+vec_unpackh(vector bool int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
+#else
+ return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
+#endif
+}
+#endif
+
/* vec_vupkhsb */
static vector short __ATTRS_o_ai
#endif
}
+/* vec_vupkhsw */
+
+#ifdef __POWER8_VECTOR__
+static vector long long __ATTRS_o_ai
+vec_vupkhsw(vector int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vupklsw(__a);
+#else
+ return __builtin_altivec_vupkhsw(__a);
+#endif
+}
+
+static vector bool long long __ATTRS_o_ai
+vec_vupkhsw(vector bool int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
+#else
+ return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
+#endif
+}
+#endif
+
/* vec_unpackl */
static vector short __ATTRS_o_ai
#endif
}
+#ifdef __POWER8_VECTOR__
+static vector long long __ATTRS_o_ai
+vec_unpackl(vector int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vupkhsw(__a);
+#else
+ return __builtin_altivec_vupklsw(__a);
+#endif
+}
+
+static vector bool long long __ATTRS_o_ai
+vec_unpackl(vector bool int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
+#else
+ return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
+#endif
+}
+#endif
+
/* vec_vupklsb */
static vector short __ATTRS_o_ai
#endif
}
+/* vec_vupklsw */
+
+#ifdef __POWER8_VECTOR__
+static vector long long __ATTRS_o_ai
+vec_vupklsw(vector int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return __builtin_altivec_vupkhsw(__a);
+#else
+ return __builtin_altivec_vupklsw(__a);
+#endif
+}
+
+static vector bool long long __ATTRS_o_ai
+vec_vupklsw(vector bool int __a)
+{
+#ifdef __LITTLE_ENDIAN__
+ return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
+#else
+ return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
+#endif
+}
+#endif
+
/* vec_vsx_ld */
#ifdef __VSX__
vector int vi = { -1, 2, -3, 4 };
vector unsigned int vui = { 1, 2, 3, 4 };
+vector bool int vbi = {0, -1, -1, 0};
vector bool long long vbll = { 1, 0 };
vector long long vll = { 1, 2 };
vector unsigned long long vull = { 1, 2 };
int res_i;
vector int res_vi;
vector unsigned int res_vui;
+vector bool int res_vbi;
vector long long res_vll;
vector unsigned long long res_vull;
vector bool long long res_vbll;
// CHECK-LE: @llvm.ppc.altivec.vmuleuw
// CHECK-PPC: error: call to 'vec_mulo' is ambiguous
+ /* vec_packs */
+ res_vi = vec_packs(vll, vll);
+// CHECK: @llvm.ppc.altivec.vpksdss
+// CHECK-LE: @llvm.ppc.altivec.vpksdss
+// CHECK-PPC: error: call to 'vec_packs' is ambiguous
+
+ res_vui = vec_packs(vull, vull);
+// CHECK: @llvm.ppc.altivec.vpkudus
+// CHECK-LE: @llvm.ppc.altivec.vpkudus
+// CHECK-PPC: error: call to 'vec_packs' is ambiguous
+
+ /* vec_packsu */
+ res_vui = vec_packsu(vll, vll);
+// CHECK: @llvm.ppc.altivec.vpksdus
+// CHECK-LE: @llvm.ppc.altivec.vpksdus
+// CHECK-PPC: error: call to 'vec_packsu' is ambiguous
+
+ res_vui = vec_packsu(vull, vull);
+// CHECK: @llvm.ppc.altivec.vpkudus
+// CHECK-LE: @llvm.ppc.altivec.vpkudus
+// CHECK-PPC: error: call to 'vec_packsu' is ambiguous
+
/* vec_rl */
res_vll = vec_rl(vll, vull);
// CHECK: @llvm.ppc.altivec.vrld
// CHECK-LE: ashr <2 x i64>
// CHECK-PPC: error: call to 'vec_sra' is ambiguous
+ /* vec_unpackh */
+ res_vll = vec_unpackh(vi);
+// CHECK: llvm.ppc.altivec.vupkhsw
+// CHECK-LE: llvm.ppc.altivec.vupklsw
+// CHECK-PPC: error: call to 'vec_unpackh' is ambiguous
+
+ res_vbll = vec_unpackh(vbi);
+// CHECK: llvm.ppc.altivec.vupkhsw
+// CHECK-LE: llvm.ppc.altivec.vupklsw
+// CHECK-PPC: error: call to 'vec_unpackh' is ambiguous
+
+ /* vec_unpackl */
+ res_vll = vec_unpackl(vi);
+// CHECK: llvm.ppc.altivec.vupklsw
+// CHECK-LE: llvm.ppc.altivec.vupkhsw
+// CHECK-PPC: error: call to 'vec_unpackl' is ambiguous
+
+ res_vbll = vec_unpackl(vbi);
+// CHECK: llvm.ppc.altivec.vupklsw
+// CHECK-LE: llvm.ppc.altivec.vupkhsw
+// CHECK-PPC: error: call to 'vec_unpackl' is ambiguous
+
+ /* vec_vpksdss */
+ res_vi = vec_vpksdss(vll, vll);
+// CHECK: llvm.ppc.altivec.vpksdss
+// CHECK-LE: llvm.ppc.altivec.vpksdss
+// CHECK-PPC: warning: implicit declaration of function 'vec_vpksdss'
+
+ /* vec_vpksdus */
+ res_vui = vec_vpksdus(vll, vll);
+// CHECK: llvm.ppc.altivec.vpksdus
+// CHECK-LE: llvm.ppc.altivec.vpksdus
+// CHECK-PPC: warning: implicit declaration of function 'vec_vpksdus'
+
+ /* vec_vpkudum */
+ res_vi = vec_vpkudum(vll, vll);
+// CHECK: vperm
+// CHECK-LE: vperm
+// CHECK-PPC: warning: implicit declaration of function 'vec_vpkudum'
+
+ res_vui = vec_vpkudum(vull, vull);
+// CHECK: vperm
+// CHECK-LE: vperm
+
+ res_vui = vec_vpkudus(vull, vull);
+// CHECK: llvm.ppc.altivec.vpkudus
+// CHECK-LE: llvm.ppc.altivec.vpkudus
+// CHECK-PPC: warning: implicit declaration of function 'vec_vpkudus'
+
+ /* vec_vupkhsw */
+ res_vll = vec_vupkhsw(vi);
+// CHECK: llvm.ppc.altivec.vupkhsw
+// CHECK-LE: llvm.ppc.altivec.vupklsw
+// CHECK-PPC: warning: implicit declaration of function 'vec_vupkhsw'
+
+ res_vbll = vec_vupkhsw(vbi);
+// CHECK: llvm.ppc.altivec.vupkhsw
+// CHECK-LE: llvm.ppc.altivec.vupklsw
+
+ /* vec_vupklsw */
+ res_vll = vec_vupklsw(vi);
+// CHECK: llvm.ppc.altivec.vupklsw
+// CHECK-LE: llvm.ppc.altivec.vupkhsw
+// CHECK-PPC: warning: implicit declaration of function 'vec_vupklsw'
+
+ res_vbll = vec_vupklsw(vbi);
+// CHECK: llvm.ppc.altivec.vupklsw
+// CHECK-LE: llvm.ppc.altivec.vupkhsw
+
}