1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_ffsdi2
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 __ffsdi2(di_int a
);
12 int test__ffsdi2(di_int a
, int expected
)
16 printf("error in __ffsdi2(0x%llX) = %d, expected %d\n", a
, x
, expected
);
20 char assumption_1
[sizeof(di_int
) == 2*sizeof(si_int
)] = {0};
24 if (test__ffsdi2(0x00000000, 0))
26 if (test__ffsdi2(0x00000001, 1))
28 if (test__ffsdi2(0x00000002, 2))
30 if (test__ffsdi2(0x00000003, 1))
32 if (test__ffsdi2(0x00000004, 3))
34 if (test__ffsdi2(0x00000005, 1))
36 if (test__ffsdi2(0x0000000A, 2))
38 if (test__ffsdi2(0x10000000, 29))
40 if (test__ffsdi2(0x20000000, 30))
42 if (test__ffsdi2(0x60000000, 30))
44 if (test__ffsdi2(0x80000000uLL
, 32))
46 if (test__ffsdi2(0x0000050000000000uLL
, 41))
48 if (test__ffsdi2(0x0200080000000000uLL
, 44))
50 if (test__ffsdi2(0x7200000000000000uLL
, 58))
52 if (test__ffsdi2(0x8000000000000000uLL
, 64))