summaryrefslogtreecommitdiffstats
path: root/clang/lib/Headers/altivec.h
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2014-06-06 23:12:00 +0000
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>2014-06-06 23:12:00 +0000
commit7f0a5c5141b598dbf9dcca2a4a21af78547782b0 (patch)
tree1316e3125a1e6caa47352a169b52ff2f5d2630cc /clang/lib/Headers/altivec.h
parentc36103769e30e061842a19a1d7dcd92a5855f2ba (diff)
downloadbcm5719-llvm-7f0a5c5141b598dbf9dcca2a4a21af78547782b0.tar.gz
bcm5719-llvm-7f0a5c5141b598dbf9dcca2a4a21af78547782b0.zip
[PPC64LE] Update builtins-ppc-altivec.c for PPC64 and PPC64LE
The Altivec builtin test case test/CodeGen/builtins-ppc-altivec.c has always been executed only for 32-bit PowerPC. These tests are equally valid for 64-bit PowerPC. This patch updates the test to be run for three targets: powerpc-unknown-unknown, powerpc64-unknown-unknown, and powerpc64le-unknown-unknown. The expected code generation changes for some of the Altivec builtins for little endian, so this patch adds new CHECK-LE variants to the test for the powerpc64le target. These tests satisfy the testing requirements for some previous patches committed over the last couple of days for lib/Headers/altivec.h: r210279 for vec_perm, r210337 for vec_mul[eo], and r210340 for vec_pack. llvm-svn: 210384
Diffstat (limited to 'clang/lib/Headers/altivec.h')
-rw-r--r--clang/lib/Headers/altivec.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index 5719ab019d3..7dfb74e0698 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -8356,10 +8356,26 @@ vec_vsum4shs(vector signed short __a, vector int __b)
/* vec_sum2s */
+/* The vsum2sws instruction has a big-endian bias, so that the second
+ input vector and the result always reference big-endian elements
+ 1 and 3 (little-endian element 0 and 2). For ease of porting the
+ programmer wants elements 1 and 3 in both cases, so for little
+ endian we must perform some permutes. */
+
static vector signed int __attribute__((__always_inline__))
vec_sum2s(vector int __a, vector int __b)
{
+#ifdef __LITTLE_ENDIAN__
+ vector int __c = (vector signed int)
+ vec_perm(__b, __b, (vector unsigned char)
+ (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
+ __c = __builtin_altivec_vsum2sws(__a, __c);
+ return (vector signed int)
+ vec_perm(__c, __c, (vector unsigned char)
+ (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
+#else
return __builtin_altivec_vsum2sws(__a, __b);
+#endif
}
/* vec_vsum2sws */
@@ -8367,7 +8383,17 @@ vec_sum2s(vector int __a, vector int __b)
static vector signed int __attribute__((__always_inline__))
vec_vsum2sws(vector int __a, vector int __b)
{
+#ifdef __LITTLE_ENDIAN__
+ vector int __c = (vector signed int)
+ vec_perm(__b, __b, (vector unsigned char)
+ (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
+ __c = __builtin_altivec_vsum2sws(__a, __c);
+ return (vector signed int)
+ vec_perm(__c, __c, (vector unsigned char)
+ (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
+#else
return __builtin_altivec_vsum2sws(__a, __b);
+#endif
}
/* vec_sums */
OpenPOWER on IntegriCloud