1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_ffssi2
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
)
16 printf("error in __ffssi2(0x%X) = %d, expected %d\n", a
, x
, expected
);
22 if (test__ffssi2(0x00000000, 0))
24 if (test__ffssi2(0x00000001, 1))
26 if (test__ffssi2(0x00000002, 2))
28 if (test__ffssi2(0x00000003, 1))
30 if (test__ffssi2(0x00000004, 3))
32 if (test__ffssi2(0x00000005, 1))
34 if (test__ffssi2(0x0000000A, 2))
36 if (test__ffssi2(0x10000000, 29))
38 if (test__ffssi2(0x20000000, 30))
40 if (test__ffssi2(0x60000000, 30))
42 if (test__ffssi2(0x80000000u
, 32))