[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/reductions.c reductions.reference_output
Reid Spencer
reid at x10sys.com
Mon May 14 11:04:29 PDT 2007
Changes in directory llvm-test/SingleSource/UnitTests/Integer:
reductions.c added (r1.1)
reductions.reference_output added (r1.1)
---
Log message:
Add test cases for bitwise reduction operators.
---
Diffs of the changes: (+68 -0)
reductions.c | 59 ++++++++++++++++++++++++++++++++++++++++++++
reductions.reference_output | 9 ++++++
2 files changed, 68 insertions(+)
Index: llvm-test/SingleSource/UnitTests/Integer/reductions.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/reductions.c:1.1
*** /dev/null Mon May 14 13:04:18 2007
--- llvm-test/SingleSource/UnitTests/Integer/reductions.c Mon May 14 13:04:08 2007
***************
*** 0 ****
--- 1,59 ----
+ #include "bits.h"
+ #include <stdio.h>
+
+ int test_reduce_or(uint68 x)
+ {
+ unsigned result = reduce(or, x) != 0;
+ printf("reduce(or, x) = %d\n", result);
+ return result;
+ }
+
+ int test_reduce_nor(uint68 x)
+ {
+ unsigned result = reduce(nor, x) != 0;
+ printf("reduce(nor, x) = %d\n", result);
+ return result;
+ }
+
+ int test_reduce_xor(uint68 x)
+ {
+ unsigned result = reduce(xor, x) != 0;
+ printf("reduce(xor, x) = %d\n", result);
+ return result;
+ }
+
+ int test_reduce_nxor(uint68 x)
+ {
+ unsigned result = reduce(nxor, x) != 0;
+ printf("reduce(nxor, x) = %d\n", result);
+ return result;
+ }
+
+ int test_reduce_and(uint68 x)
+ {
+ unsigned result = reduce(and, x) != 0;
+ printf("reduce(and, x) = %d\n", result);
+ return result;
+ }
+
+ int test_reduce_nand(uint68 x)
+ {
+ unsigned result = reduce(nand, x) != 0;
+ printf("reduce(nand, x) = %d\n", result);
+ return result;
+ }
+
+
+ int main(int argc, char** argv) {
+ uint68 x = 0xF0F0F0F0F0F0F0F0ULL;
+ int result = 0;
+ printf("x = ");
+ printBits(x);
+ printf("\n");
+ result =
+ test_reduce_or(x) + test_reduce_nor(x) +
+ test_reduce_xor(x) + test_reduce_nxor(x) +
+ test_reduce_and(x) + test_reduce_nand(x);
+ printf("Sum of reductions of x = %d\n", result);
+ return result;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/reductions.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/reductions.reference_output:1.1
*** /dev/null Mon May 14 13:04:29 2007
--- llvm-test/SingleSource/UnitTests/Integer/reductions.reference_output Mon May 14 13:04:08 2007
***************
*** 0 ****
--- 1,9 ----
+ x = 00001111000011110000111100001111000011110000111100001111000011110000
+ reduce(or, x) = 1
+ reduce(nor, x) = 0
+ reduce(xor, x) = 0
+ reduce(nxor, x) = 1
+ reduce(and, x) = 0
+ reduce(nand, x) = 1
+ Sum of reductions of x = 3
+ exit 3
More information about the llvm-commits
mailing list