Debian Codegraph @

gcc/testsuite/gcc.target/i386/sse2-v1ti-ashiftrt-3.c

raw
1 /* { dg-do compile { target int128 } } */
2 /* { dg-options "-O2 -msse2 -msse4.1" } */
3
4 typedef __int128 v1ti __attribute__ ((__vector_size__ (16)));
5 typedef __int128 ti;
6
7 ti ashr(ti x, unsigned int i) { return x >> i; }
8
9 v1ti ashr_1(v1ti x) { return x >> 1; }
10 v1ti ashr_2(v1ti x) { return x >> 2; }
11 v1ti ashr_7(v1ti x) { return x >> 7; }
12 v1ti ashr_8(v1ti x) { return x >> 8; }
13 v1ti ashr_9(v1ti x) { return x >> 9; }
14 v1ti ashr_15(v1ti x) { return x >> 15; }
15 v1ti ashr_16(v1ti x) { return x >> 16; }
16 v1ti ashr_17(v1ti x) { return x >> 17; }
17 v1ti ashr_23(v1ti x) { return x >> 23; }
18 v1ti ashr_24(v1ti x) { return x >> 24; }
19 v1ti ashr_25(v1ti x) { return x >> 25; }
20 v1ti ashr_31(v1ti x) { return x >> 31; }
21 v1ti ashr_32(v1ti x) { return x >> 32; }
22 v1ti ashr_33(v1ti x) { return x >> 33; }
23 v1ti ashr_47(v1ti x) { return x >> 47; }
24 v1ti ashr_48(v1ti x) { return x >> 48; }
25 v1ti ashr_49(v1ti x) { return x >> 49; }
26 v1ti ashr_63(v1ti x) { return x >> 63; }
27 v1ti ashr_64(v1ti x) { return x >> 64; }
28 v1ti ashr_65(v1ti x) { return x >> 65; }
29 v1ti ashr_72(v1ti x) { return x >> 72; }
30 v1ti ashr_79(v1ti x) { return x >> 79; }
31 v1ti ashr_80(v1ti x) { return x >> 80; }
32 v1ti ashr_81(v1ti x) { return x >> 81; }
33 v1ti ashr_95(v1ti x) { return x >> 95; }
34 v1ti ashr_96(v1ti x) { return x >> 96; }
35 v1ti ashr_97(v1ti x) { return x >> 97; }
36 v1ti ashr_111(v1ti x) { return x >> 111; }
37 v1ti ashr_112(v1ti x) { return x >> 112; }
38 v1ti ashr_113(v1ti x) { return x >> 113; }
39 v1ti ashr_119(v1ti x) { return x >> 119; }
40 v1ti ashr_120(v1ti x) { return x >> 120; }
41 v1ti ashr_121(v1ti x) { return x >> 121; }
42 v1ti ashr_126(v1ti x) { return x >> 126; }
43 v1ti ashr_127(v1ti x) { return x >> 127; }
44
45 typedef v1ti (*fun)(v1ti);
46
47 struct {
48 unsigned int i;
49 fun ashr;
50 } table[35] = {
51 { 1, ashr_1 },
52 { 2, ashr_2 },
53 { 7, ashr_7 },
54 { 8, ashr_8 },
55 { 9, ashr_9 },
56 { 15, ashr_15 },
57 { 16, ashr_16 },
58 { 17, ashr_17 },
59 { 23, ashr_23 },
60 { 24, ashr_24 },
61 { 25, ashr_25 },
62 { 31, ashr_31 },
63 { 32, ashr_32 },
64 { 33, ashr_33 },
65 { 47, ashr_47 },
66 { 48, ashr_48 },
67 { 49, ashr_49 },
68 { 63, ashr_63 },
69 { 64, ashr_64 },
70 { 65, ashr_65 },
71 { 72, ashr_72 },
72 { 79, ashr_79 },
73 { 80, ashr_80 },
74 { 81, ashr_81 },
75 { 95, ashr_95 },
76 { 96, ashr_96 },
77 { 97, ashr_97 },
78 { 111, ashr_111 },
79 { 112, ashr_112 },
80 { 113, ashr_113 },
81 { 119, ashr_119 },
82 { 120, ashr_120 },
83 { 121, ashr_121 },
84 { 126, ashr_126 },
85 { 127, ashr_127 }
86 };
87
88 void test(ti x)
89 {
90 unsigned int i;
91 v1ti t = (v1ti)x;
92
93 for (i=0; i<(sizeof(table)/sizeof(table[0])); i++) {
94 if ((ti)(*table[i].ashr)(t) != ashr(x,table[i].i))
95 __builtin_abort();
96 }
97 }
98
99 int main()
100 {
101 ti x;
102
103 x = ((ti)0x0011223344556677ull)<<64 | 0x8899aabbccddeeffull;
104 test(x);
105 x = ((ti)0xffeeddccbbaa9988ull)<<64 | 0x7766554433221100ull;
106 test(x);
107 x = ((ti)0x0123456789abcdefull)<<64 | 0x0123456789abcdefull;
108 test(x);
109 x = ((ti)0xfedcba9876543210ull)<<64 | 0xfedcba9876543210ull;
110 test(x);
111 x = ((ti)0x0123456789abcdefull)<<64 | 0xfedcba9876543210ull;
112 test(x);
113 x = ((ti)0xfedcba9876543210ull)<<64 | 0x0123456789abcdefull;
114 test(x);
115 x = 0;
116 test(x);
117 x = 0xffffffffffffffffull;
118 test(x);
119 x = ((ti)0xffffffffffffffffull)<<64;
120 test(x);
121 x = ((ti)0xffffffffffffffffull)<<64 | 0xffffffffffffffffull;
122 test(x);
123 x = ((ti)0x5a5a5a5a5a5a5a5aull)<<64 | 0x5a5a5a5a5a5a5a5aull;
124 test(x);
125 x = ((ti)0xa5a5a5a5a5a5a5a5ull)<<64 | 0xa5a5a5a5a5a5a5a5ull;
126 test(x);
127 x = 0xffull;
128 test(x);
129 x = 0xff00ull;
130 test(x);
131 x = 0xff0000ull;
132 test(x);
133 x = 0xff000000ull;
134 test(x);
135 x = 0xff00000000ull;
136 test(x);
137 x = 0xff0000000000ull;
138 test(x);
139 x = 0xff000000000000ull;
140 test(x);
141 x = 0xff00000000000000ull;
142 test(x);
143 x = ((ti)0xffull)<<64;
144 test(x);
145 x = ((ti)0xff00ull)<<64;
146 test(x);
147 x = ((ti)0xff0000ull)<<64;
148 test(x);
149 x = ((ti)0xff000000ull)<<64;
150 test(x);
151 x = ((ti)0xff00000000ull)<<64;
152 test(x);
153 x = ((ti)0xff0000000000ull)<<64;
154 test(x);
155 x = ((ti)0xff000000000000ull)<<64;
156 test(x);
157 x = ((ti)0xff00000000000000ull)<<64;
158 test(x);
159 x = 0xdeadbeefcafebabeull;
160 test(x);
161 x = ((ti)0xdeadbeefcafebabeull)<<64;
162 test(x);
163
164 return 0;
165 }
166