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

Reid Spencer reid at x10sys.com
Mon Feb 12 15:17:51 PST 2007



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

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

Update the part_select test case to avoid sign extension.


---
Diffs of the changes:  (+61 -10)

 part_select.c                |   23 +++++++++++---------
 part_select.reference_output |   48 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 10 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/part_select.c
diff -u llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.2 llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.3
--- llvm-test/SingleSource/UnitTests/Integer/part_select.c:1.2	Mon Feb 12 14:57:48 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select.c	Mon Feb 12 17:17:34 2007
@@ -12,15 +12,16 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 
 #ifdef ENABLE_LARGE_INTEGERS
-typedef int __attribute__((bitwidth(256))) BitType;
-const BitType X = 0xAAAAAAAAULL;
-int numbits = 256;
+typedef unsigned __attribute__((bitwidth(256))) BitType;
+const BitType X = 0xFEDCBA9876543210ULL;
+unsigned numbits = 256;
 #else
-typedef int __attribute__((bitwidth(47))) BitType;
-const BitType X = 0xAAAAAAAAULL;
-int numbits = 47;
+typedef unsigned __attribute__((bitwidth(47))) BitType;
+const BitType X = 0xFEDCBA9876543210ULL;
+unsigned numbits = 47;
 #endif
 
 int main(int argc, char** argv)
@@ -34,19 +35,21 @@
 
   srand(0);
 
-  int i, j;
+  unsigned i, j;
 
-  for (i = 1; i <= numbits; ++i) {
+  for (i = 0; i < numbits; ++i) {
     BitType left = rand() % numbits;
     BitType right = i;
+    printf("part_select(Y, %3u, %3u) = ", (unsigned)left, (unsigned)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))
+      if (__builtin_bit_select(Z, j-1))
         printf("1");
       else
         printf("0");
     }
+    uint64_t val = Z;
+    printf(" (%lx)", val);
     printf("\n");
   }
 


Index: llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output
diff -u llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.1 llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.2
--- llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output:1.1	Mon Feb 12 11:52:59 2007
+++ llvm-test/SingleSource/UnitTests/Integer/part_select.reference_output	Mon Feb 12 17:17:34 2007
@@ -0,0 +1,48 @@
+part_select(Y,  38,   0) = 00000000001100001110110010101000011001000010000 (76543210)
+part_select(Y,   4,   1) = 00000000000000000000000000000000000000000001000 (8)
+part_select(Y,  18,   2) = 00000000000000000000000000000010000110010000100 (10c84)
+part_select(Y,  23,   3) = 00000000000000000000000000010101000011001000010 (a8642)
+part_select(Y,  17,   4) = 00000000000000000000000000000000000001100100001 (321)
+part_select(Y,  26,   5) = 00000000000000000000000001100101010000110010000 (32a190)
+part_select(Y,  16,   6) = 00000000000000000000000000000000000000011001000 (c8)
+part_select(Y,   3,   7) = 00000000000000000000000000000000000000000001000 (8)
+part_select(Y,  28,   8) = 00000000000000000000000000101100101010000110010 (165432)
+part_select(Y,  28,   9) = 00000000000000000000000000010110010101000011001 (b2a19)
+part_select(Y,  10,  10) = 00000000000000000000000000000000000000000000000 (0)
+part_select(Y,  17,  11) = 00000000000000000000000000000000000000000000110 (6)
+part_select(Y,  44,  12) = 00000000000000110101001100001110110010101000011 (a9876543)
+part_select(Y,  28,  13) = 00000000000000000000000000000001011001010100001 (b2a1)
+part_select(Y,   2,  14) = 00000000000000000000000000000000000010000100110 (426)
+part_select(Y,  20,  15) = 00000000000000000000000000000000000000000101000 (28)
+part_select(Y,  22,  16) = 00000000000000000000000000000000000000001010100 (54)
+part_select(Y,  21,  17) = 00000000000000000000000000000000000000000001010 (a)
+part_select(Y,  18,  18) = 00000000000000000000000000000000000000000000001 (1)
+part_select(Y,  36,  19) = 00000000000000000000000000000110000111011001010 (30eca)
+part_select(Y,  34,  20) = 00000000000000000000000000000000000011101100101 (765)
+part_select(Y,  37,  21) = 00000000000000000000000000000001100001110110010 (c3b2)
+part_select(Y,  18,  22) = 00000000000000000000000000000000000000000010101 (15)
+part_select(Y,  38,  23) = 00000000000000000000000000000000011000011101100 (30ec)
+part_select(Y,  20,  24) = 00000000000000000000000000000000000000000010100 (14)
+part_select(Y,   1,  25) = 00000000000000000000000001000010011000010101001 (2130a9)
+part_select(Y,  31,  26) = 00000000000000000000000000000000000000000011101 (1d)
+part_select(Y,  17,  27) = 00000000000000000000000000000000000001010100110 (2a6)
+part_select(Y,  20,  28) = 00000000000000000000000000000000000000101001101 (14d)
+part_select(Y,   6,  29) = 00000000000000000000000000100110000101010011011 (130a9b)
+part_select(Y,  27,  30) = 00000000000000000000000000000000000000000000111 (7)
+part_select(Y,  37,  31) = 00000000000000000000000000000000000000000110000 (30)
+part_select(Y,  11,  32) = 00000000000000000000000000110000101010011011100 (1854dc)
+part_select(Y,  24,  33) = 00000000000000000000000000000000000000110111000 (1b8)
+part_select(Y,  39,  34) = 00000000000000000000000000000000000000000100110 (26)
+part_select(Y,   7,  35) = 00000000000000000000100110000101010011011100001 (4c2a6e1)
+part_select(Y,   3,  36) = 00000000000000100001001100001010100110111000011 (9854dc3)
+part_select(Y,   9,  37) = 00000000000000000010011000010101001101110000110 (130a9b86)
+part_select(Y,  36,  38) = 00000000000000000000000000000000000000000000100 (4)
+part_select(Y,  31,  39) = 00000000000000000000000000000000000000000011001 (19)
+part_select(Y,  16,  40) = 00000000000000000000000010101001101110000110010 (54dc32)
+part_select(Y,  46,  41) = 00000000000000000000000000000000000000000011101 (1d)
+part_select(Y,  27,  42) = 00000000000000000000000000000000111000011001010 (70ca)
+part_select(Y,  13,  43) = 00000000000000001000010101001101110000110010101 (42a6e195)
+part_select(Y,   6,  44) = 00000000000100110000101010011011100001100101011 (854dc32b)
+part_select(Y,   9,  45) = 00000000001001100001010100110111000011001010111 (a9b8657)
+part_select(Y,  13,  46) = 00000000000001000010101001101110000110010101110 (15370cae)
+exit 0






More information about the llvm-commits mailing list