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

Chris Lattner lattner at cs.uiuc.edu
Mon Apr 3 23:50:37 PDT 2006



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

multiplies.c added (r1.1)
helpers.h updated: 1.4 -> 1.5
---
Log message:

new testcase for multiplies


---
Diffs of the changes:  (+50 -0)

 helpers.h    |   16 ++++++++++++++++
 multiplies.c |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)


Index: llvm-test/SingleSource/UnitTests/Vector/multiplies.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Vector/multiplies.c:1.1
*** /dev/null	Tue Apr  4 01:50:34 2006
--- llvm-test/SingleSource/UnitTests/Vector/multiplies.c	Tue Apr  4 01:50:24 2006
***************
*** 0 ****
--- 1,34 ----
+ #include "helpers.h"
+ 
+ #define ARRAYSIZE 100000
+ double TheArray[ARRAYSIZE];
+ 
+ #define ProcessArray(VECTY) {     \
+   VECTY V = (VECTY)((v4i32){0,0,0,0}); \
+   VECTY *AP = (VECTY*)TheArray;   \
+   IV vu;                          \
+   for (j = 0; j < 1000; ++j) \
+   for (i = 0; i != sizeof(TheArray)/sizeof(VECTY); ++i) \
+     V *= AP[i];    \
+   vu.V = (v4i32)V;        \
+   printIV(&vu);    \
+ }
+ 
+ 
+ int main(int argc, char **Argv) {
+   unsigned i, j;
+   for (i = 0; i < ARRAYSIZE; ++i)
+     TheArray[i] = i*12.345;
+ 
+   ProcessArray(v16i8);
+   ProcessArray(v8i16);
+   ProcessArray(v4i32);
+   ProcessArray(v2i64);
+   
+   // These break native gcc.  :(
+ #if 0
+   ProcessArray(v4f32);
+   ProcessArray(v2f64);
+ #endif
+ }
+ 


Index: llvm-test/SingleSource/UnitTests/Vector/helpers.h
diff -u llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.4 llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.5
--- llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.4	Thu Mar 30 20:11:46 2006
+++ llvm-test/SingleSource/UnitTests/Vector/helpers.h	Tue Apr  4 01:50:24 2006
@@ -7,6 +7,18 @@
 typedef float  v8sf __attribute__ ((__vector_size__ (32)));
 typedef double v8sd __attribute__ ((__vector_size__ (64)));
 
+typedef int    v2i64 __attribute__ ((__vector_size__ (16)));
+typedef int    v4i32 __attribute__ ((__vector_size__ (16)));
+typedef short  v8i16 __attribute__ ((__vector_size__ (16)));
+typedef char   v16i8 __attribute__ ((__vector_size__ (16)));
+typedef float  v4f32 __attribute__ ((__vector_size__ (16)));
+typedef double v2f64 __attribute__ ((__vector_size__ (16)));
+
+typedef union {
+  v4i32 V;
+  int A[4];
+} IV;
+
 typedef union {
   v4sf V;
   float A[4];
@@ -22,6 +34,10 @@
   double A[8];
 } D8V;
 
+static void printIV(IV *F) {
+	printf("%u %u %u %u\n", F->A[0], F->A[1], F->A[2], F->A[3]);
+}
+
 static void printFV(FV *F) {
 	printf("%f %f %f %f\n", F->A[0], F->A[1], F->A[2], F->A[3]);
 }






More information about the llvm-commits mailing list