Revert "[GVN] MemorySSA for GVN: add optional `AllowMemorySSA`"
[llvm-project.git] / compiler-rt / test / builtins / Unit / ffssi2_test.c
blob2960ae6f8585aabcfbc19bff97a8a7fd0794cf4d
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_ffssi2
4 #include "int_lib.h"
5 #include <stdio.h>
7 // Returns: the index of the least significant 1-bit in a, or
8 // the value zero if a is zero. The least significant bit is index one.
10 COMPILER_RT_ABI int __ffssi2(si_int a);
12 int test__ffssi2(si_int a, int expected)
14 int x = __ffssi2(a);
15 if (x != expected)
16 printf("error in __ffssi2(0x%X) = %d, expected %d\n", a, x, expected);
17 return x != expected;
20 int main()
22 if (test__ffssi2(0x00000000, 0))
23 return 1;
24 if (test__ffssi2(0x00000001, 1))
25 return 1;
26 if (test__ffssi2(0x00000002, 2))
27 return 1;
28 if (test__ffssi2(0x00000003, 1))
29 return 1;
30 if (test__ffssi2(0x00000004, 3))
31 return 1;
32 if (test__ffssi2(0x00000005, 1))
33 return 1;
34 if (test__ffssi2(0x0000000A, 2))
35 return 1;
36 if (test__ffssi2(0x10000000, 29))
37 return 1;
38 if (test__ffssi2(0x20000000, 30))
39 return 1;
40 if (test__ffssi2(0x60000000, 30))
41 return 1;
42 if (test__ffssi2(0x80000000u, 32))
43 return 1;
45 return 0;