[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/helpers.h simple.c

Evan Cheng evan.cheng at apple.com
Thu Mar 23 17:19:12 PST 2006



Changes in directory llvm-test/SingleSource/UnitTests/Vector:

helpers.h updated: 1.2 -> 1.3
simple.c updated: 1.1 -> 1.2
---
Log message:

More tests.


---
Diffs of the changes:  (+49 -9)

 helpers.h |   12 +++++++++++-
 simple.c  |   46 ++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 49 insertions(+), 9 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Vector/helpers.h
diff -u llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.2 llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.3
--- llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.2	Tue Mar 21 20:00:22 2006
+++ llvm-test/SingleSource/UnitTests/Vector/helpers.h	Thu Mar 23 19:18:59 2006
@@ -1,12 +1,22 @@
 #include <stdio.h>
 
-typedef float v4sf __attribute__ ((__vector_size__ (16)));
+typedef float  v4sf __attribute__ ((__vector_size__ (16)));
+typedef double v2sd __attribute__ ((__vector_size__ (16)));
 
 typedef union {
   v4sf V;
   float A[4];
 } FV;
 
+typedef union {
+  v2sd V;
+  double A[2];
+} DV;
+
 static void printFV(FV *F) {
 	printf("%f %f %f %f\n", F->A[0], F->A[1], F->A[2], F->A[3]);
 }
+
+static void printDV(DV *D) {
+	printf("%g %g\n", D->A[0], D->A[1]);
+}


Index: llvm-test/SingleSource/UnitTests/Vector/simple.c
diff -u llvm-test/SingleSource/UnitTests/Vector/simple.c:1.1 llvm-test/SingleSource/UnitTests/Vector/simple.c:1.2
--- llvm-test/SingleSource/UnitTests/Vector/simple.c:1.1	Tue Mar 21 19:48:35 2006
+++ llvm-test/SingleSource/UnitTests/Vector/simple.c	Thu Mar 23 19:18:59 2006
@@ -1,15 +1,45 @@
-
 #include "helpers.h"
 
 int main(int argc, char **Argv) {
+        unsigned i;
 	float X = 1.234;
+	float Y = 9.876;
+        float Z = 1.111;
+        double U = 873.1834;
+        double V = 1842.9028;
+	FV Af, Bf, Cf, Df;
+	DV Ad, Bd;
 	if (argc == 1123) X = 2.38213;
-	FV A;
-        A.V = (v4sf){ X, X, X, X };  // splat
-        A.V = A.V * A.V;
-        printFV(&A);
-        A.V = (v4sf){ X, X, 0, 0 };
-	A.V = A.V+A.V;
-        printFV(&A);
+        if (argc == 1432) Y = 7.71945;
+        if (argc == 2123) U = 32.8219;
+        if (argc == 5123) V = 77.7998;
+
+        for (i = 0; i < 500000; ++i) {
+          Af.V = (v4sf){ X, X, X, X };  // splat
+          Af.V = Af.V * Af.V;
+          
+          Bf.V = (v4sf){ X, X, 0, 0 };
+          Bf.V = Bf.V+Bf.V;
+          
+          Cf.V = (v4sf){ X, X, Y, Y };
+          Cf.V = Cf.V+Cf.V;
+
+          Df.V = (v4sf){ Y, Y, Z, Z };
+          Df.V = Df.V+Df.V;
+
+          Ad.V = (v2sd){ U, U }; // splat
+          Ad.V = Ad.V+Ad.V;
+
+          Bd.V = (v2sd){ U, V };
+          Bd.V = Bd.V+Bd.V;
+        }
+        
+        printFV(&Af);
+        printFV(&Bf);
+        printFV(&Cf);
+        printFV(&Df);
+        printDV(&Ad);
+        printDV(&Bd);
+        return 0;
 }
 






More information about the llvm-commits mailing list