[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/factor.c

Reid Spencer reid at x10sys.com
Sat Nov 25 19:42:40 PST 2006



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

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

A new test case for testing truncate to bool.


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

 factor.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+)


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/factor.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/factor.c:1.1
*** /dev/null	Sat Nov 25 21:42:36 2006
--- llvm-test/SingleSource/UnitTests/SignlessTypes/factor.c	Sat Nov 25 21:42:26 2006
***************
*** 0 ****
--- 1,44 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ #define PLANE_SIZE 50
+ static char plane[PLANE_SIZE];
+ 
+ void fill() {
+   /* Fill the plane with the bit mask for remainders */
+   unsigned i;
+   for (i = 0; i < PLANE_SIZE; ++i ) {
+     plane[i] = 0;
+     if (i % 17 == 0)
+       plane[i] |= 128;
+     if (i % 13 == 0)
+       plane[i] |= 64;
+     if (i % 11 == 0)
+       plane[i] |= 32;
+     if (i % 7 == 0)
+       plane[i] |= 16;
+     if (i % 5 == 0)
+       plane[i] |= 8;
+     if (i % 3 == 0)
+       plane[i] |= 4;
+     if (i % 2 == 0)
+       plane[i] |= 2;
+     plane[i] |= 1;
+   }
+ }
+ 
+ int
+ main(int argc, char **argv)
+ {
+   unsigned i;
+ 
+   fill();
+ 
+   for (i = 0; i < PLANE_SIZE; i++) {
+     if (plane[i] & 0x10)
+         printf("%d ", i);
+   }
+   printf("\n");
+ 
+   return 0;
+ }






More information about the llvm-commits mailing list