1 /* Test for LoongArch intrinsics. */
2
3 /* { dg-do compile } */
4
5 /* { dg-final { scan-assembler-times "test_rdtime_d:.*rdtime\\.d.*\\.size test_rdtime_d" 1 } } */
6 /* { dg-final { scan-assembler-times "test_rdtimeh_w:.*rdtimeh\\.w.*\\.size test_rdtimeh_w" 1 } } */
7 /* { dg-final { scan-assembler-times "test_rdtimel_w:.*rdtimel\\.w.*\\.size test_rdtimel_w" 1 } } */
8 /* { dg-final { scan-assembler-times "test_movfcsr2gr:.*movfcsr2gr.*\\.size test_movfcsr2gr" 1 } } */
9 /* { dg-final { scan-assembler-times "test_movgr2fcsr:.*movgr2fcsr.*\\.size test_movgr2fcsr" 1 } } */
10 /* { dg-final { scan-assembler-times "test_cacop_d:.*cacop.*\\.size test_cacop_d" 1 } } */
11 /* { dg-final { scan-assembler-times "test_cpucfg:.*cpucfg.*\\.size test_cpucfg" 1 } } */
12 /* { dg-final { scan-assembler-times "test_asrtle_d:.*asrtle\\.d.*\\.size test_asrtle_d" 1 } } */
13 /* { dg-final { scan-assembler-times "test_asrtgt_d:.*asrtgt\\.d.*\\.size test_asrtgt_d" 1 } } */
14 /* { dg-final { scan-assembler-times "test_lddir_d:.*lddir.*\\.size test_lddir_d" 1 } } */
15 /* { dg-final { scan-assembler-times "test_ldpte_d:.*ldpte.*\\.size test_ldpte_d" 1 } } */
16 /* { dg-final { scan-assembler-times "test_crc_w_b_w:.*crc\\.w\\.b\\.w.*\\.size test_crc_w_b_w" 1 } } */
17 /* { dg-final { scan-assembler-times "test_crc_w_h_w:.*crc\\.w\\.h\\.w.*\\.size test_crc_w_h_w" 1 } } */
18 /* { dg-final { scan-assembler-times "test_crc_w_w_w:.*crc\\.w\\.w\\.w.*\\.size test_crc_w_w_w" 1 } } */
19 /* { dg-final { scan-assembler-times "test_crc_w_d_w:.*crc\\.w\\.d\\.w.*\\.size test_crc_w_d_w" 1 } } */
20 /* { dg-final { scan-assembler-times "test_crcc_w_b_w:.*crcc\\.w\\.b\\.w.*\\.size test_crcc_w_b_w" 1 } } */
21 /* { dg-final { scan-assembler-times "test_crcc_w_h_w:.*crcc\\.w\\.h\\.w.*\\.size test_crcc_w_h_w" 1 } } */
22 /* { dg-final { scan-assembler-times "test_crcc_w_w_w:.*crcc\\.w\\.w\\.w.*\\.size test_crcc_w_w_w" 1 } } */
23 /* { dg-final { scan-assembler-times "test_crcc_w_d_w:.*crcc\\.w\\.d\\.w.*\\.size test_crcc_w_d_w" 1 } } */
24 /* { dg-final { scan-assembler-times "test_csrrd_w:.*csrrd.*\\.size test_csrrd_w" 1 } } */
25 /* { dg-final { scan-assembler-times "test_csrwr_w:.*csrwr.*\\.size test_csrwr_w" 1 } } */
26 /* { dg-final { scan-assembler-times "test_csrxchg_w:.*csrxchg.*\\.size test_csrxchg_w" 1 } } */
27 /* { dg-final { scan-assembler-times "test_csrrd_d:.*csrrd.*\\.size test_csrrd_d" 1 } } */
28 /* { dg-final { scan-assembler-times "test_csrwr_d:.*csrwr.*\\.size test_csrwr_d" 1 } } */
29 /* { dg-final { scan-assembler-times "test_csrxchg_d:.*csrxchg.*\\.size test_csrxchg_d" 1 } } */
30 /* { dg-final { scan-assembler-times "test_iocsrrd_b:.*iocsrrd\\.b.*\\.size test_iocsrrd_b" 1 } } */
31 /* { dg-final { scan-assembler-times "test_iocsrrd_h:.*iocsrrd\\.h.*\\.size test_iocsrrd_h" 1 } } */
32 /* { dg-final { scan-assembler-times "test_iocsrrd_w:.*iocsrrd\\.w.*\\.size test_iocsrrd_w" 1 } } */
33 /* { dg-final { scan-assembler-times "test_iocsrrd_d:.*iocsrrd\\.d.*\\.size test_iocsrrd_d" 1 } } */
34 /* { dg-final { scan-assembler-times "test_iocsrwr_b:.*iocsrwr\\.b.*\\.size test_iocsrwr_b" 1 } } */
35 /* { dg-final { scan-assembler-times "test_iocsrwr_h:.*iocsrwr\\.h.*\\.size test_iocsrwr_h" 1 } } */
36 /* { dg-final { scan-assembler-times "test_iocsrwr_w:.*iocsrwr\\.w.*\\.size test_iocsrwr_w" 1 } } */
37 /* { dg-final { scan-assembler-times "test_iocsrwr_d:.*iocsrwr\\.d.*\\.size test_iocsrwr_d" 1 } } */
38 /* { dg-final { scan-assembler-times "test_dbar:.*dbar.*\\.size test_dbar" 1 } } */
39 /* { dg-final { scan-assembler-times "test_ibar:.*ibar.*\\.size test_ibar" 1 } } */
40 /* { dg-final { scan-assembler-times "test_syscall:.*syscall.*\\.size test_syscall" 1 } } */
41 /* { dg-final { scan-assembler-times "test_break:.*break.*\\.size test_break" 1 } } */
42
43 #include<larchintrin.h>
44
45 __drdtime_t
46 test_rdtime_d ()
47 {
48 return __rdtime_d ();
49 }
50
51 __rdtime_t
52 test_rdtimeh_w ()
53 {
54 return __rdtimeh_w ();
55 }
56
57 __rdtime_t
58 test_rdtimel_w ()
59 {
60 return __rdtimel_w ();
61 }
62
63 unsigned int
64 test_movfcsr2gr ()
65 {
66 return __movfcsr2gr (1);
67 }
68
69 void
70 test_movgr2fcsr (unsigned int _1)
71 {
72 __movgr2fcsr (1, _1);
73 }
74
75 void
76 test_cacop_d (unsigned long int _1)
77 {
78 __cacop_d (1, _1, 1);
79 }
80
81 unsigned int
82 test_cpucfg (unsigned int _1)
83 {
84 return __cpucfg (_1);
85 }
86
87 void
88 test_asrtle_d (long int _1, long int _2)
89 {
90 __asrtle_d (_1, _2);
91 }
92
93 void
94 test_asrtgt_d (long int _1, long int _2)
95 {
96 __asrtgt_d (_1, _2);
97 }
98
99 long int
100 test_lddir_d (long int _1)
101 {
102 return __lddir_d (_1, 1);
103 }
104
105 void
106 test_ldpte_d (long int _1)
107 {
108 __ldpte_d (_1, 1);
109 }
110
111 int
112 test_crc_w_b_w (char _1, int _2)
113 {
114 return __crc_w_b_w (_1, _2);
115 }
116
117 int
118 test_crc_w_h_w (short _1, int _2)
119 {
120 return __crc_w_h_w (_1, _2);
121 }
122
123 int
124 test_crc_w_w_w (int _1, int _2)
125 {
126 return __crc_w_w_w (_1, _2);
127 }
128
129 int
130 test_crc_w_d_w (long int _1, int _2)
131 {
132 return __crc_w_d_w (_1, _2);
133 }
134
135 int
136 test_crcc_w_b_w (char _1, int _2)
137 {
138 return __crcc_w_b_w (_1, _2);
139 }
140
141 int
142 test_crcc_w_h_w (short _1, int _2)
143 {
144 return __crcc_w_h_w (_1, _2);
145 }
146
147 int
148 test_crcc_w_w_w (int _1, int _2)
149 {
150 return __crcc_w_w_w (_1, _2);
151 }
152
153 int
154 test_crcc_w_d_w (long int _1, int _2)
155 {
156 return __crcc_w_d_w (_1, _2);
157 }
158
159 unsigned int
160 test_csrrd_w ()
161 {
162 return __csrrd_w (1);
163 }
164
165 unsigned int
166 test_csrwr_w (unsigned int _1)
167 {
168 return __csrwr_w (_1, 1);
169 }
170
171 unsigned int
172 test_csrxchg_w (unsigned int _1, unsigned int _2)
173 {
174 return __csrxchg_w (_1, _2, 1);
175 }
176
177 unsigned long int
178 test_csrrd_d ()
179 {
180 return __csrrd_d (1);
181 }
182
183 unsigned long int
184 test_csrwr_d (unsigned long int _1)
185 {
186 return __csrwr_d (_1, 1);
187 }
188
189 unsigned long int
190 test_csrxchg_d (unsigned long int _1, unsigned long int _2)
191 {
192 return __csrxchg_d (_1, _2, 1);
193 }
194
195 unsigned char
196 test_iocsrrd_b (unsigned int _1)
197 {
198 return __iocsrrd_b (_1);
199 }
200
201 unsigned char
202 test_iocsrrd_h (unsigned int _1)
203 {
204 return __iocsrrd_h (_1);
205 }
206
207 unsigned int
208 test_iocsrrd_w (unsigned int _1)
209 {
210 return __iocsrrd_w (_1);
211 }
212
213 unsigned long int
214 test_iocsrrd_d (unsigned int _1)
215 {
216 return __iocsrrd_d (_1);
217 }
218
219 void
220 test_iocsrwr_b (unsigned char _1, unsigned int _2)
221 {
222 __iocsrwr_b (_1, _2);
223 }
224
225 void
226 test_iocsrwr_h (unsigned short _1, unsigned int _2)
227 {
228 __iocsrwr_h (_1, _2);
229 }
230
231 void
232 test_iocsrwr_w (unsigned int _1, unsigned int _2)
233 {
234 __iocsrwr_w (_1, _2);
235 }
236
237 void
238 test_iocsrwr_d (unsigned long int _1, unsigned int _2)
239 {
240 __iocsrwr_d (_1, _2);
241 }
242
243 void
244 test_dbar ()
245 {
246 __dbar (1);
247 }
248
249 void
250 test_ibar ()
251 {
252 __ibar (1);
253 }
254
255 void
256 test_syscall ()
257 {
258 __syscall (1);
259 }
260
261 void
262 test_break ()
263 {
264 __break (1);
265 }