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

Reid Spencer reid at x10sys.com
Mon Feb 5 18:58:22 PST 2007



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

bit_select.c added (r1.1)
bit_select.reference_output added (r1.1)
---
Log message:

Test for the bit_select builtin function.


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

 bit_select.c                |   45 ++++++++++++++++++++++++++++++++++++++++++++
 bit_select.reference_output |    2 +
 2 files changed, 47 insertions(+)


Index: llvm-test/SingleSource/UnitTests/Integer/bit_select.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bit_select.c:1.1
*** /dev/null	Mon Feb  5 20:58:05 2007
--- llvm-test/SingleSource/UnitTests/Integer/bit_select.c	Mon Feb  5 20:57:54 2007
***************
*** 0 ****
--- 1,45 ----
+ //===--- bit_select.c --- Test The bit_select builtin ---------------------===//
+ //
+ // This file was developed by Reid Spencer and is distributed under the 
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This test case tests the __builtin_bit_select builtin function llvm-gcc.
+ // bit_select selects one bit out of a larger 
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #include <stdio.h>
+ 
+ #ifdef ENABLE_LARGE_INTEGERS
+ typedef int __attribute__((bitwidth(250))) BitType;
+ const BitType X = 0xAAAAAAAAULL;
+ int numbits = 250;
+ #else
+ typedef int __attribute__((bitwidth(47))) BitType;
+ const BitType X = 0xAAAAAAAAULL;
+ int numbits = 47;
+ #endif
+ 
+ int main(int argc, char** argv)
+ {
+ 
+ #ifdef ENABLE_LARGE_INTEGERS
+   BitType Y = X * X;
+ #else
+   BitType Y = X;
+ #endif
+ 
+   int i;
+ 
+   for (i = numbits-1; i >= 0; --i) {
+     if (__builtin_bit_select(Y, i)) 
+       printf("1");
+     else
+       printf("0");
+   }
+ 
+   printf("\n");
+   return 0;
+ }


Index: llvm-test/SingleSource/UnitTests/Integer/bit_select.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bit_select.reference_output:1.1
*** /dev/null	Mon Feb  5 20:58:22 2007
--- llvm-test/SingleSource/UnitTests/Integer/bit_select.reference_output	Mon Feb  5 20:57:54 2007
***************
*** 0 ****
--- 1,2 ----
+ 01010101010101010101010101010101010101010101010
+ exit 0






More information about the llvm-commits mailing list