[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/Altivec/casts.c

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 28 14:28:49 PST 2006



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

casts.c added (r1.1)
---
Log message:

Random testcase from my collection


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

 casts.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+)


Index: llvm-test/SingleSource/UnitTests/Vector/Altivec/casts.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Vector/Altivec/casts.c:1.1
*** /dev/null	Tue Mar 28 16:28:47 2006
--- llvm-test/SingleSource/UnitTests/Vector/Altivec/casts.c	Tue Mar 28 16:28:37 2006
***************
*** 0 ****
--- 1,30 ----
+ #include <altivec.h>
+ #include <stdio.h>
+ 
+ typedef union {
+  float f[4];
+  vector float v;
+ } floatToVector;
+ 
+ 
+ void test(float F, vector float *R) {
+    floatToVector FTV;
+    FTV.f[0] = F;
+    *R = (vector float) vec_splat((vector unsigned int)FTV.v, 0);
+ }
+ 
+ void test2(float F, vector float *R) {
+    *R = (vector float)(F);
+ }
+ void test2a(float F, vector float *X, vector float *R) {
+    *R = (vector float)(F) + *X;
+ }
+ 
+ 
+ int main() {
+   floatToVector X;
+   int i;
+   test(12.34, &X.v);
+ 
+   printf("%f %f %f %f\n", X.f[0], X.f[1], X.f[2], X.f[3]);
+ }






More information about the llvm-commits mailing list