[RS6000] Tests that use int128_t and -m32
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / cntlzdm-0.c
blobc11800d9bee9fa0f9918021d2837f7ff2109e735
1 /* { dg-require-effective-target lp64 } */
2 /* { dg-options "-mdejagnu-cpu=power10" } */
4 extern void abort (void);
6 unsigned long long int
7 do_cntlzdm (unsigned long long int source, unsigned long long int mask)
9 return __builtin_cntlzdm (source, mask);
12 int main (int argc, char *argv [])
14 unsigned long long int sources [4], masks [4];
15 unsigned long long int intermediates [4][4] = {
16 /* sources[0] with each of masks [0 .. 3] */
17 { 0x0000a5f0ll, 0x00007e3cll, 0x000050ecll, 0x0000af73ll },
18 /* sources[1] with each of masks [0 .. 3] */
19 { 0x00007e3cll, 0x0000a5f0ll, 0x0000ec50ll, 0x000073afll },
20 /* sources[2] with each of masks [0 .. 3] */
21 { 0x00003ca5ll, 0x0000f07ell, 0x0000c50ell, 0x00003af7ll },
22 /* sources[3] with each of masks [0 .. 3] */
23 { 0x00005a0fll, 0x0000e7c3ll, 0x0000af73ll, 0x000050ecll },
25 unsigned long long int results [4][4] = {
26 { 0, 1, 1, 0 },
27 { 1, 0, 0, 1 },
28 { 2, 0, 0, 2 },
29 { 1, 0, 0, 1 },
32 sources[0] = 0xa5f07e3cll;
33 sources[1] = 0x7e3ca5f0ll;
34 sources[2] = 0x3ca5f07ell;
35 sources[3] = 0x5a0fe7c3ll;
37 masks[0] = 0xffff0000ll;
38 masks[1] = 0x0000ffffll;
39 masks[2] = 0x0f0f0f0fll;
40 masks[3] = 0xf0f0f0f0ll;
42 unsigned long long int result;
44 for (int i = 0; i < 4; i++)
46 for (int j = 0; j < 4; j++)
48 if (do_cntlzdm (sources[i], masks[j]) != results [i][j])
49 abort ();
53 return 0;
56 /* { dg-final { scan-assembler {\mcntlzdm\M} } } */