Debian Codegraph @

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

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