[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/sumarray.c helpers.h
Chris Lattner
lattner at cs.uiuc.edu
Tue Mar 21 18:00:34 PST 2006
Changes in directory llvm-test/SingleSource/UnitTests/Vector:
sumarray.c added (r1.1)
helpers.h updated: 1.1 -> 1.2
---
Log message:
Simple vector sum example
---
Diffs of the changes: (+24 -0)
helpers.h | 2 ++
sumarray.c | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
Index: llvm-test/SingleSource/UnitTests/Vector/sumarray.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Vector/sumarray.c:1.1
*** /dev/null Tue Mar 21 20:00:32 2006
--- llvm-test/SingleSource/UnitTests/Vector/sumarray.c Tue Mar 21 20:00:22 2006
***************
*** 0 ****
--- 1,22 ----
+ #include "helpers.h"
+
+ union Array {
+ v4sf Vectors[100];
+ float Floats [400];
+ };
+
+ union Array TheArray;
+
+ void main() {
+ int i;
+ v4sf sum = { 0, 0, 0, 0};
+ FV sumFV;
+ for (i = 0; i < 400; ++i)
+ TheArray.Floats[i] = i*12.345F;
+
+ for (i = 0; i < 100; ++i)
+ sum += TheArray.Vectors[i];
+
+ sumFV.V = sum;
+ printFV(&sumFV);
+ }
Index: llvm-test/SingleSource/UnitTests/Vector/helpers.h
diff -u llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.1 llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.2
--- llvm-test/SingleSource/UnitTests/Vector/helpers.h:1.1 Tue Mar 21 19:48:35 2006
+++ llvm-test/SingleSource/UnitTests/Vector/helpers.h Tue Mar 21 20:00:22 2006
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
typedef float v4sf __attribute__ ((__vector_size__ (16)));
typedef union {
More information about the llvm-commits
mailing list