[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c bit_reduce.c bit_reduce.reference_output part_select.c

Reid Spencer reid at x10sys.com
Mon Feb 12 12:58:14 PST 2007



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

bit_concat.c updated: 1.1 -> 1.2
bit_reduce.c updated: 1.1 -> 1.2
bit_reduce.reference_output updated: 1.1 -> 1.2
part_select.c updated: 1.1 -> 1.2
---
Log message:

Update test programs.


---
Diffs of the changes:  (+159 -38)

 bit_concat.c                |    2 
 bit_reduce.c                |   43 +++++++-----
 bit_reduce.reference_output |  150 ++++++++++++++++++++++++++++++++++++++------
 part_select.c               |    2 
 4 files changed, 159 insertions(+), 38 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/bit_concat.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.1 llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/bit_concat.c:1.1	Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_concat.c	Mon Feb 12 14:57:48 2007
@@ -21,7 +21,7 @@
 
 void printBits(ConcatType val, int numbits ) {
   int j;
-  for (j = numbits-1; j >= 0; --j) {
+  for (j = numbits; j > 0; --j) {
     if (__builtin_bit_select(val, j))
       printf("1");
     else


Index: llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c:1.1 llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c:1.1	Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_reduce.c	Mon Feb 12 14:57:48 2007
@@ -16,15 +16,15 @@
 
 #ifdef ENABLE_LARGE_INTEGERS
 typedef int __attribute__((bitwidth(250))) BitType;
-const BitType X = 0xAAAAAAAAAAAAAAAAULL;
+const BitType X = 0xFFFFFFFFFFFFFFFFULL;
 int numbits = 250;
 #else
-typedef int __attribute__((bitwidth(47))) BitType;
-const BitType X = 0xAAAAAAAAAAAAULL;
-int numbits = 47;
+typedef int __attribute__((bitwidth(15))) BitType;
+const BitType X = 0xFFFFFFFFFFFULL;
+int numbits = 15;
 #endif
 
-printBits(BitType val, int numbits ) {
+void printBits(BitType val, int numbits ) {
   int j;
   for (j = numbits-1; j >= 0; --j) {
     if (__builtin_bit_select(val, j))
@@ -34,6 +34,20 @@
   }
 }
 
+void showReduction(BitType Val) {
+  printf("Value=");
+  _Bool And  = __builtin_bit_and_reduce(Val);
+  _Bool Nand = __builtin_bit_nand_reduce(Val);
+  _Bool Or   = __builtin_bit_or_reduce(Val);
+  _Bool Nor  = __builtin_bit_nor_reduce(Val);
+  _Bool Xor  = __builtin_bit_xor_reduce(Val);
+  _Bool Nxor = __builtin_bit_nxor_reduce(Val);
+  printBits(Val, numbits);
+  printf(", and=%d, nand=%d, or=%d, nor=%d, xor=%d, nxor=%d\n",
+      And, Nand, Or, Nor, Xor, Nxor);
+}
+
+
 int main(int argc, char** argv)
 {
 
@@ -47,21 +61,14 @@
 
   srand(seed);
 
+  showReduction(0);
+  showReduction(1);
+  showReduction(-1);
+
   for (i = 0; i < 128; i++) {
-    int num = rand();
+    unsigned long long num = rand();
     BitType Val = Y * num;
-    {
-      unsigned char And  = __builtin_bit_and_reduce(Val);
-      unsigned char Nand = __builtin_bit_nand_reduce(Val);
-      unsigned char Or   = __builtin_bit_or_reduce(Val);
-      unsigned char Nor  = __builtin_bit_nor_reduce(Val);
-      unsigned char Xor  = __builtin_bit_xor_reduce(Val);
-      unsigned char Nxor = __builtin_bit_nxor_reduce(Val);
-      printf("Value=");
-      printBits(Val, numbits);
-      printf(", and=%d, nand=%d, or=%d, nor=%d, xor=%d, nxor=%d\n",
-          And, Nand, Or, Nor, Xor, Nxor);
-    }
+    showReduction(Val);
   }
   return 0;
 }


Index: llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output
diff -u llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output:1.1 llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output:1.2
--- llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output:1.1	Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bit_reduce.reference_output	Mon Feb 12 14:57:48 2007
@@ -1,18 +1,132 @@
-Tried to execute an unknown external function: i1 (...) * __builtin_bit_and_reduce
-/proj/llvm/llvm-2/Debug/bin/lli((anonymous namespace)::PrintStackTrace()+0x1a)[0x871c18a]
-/proj/llvm/llvm-2/Debug/bin/lli((anonymous namespace)::SignalHandler(int)+0x110)[0x871c4b2]
-[0x8e5420]
-/lib/libc.so.6(abort+0x101)[0x3234f1]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::callExternalFunction(llvm::Function*, std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> > const&)+0x138)[0x845428c]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::callFunction(llvm::Function*, std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> > const&)+0x11a)[0x844f356]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::visitCallSite(llvm::CallSite)+0x433)[0x844f9d9]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::visitCallInst(llvm::CallInst&)+0x2a)[0x845a998]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::InstVisitor<llvm::Interpreter, void>::visitCall(llvm::CallInst&)+0x18)[0x845a9b2]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::InstVisitor<llvm::Interpreter, void>::visit(llvm::Instruction&)+0x422)[0x845b5cc]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::run()+0x9d)[0x8450c21]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::Interpreter::runFunction(llvm::Function*, std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> > const&)+0xc9)[0x84545a1]
-/proj/llvm/llvm-2/Debug/bin/lli(llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, char const* const*)+0x218)[0x84729ac]
-/proj/llvm/llvm-2/Debug/bin/lli(main+0x356)[0x83593aa]
-/lib/libc.so.6(__libc_start_main+0xdc)[0x30f4e4]
-/proj/llvm/llvm-2/Debug/bin/lli(__gxx_personality_v0+0x191)[0x8358fd1]
-exit 134
+Value=000000000000000, and=0, nand=1, or=0, nor=1, xor=0, nxor=1
+Value=000000000000001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111111111111111, and=1, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110010011000001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000011100001000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=010100011010101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000110101110000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=000011110010000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=010000001100001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011111000100011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110001010100100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=011101010110011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000000111111010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=101101100000101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111111001011010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=000001001001110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=110101100011011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=101111000010101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010011111101100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=010010000001101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010010001010101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=100100010001001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110001101000100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111011100101111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110111101000011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111100001111101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=100001110010001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000001001011000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=000110111110110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=000110110001010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=011000011000010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=101111111011110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=001111101110010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=011010000111111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=100010010011111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010011001111010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=101110100010100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=101001000001110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=010111000001010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=111110101110101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001000000110001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001000010101110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=011100000100111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001001000101010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=110101110110011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011011010000001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001010001111000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=101011011001101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001010010010110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=011110001100100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111101011011010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=011100011101011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000010011101100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=101111000011101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011000000011010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=111010000101111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=101011010011010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=111001110101010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=111011010000111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110010010010000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=000000100110100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=010011101001001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=100010001101110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=010000010100110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=101101110001000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=000100100001100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=100011100011111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011100010011100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=101101100011010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=111010100101001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011011000010001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110101101001011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000010111010110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=110111000111000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111110101110101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111000110001001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010010010111001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001000111101101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=100100001010110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=011100101001111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=100111001010000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=100001100101111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111001000111001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=101001100111100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=010000101001100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=010001001010011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=100011101101011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111011111100110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=001010111111101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011110111110010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=101110001110110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=001011100110000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=110010100111011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010000011100100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=011011111010110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=100000011000011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010100111110000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111111011110101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111100101011111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000010100001010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=111010000011101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010111101110000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111000001010100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111100111110011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001110110100111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110110111001001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=110101101111100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=100001001100000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111111110110101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011001111010001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111101110101110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=100111000000101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111011100000000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=110110111100111, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=010000101000001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=001100001001100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=001000000111010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=110100010101100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=001000000110010, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=010011000110110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=010011010011110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=110110010101000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=011110101100110, and=0, nand=1, or=1, nor=0, xor=0, nxor=1
+Value=000101111011001, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=000110110001100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=111010100111100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=100110010011100, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=011011101111011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=111010000110000, and=0, nand=1, or=1, nor=1, xor=0, nxor=1
+Value=100010111111011, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+Value=011110010000101, and=0, nand=1, or=1, nor=0, xor=1, nxor=0
+exit 0


Index: llvm-test/SingleSource/UnitTests/Integer/part_select.c
diff -u llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.1 llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.2
--- llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.1	Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select.c	Mon Feb 12 14:57:48 2007
@@ -39,7 +39,7 @@
   for (i = 1; i <= numbits; ++i) {
     BitType left = rand() % numbits;
     BitType right = i;
-    BitType Z = __builtin_part_select(Y, left, right);
+    BitType Z = __builtin_bit_part_select(Y, left, right);
     printf("part_select(Y, %3d, %3d) = ", (int)left, (int)right);
     for (j = numbits; j > 0; --j) {
       if (__builtin_bit_select(Z, j))






More information about the llvm-commits mailing list