[test-suite] r223837 - [PowerPC] Fix test case for little endian

Bill Schmidt wschmidt at linux.vnet.ibm.com
Tue Dec 9 13:55:18 PST 2014


Author: wschmidt
Date: Tue Dec  9 15:55:18 2014
New Revision: 223837

URL: http://llvm.org/viewvc/llvm-project?rev=223837&view=rev
Log:
[PowerPC] Fix test case for little endian

The test fixed by this patch uses __builtin_altivec_lvsl and
__builtin_altivec_lvsr, which are not endian-safe interfaces.  For
endian safety, vec_lvsl and vec_lvsr should be used; these perform the
necessary adjustments on the permute control vector to get the correct
results.  This patch corrects the problem.

This went unnoticed until recently because the gcc used for comparison
did not itself properly adjust vec_lvsl and vec_lvsr.  The problem was
discovered when using a more recent, corrected gcc.

Modified:
    test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c

Modified: test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c?rev=223837&r1=223836&r2=223837&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c (original)
+++ test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c Tue Dec  9 15:55:18 2014
@@ -16,10 +16,10 @@ void print_vector(__vector unsigned char
 }
 
 int main(int argc, const char * argv[]) {
-  C_uchar1[0] = (__vector unsigned char)__builtin_altivec_lvsl(1,
-                                                             (void *)&C_uchar1); 
-  C_uchar2[0] = (__vector unsigned char)__builtin_altivec_lvsr(1,
-                                                             (void *)&C_uchar2); 
+  C_uchar1[0] = (__vector unsigned char)
+                  vec_lvsl(1, (const unsigned char *)&C_uchar1); 
+  C_uchar2[0] = (__vector unsigned char)
+                  vec_lvsr(1, (const unsigned char *)&C_uchar2); 
   print_vector(C_uchar1[0]);
   print_vector(C_uchar1[1]);
   print_vector(C_uchar2[0]);





More information about the llvm-commits mailing list