Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/cfuged-1.c

raw
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-require-effective-target power10_ok } */
5 /* { dg-options "-mdejagnu-cpu=power10" } */
6
7 extern void abort (void);
8
9 unsigned long long int
10 do_cfuged (unsigned long long int source, unsigned long long int mask)
11 {
12 return __builtin_cfuged (source, mask);
13 }
14
15 int main (int argc, char *argv [])
16 {
17 unsigned long long int sources [4], masks [4];
18 unsigned long long int results [4][4] = {
19 /* sources[0] with each of masks [0 .. 3] */
20 {0x7e3ca5f0ll, 0xa5f07e3cll, 0xaf7350ecll, 0x50ecaf73ll },
21 /* sources[1] with each of masks [0 .. 3] */
22 { 0xa5f07e3cll, 0x7e3ca5f0ll, 0x73afec50ll, 0xec5073afll },
23 /* sources[2] with each of masks [0 .. 3] */
24 { 0xf07e3ca5ll, 0x3ca5f07ell, 0x3af7c50ell, 0xc50e3af7ll },
25 /* sources[3] with each of masks [0 .. 3] */
26 { 0xe7c35a0fll, 0x5a0fe7c3ll, 0x50ecaf73ll, 0xaf7350ecll },
27 };
28
29 sources[0] = 0xa5f07e3cll;
30 sources[1] = 0x7e3ca5f0ll;
31 sources[2] = 0x3ca5f07ell;
32 sources[3] = 0x5a0fe7c3ll;
33
34 masks[0] = 0xffff0000ll;
35 masks[1] = 0x0000ffffll;
36 masks[2] = 0x0f0f0f0fll;
37 masks[3] = 0xf0f0f0f0ll;
38
39 unsigned long long int result;
40
41 for (int i = 0; i < 4; i++)
42 {
43 for (int j = 0; j < 4; j++)
44 {
45 if (do_cfuged (sources[i], masks[j]) != results [i][j])
46 abort ();
47 }
48 }
49
50 return 0;
51 }