2 * codegen.c: Tests for the IA64 code generation macros
9 #define IA64_SIMPLE_EMIT_BUNDLE
11 #include <mono/arch/ia64/ia64-codegen.h>
14 mono_disassemble_code (guint8 *code, int size, char *id)
18 const char *tmp = g_get_tmp_dir ();
19 const char *objdump_args = g_getenv ("MONO_OBJDUMP_ARGS");
24 as_file = g_strdup_printf ("%s/test.s", tmp);
26 if (!(ofd = fopen (as_file, "w")))
27 g_assert_not_reached ();
29 for (i = 0; id [i]; ++i) {
30 if (!isalnum (id [i]))
33 fprintf (ofd, "%c", id [i]);
37 for (i = 0; i < size; ++i)
38 fprintf (ofd, ".byte %d\n", (unsigned int) code [i]);
43 #define DIS_CMD "objdump -d"
46 #define DIS_CMD "ia64-linux-gnu-objdump -d"
47 #define AS_CMD "ia64-linux-gnu-as"
50 o_file = g_strdup_printf ("%s/test.o", tmp);
51 cmd = g_strdup_printf (AS_CMD " %s -o %s", as_file, o_file);
57 cmd = g_strdup_printf (DIS_CMD " %s %s", objdump_args, o_file);
68 Ia64CodegenState code;
70 guint8 *buf = g_malloc0 (40960);
72 ia64_codegen_init (code, buf);
74 ia64_add (code, 1, 2, 3);
75 ia64_add1 (code, 1, 2, 3);
76 ia64_sub (code, 1, 2, 3);
77 ia64_sub1 (code, 1, 2, 3);
78 ia64_addp4 (code, 1, 2, 3);
79 ia64_and (code, 1, 2, 3);
80 ia64_andcm (code, 1, 2, 3);
81 ia64_or (code, 1, 2, 3);
82 ia64_xor (code, 1, 2, 3);
83 ia64_shladd (code, 1, 2, 3, 4);
84 ia64_shladdp4 (code, 1, 2, 3, 4);
85 ia64_sub_imm (code, 1, 0x7f, 2);
86 ia64_sub_imm (code, 1, -1, 2);
87 ia64_and_imm (code, 1, -128, 2);
88 ia64_andcm_imm (code, 1, -128, 2);
89 ia64_or_imm (code, 1, -128, 2);
90 ia64_xor_imm (code, 1, -128, 2);
91 ia64_adds_imm (code, 1, 8191, 2);
92 ia64_adds_imm (code, 1, -8192, 2);
93 ia64_adds_imm (code, 1, 1234, 2);
94 ia64_adds_imm (code, 1, -1234, 2);
95 ia64_addp4_imm (code, 1, -1234, 2);
96 ia64_addl_imm (code, 1, 1234, 2);
97 ia64_addl_imm (code, 1, -1234, 2);
98 ia64_addl_imm (code, 1, 2097151, 2);
99 ia64_addl_imm (code, 1, -2097152, 2);
101 ia64_cmp_lt (code, 1, 2, 1, 2);
102 ia64_cmp_ltu (code, 1, 2, 1, 2);
103 ia64_cmp_eq (code, 1, 2, 1, 2);
104 ia64_cmp_lt_unc (code, 1, 2, 1, 2);
105 ia64_cmp_ltu_unc (code, 1, 2, 1, 2);
106 ia64_cmp_eq_unc (code, 1, 2, 1, 2);
107 ia64_cmp_eq_and (code, 1, 2, 1, 2);
108 ia64_cmp_eq_or (code, 1, 2, 1, 2);
109 ia64_cmp_eq_or_andcm (code, 1, 2, 1, 2);
110 ia64_cmp_ne_and (code, 1, 2, 1, 2);
111 ia64_cmp_ne_or (code, 1, 2, 1, 2);
112 ia64_cmp_ne_or_andcm (code, 1, 2, 1, 2);
114 ia64_cmp4_lt (code, 1, 2, 1, 2);
115 ia64_cmp4_ltu (code, 1, 2, 1, 2);
116 ia64_cmp4_eq (code, 1, 2, 1, 2);
117 ia64_cmp4_lt_unc (code, 1, 2, 1, 2);
118 ia64_cmp4_ltu_unc (code, 1, 2, 1, 2);
119 ia64_cmp4_eq_unc (code, 1, 2, 1, 2);
120 ia64_cmp4_eq_and (code, 1, 2, 1, 2);
121 ia64_cmp4_eq_or (code, 1, 2, 1, 2);
122 ia64_cmp4_eq_or_andcm (code, 1, 2, 1, 2);
123 ia64_cmp4_ne_and (code, 1, 2, 1, 2);
124 ia64_cmp4_ne_or (code, 1, 2, 1, 2);
125 ia64_cmp4_ne_or_andcm (code, 1, 2, 1, 2);
127 ia64_cmp_gt_and (code, 1, 2, 0, 2);
128 ia64_cmp_gt_or (code, 1, 2, 0, 2);
129 ia64_cmp_gt_or_andcm (code, 1, 2, 0, 2);
130 ia64_cmp_le_and (code, 1, 2, 0, 2);
131 ia64_cmp_le_or (code, 1, 2, 0, 2);
132 ia64_cmp_le_or_andcm (code, 1, 2, 0, 2);
133 ia64_cmp_ge_and (code, 1, 2, 0, 2);
134 ia64_cmp_ge_or (code, 1, 2, 0, 2);
135 ia64_cmp_ge_or_andcm (code, 1, 2, 0, 2);
136 ia64_cmp_lt_and (code, 1, 2, 0, 2);
137 ia64_cmp_lt_or (code, 1, 2, 0, 2);
138 ia64_cmp_lt_or_andcm (code, 1, 2, 0, 2);
140 ia64_cmp4_gt_and (code, 1, 2, 0, 2);
141 ia64_cmp4_gt_or (code, 1, 2, 0, 2);
142 ia64_cmp4_gt_or_andcm (code, 1, 2, 0, 2);
143 ia64_cmp4_le_and (code, 1, 2, 0, 2);
144 ia64_cmp4_le_or (code, 1, 2, 0, 2);
145 ia64_cmp4_le_or_andcm (code, 1, 2, 0, 2);
146 ia64_cmp4_ge_and (code, 1, 2, 0, 2);
147 ia64_cmp4_ge_or (code, 1, 2, 0, 2);
148 ia64_cmp4_ge_or_andcm (code, 1, 2, 0, 2);
149 ia64_cmp4_lt_and (code, 1, 2, 0, 2);
150 ia64_cmp4_lt_or (code, 1, 2, 0, 2);
151 ia64_cmp4_lt_or_andcm (code, 1, 2, 0, 2);
153 ia64_cmp_lt_imm (code, 1, 2, 127, 2);
154 ia64_cmp_lt_imm (code, 1, 2, -128, 2);
156 ia64_cmp_lt_imm (code, 1, 2, -128, 2);
157 ia64_cmp_ltu_imm (code, 1, 2, -128, 2);
158 ia64_cmp_eq_imm (code, 1, 2, -128, 2);
159 ia64_cmp_lt_unc_imm (code, 1, 2, -128, 2);
160 ia64_cmp_ltu_unc_imm (code, 1, 2, -128, 2);
161 ia64_cmp_eq_unc_imm (code, 1, 2, -128, 2);
162 ia64_cmp_eq_and_imm (code, 1, 2, -128, 2);
163 ia64_cmp_eq_or_imm (code, 1, 2, -128, 2);
164 ia64_cmp_eq_unc_imm (code, 1, 2, -128, 2);
165 ia64_cmp_ne_and_imm (code, 1, 2, -128, 2);
166 ia64_cmp_ne_or_imm (code, 1, 2, -128, 2);
167 ia64_cmp_ne_or_andcm_imm (code, 1, 2, -128, 2);
169 ia64_cmp4_lt_imm (code, 1, 2, -128, 2);
170 ia64_cmp4_ltu_imm (code, 1, 2, -128, 2);
171 ia64_cmp4_eq_imm (code, 1, 2, -128, 2);
172 ia64_cmp4_lt_unc_imm (code, 1, 2, -128, 2);
173 ia64_cmp4_ltu_unc_imm (code, 1, 2, -128, 2);
174 ia64_cmp4_eq_unc_imm (code, 1, 2, -128, 2);
175 ia64_cmp4_eq_and_imm (code, 1, 2, -128, 2);
176 ia64_cmp4_eq_or_imm (code, 1, 2, -128, 2);
177 ia64_cmp4_eq_unc_imm (code, 1, 2, -128, 2);
178 ia64_cmp4_ne_and_imm (code, 1, 2, -128, 2);
179 ia64_cmp4_ne_or_imm (code, 1, 2, -128, 2);
180 ia64_cmp4_ne_or_andcm_imm (code, 1, 2, -128, 2);
182 ia64_padd1 (code, 1, 2, 3);
183 ia64_padd2 (code, 1, 2, 3);
184 ia64_padd4 (code, 1, 2, 3);
185 ia64_padd1_sss (code, 1, 2, 3);
186 ia64_padd2_sss (code, 1, 2, 3);
187 ia64_padd1_uuu (code, 1, 2, 3);
188 ia64_padd2_uuu (code, 1, 2, 3);
189 ia64_padd1_uus (code, 1, 2, 3);
190 ia64_padd2_uus (code, 1, 2, 3);
192 ia64_psub1 (code, 1, 2, 3);
193 ia64_psub2 (code, 1, 2, 3);
194 ia64_psub4 (code, 1, 2, 3);
195 ia64_psub1_sss (code, 1, 2, 3);
196 ia64_psub2_sss (code, 1, 2, 3);
197 ia64_psub1_uuu (code, 1, 2, 3);
198 ia64_psub2_uuu (code, 1, 2, 3);
199 ia64_psub1_uus (code, 1, 2, 3);
200 ia64_psub2_uus (code, 1, 2, 3);
202 ia64_pavg1 (code, 1, 2, 3);
203 ia64_pavg2 (code, 1, 2, 3);
204 ia64_pavg1_raz (code, 1, 2, 3);
205 ia64_pavg2_raz (code, 1, 2, 3);
206 ia64_pavgsub1 (code, 1, 2, 3);
207 ia64_pavgsub2 (code, 1, 2, 3);
208 ia64_pcmp1_eq (code, 1, 2, 3);
209 ia64_pcmp2_eq (code, 1, 2, 3);
210 ia64_pcmp4_eq (code, 1, 2, 3);
211 ia64_pcmp1_gt (code, 1, 2, 3);
212 ia64_pcmp2_gt (code, 1, 2, 3);
213 ia64_pcmp4_gt (code, 1, 2, 3);
215 ia64_pshladd2 (code, 1, 2, 3, 4);
216 ia64_pshradd2 (code, 1, 2, 3, 4);
218 ia64_pmpyshr2 (code, 1, 2, 3, 0);
219 ia64_pmpyshr2_u (code, 1, 2, 3, 0);
220 ia64_pmpyshr2 (code, 1, 2, 3, 7);
221 ia64_pmpyshr2_u (code, 1, 2, 3, 7);
222 ia64_pmpyshr2 (code, 1, 2, 3, 15);
223 ia64_pmpyshr2_u (code, 1, 2, 3, 15);
224 ia64_pmpyshr2 (code, 1, 2, 3, 16);
225 ia64_pmpyshr2_u (code, 1, 2, 3, 16);
227 ia64_pmpy2_r (code, 1, 2, 3);
228 ia64_pmpy2_l (code, 1, 2, 3);
229 ia64_mix1_r (code, 1, 2, 3);
230 ia64_mix2_r (code, 1, 2, 3);
231 ia64_mix4_r (code, 1, 2, 3);
232 ia64_mix1_l (code, 1, 2, 3);
233 ia64_mix2_l (code, 1, 2, 3);
234 ia64_mix4_l (code, 1, 2, 3);
235 ia64_pack2_uss (code, 1, 2, 3);
236 ia64_pack2_sss (code, 1, 2, 3);
237 ia64_pack4_sss (code, 1, 2, 3);
238 ia64_unpack1_h (code, 1, 2, 3);
239 ia64_unpack2_h (code, 1, 2, 3);
240 ia64_unpack4_h (code, 1, 2, 3);
241 ia64_unpack1_l (code, 1, 2, 3);
242 ia64_unpack2_l (code, 1, 2, 3);
243 ia64_unpack4_l (code, 1, 2, 3);
244 ia64_pmin1_u (code, 1, 2, 3);
245 ia64_pmax1_u (code, 1, 2, 3);
246 ia64_pmin2 (code, 1, 2, 3);
247 ia64_pmax2 (code, 1, 2, 3);
248 ia64_psad1 (code, 1, 2, 3);
250 ia64_mux1 (code, 1, 2, IA64_MUX1_BRCST);
251 ia64_mux1 (code, 1, 2, IA64_MUX1_MIX);
252 ia64_mux1 (code, 1, 2, IA64_MUX1_SHUF);
253 ia64_mux1 (code, 1, 2, IA64_MUX1_ALT);
254 ia64_mux1 (code, 1, 2, IA64_MUX1_REV);
256 ia64_mux2 (code, 1, 2, 0x8d);
258 ia64_pshr2 (code, 1, 2, 3);
259 ia64_pshr4 (code, 1, 2, 3);
260 ia64_shr (code, 1, 2, 3);
261 ia64_pshr2_u (code, 1, 2, 3);
262 ia64_pshr4_u (code, 1, 2, 3);
263 ia64_shr_u (code, 1, 2, 3);
265 ia64_pshr2_imm (code, 1, 2, 20);
266 ia64_pshr4_imm (code, 1, 2, 20);
267 ia64_pshr2_u_imm (code, 1, 2, 20);
268 ia64_pshr4_u_imm (code, 1, 2, 20);
270 ia64_pshl2 (code, 1, 2, 3);
271 ia64_pshl4 (code, 1, 2, 3);
272 ia64_shl (code, 1, 2, 3);
274 ia64_pshl2_imm (code, 1, 2, 20);
275 ia64_pshl4_imm (code, 1, 2, 20);
277 ia64_popcnt (code, 1, 2);
279 ia64_shrp (code, 1, 2, 3, 62);
281 ia64_extr_u (code, 1, 2, 62, 61);
282 ia64_extr (code, 1, 2, 62, 61);
284 ia64_dep_z (code, 1, 2, 62, 61);
286 ia64_dep_z_imm (code, 1, 127, 62, 61);
287 ia64_dep_z_imm (code, 1, -128, 62, 61);
288 ia64_dep_imm (code, 1, 0, 2, 62, 61);
289 ia64_dep_imm (code, 1, -1, 2, 62, 61);
290 ia64_dep (code, 1, 2, 3, 10, 15);
292 ia64_tbit_z (code, 1, 2, 3, 0);
294 ia64_tbit_z (code, 1, 2, 3, 63);
295 ia64_tbit_z_unc (code, 1, 2, 3, 63);
296 ia64_tbit_z_and (code, 1, 2, 3, 63);
297 ia64_tbit_nz_and (code, 1, 2, 3, 63);
298 ia64_tbit_z_or (code, 1, 2, 3, 63);
299 ia64_tbit_nz_or (code, 1, 2, 3, 63);
300 ia64_tbit_z_or_andcm (code, 1, 2, 3, 63);
301 ia64_tbit_nz_or_andcm (code, 1, 2, 3, 63);
303 ia64_tnat_z (code, 1, 2, 3);
304 ia64_tnat_z_unc (code, 1, 2, 3);
305 ia64_tnat_z_and (code, 1, 2, 3);
306 ia64_tnat_nz_and (code, 1, 2, 3);
307 ia64_tnat_z_or (code, 1, 2, 3);
308 ia64_tnat_nz_or (code, 1, 2, 3);
309 ia64_tnat_z_or_andcm (code, 1, 2, 3);
310 ia64_tnat_nz_or_andcm (code, 1, 2, 3);
312 ia64_nop_i (code, 0x1234);
313 ia64_hint_i (code, 0x1234);
315 ia64_break_i (code, 0x1234);
317 ia64_chk_s_i (code, 1, 0);
318 ia64_chk_s_i (code, 1, -1);
319 ia64_chk_s_i (code, 1, 1);
321 ia64_mov_to_br_hint (code, 1, 1, -1, IA64_MOV_TO_BR_WH_NONE, 0);
322 ia64_mov_to_br_hint (code, 1, 1, -1, IA64_MOV_TO_BR_WH_SPTK, 0);
323 ia64_mov_to_br_hint (code, 1, 1, -1, IA64_MOV_TO_BR_WH_DPTK, 0);
324 ia64_mov_to_br_hint (code, 1, 1, -1, IA64_MOV_TO_BR_WH_DPTK, IA64_BR_IH_IMP);
325 ia64_mov_ret_to_br_hint (code, 1, 1, -1, IA64_MOV_TO_BR_WH_NONE, 0);
327 ia64_mov_from_br (code, 1, 1);
329 ia64_mov_to_pred (code, 1, 0xfe);
331 ia64_mov_to_pred_rot_imm (code, 0xff0000);
333 ia64_mov_from_ip (code, 1);
334 ia64_mov_from_pred (code, 1);
336 ia64_mov_to_ar_i (code, 1, 1);
338 ia64_mov_to_ar_imm_i (code, 1, 127);
340 ia64_mov_from_ar_i (code, 1, 1);
342 ia64_zxt1 (code, 1, 2);
343 ia64_zxt2 (code, 1, 2);
344 ia64_zxt4 (code, 1, 2);
345 ia64_sxt1 (code, 1, 2);
346 ia64_sxt2 (code, 1, 2);
347 ia64_sxt4 (code, 1, 2);
349 ia64_czx1_l (code, 1, 2);
350 ia64_czx2_l (code, 1, 2);
351 ia64_czx1_r (code, 1, 2);
352 ia64_czx2_r (code, 1, 2);
354 ia64_ld1_hint (code, 1, 2, IA64_LD_HINT_NONE);
355 ia64_ld1_hint (code, 1, 2, IA64_LD_HINT_NT1);
356 ia64_ld1_hint (code, 1, 2, IA64_LD_HINT_NTA);
358 ia64_ld1_hint (code, 1, 2, 0);
359 ia64_ld2_hint (code, 1, 2, 0);
360 ia64_ld4_hint (code, 1, 2, 0);
361 ia64_ld8_hint (code, 1, 2, 0);
363 ia64_ld1_s_hint (code, 1, 2, 0);
364 ia64_ld2_s_hint (code, 1, 2, 0);
365 ia64_ld4_s_hint (code, 1, 2, 0);
366 ia64_ld8_s_hint (code, 1, 2, 0);
368 ia64_ld1_a_hint (code, 1, 2, 0);
369 ia64_ld2_a_hint (code, 1, 2, 0);
370 ia64_ld4_a_hint (code, 1, 2, 0);
371 ia64_ld8_a_hint (code, 1, 2, 0);
373 ia64_ld1_sa_hint (code, 1, 2, 0);
374 ia64_ld2_sa_hint (code, 1, 2, 0);
375 ia64_ld4_sa_hint (code, 1, 2, 0);
376 ia64_ld8_sa_hint (code, 1, 2, 0);
378 ia64_ld1_bias_hint (code, 1, 2, 0);
379 ia64_ld2_bias_hint (code, 1, 2, 0);
380 ia64_ld4_bias_hint (code, 1, 2, 0);
381 ia64_ld8_bias_hint (code, 1, 2, 0);
383 ia64_ld1_inc_hint (code, 1, 2, 3, IA64_LD_HINT_NONE);
385 ia64_ld1_inc_imm_hint (code, 1, 2, 255, IA64_LD_HINT_NONE);
386 ia64_ld1_inc_imm_hint (code, 1, 2, -256, IA64_LD_HINT_NONE);
388 ia64_st1_hint (code, 1, 2, IA64_ST_HINT_NTA);
390 ia64_st1_hint (code, 1, 2, IA64_ST_HINT_NONE);
391 ia64_st2_hint (code, 1, 2, IA64_ST_HINT_NONE);
392 ia64_st4_hint (code, 1, 2, IA64_ST_HINT_NONE);
393 ia64_st8_hint (code, 1, 2, IA64_ST_HINT_NONE);
395 ia64_st1_rel_hint (code, 1, 2, IA64_ST_HINT_NONE);
396 ia64_st2_rel_hint (code, 1, 2, IA64_ST_HINT_NONE);
397 ia64_st4_rel_hint (code, 1, 2, IA64_ST_HINT_NONE);
398 ia64_st8_rel_hint (code, 1, 2, IA64_ST_HINT_NONE);
400 ia64_st8_spill_hint (code, 1, 2, IA64_ST_HINT_NONE);
402 ia64_st16_hint (code, 1, 2, IA64_ST_HINT_NONE);
403 ia64_st16_rel_hint (code, 1, 2, IA64_ST_HINT_NONE);
405 ia64_st1_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
406 ia64_st2_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
407 ia64_st4_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
408 ia64_st8_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
410 ia64_st1_rel_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
411 ia64_st2_rel_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
412 ia64_st4_rel_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
413 ia64_st8_rel_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
415 ia64_st8_spill_inc_imm_hint (code, 1, 2, 255, IA64_ST_HINT_NONE);
417 ia64_ldfs_hint (code, 1, 2, 0);
418 ia64_ldfd_hint (code, 1, 2, 0);
419 ia64_ldf8_hint (code, 1, 2, 0);
420 ia64_ldfe_hint (code, 1, 2, 0);
422 ia64_ldfs_s_hint (code, 1, 2, 0);
423 ia64_ldfd_s_hint (code, 1, 2, 0);
424 ia64_ldf8_s_hint (code, 1, 2, 0);
425 ia64_ldfe_s_hint (code, 1, 2, 0);
427 ia64_ldfs_a_hint (code, 1, 2, 0);
428 ia64_ldfd_a_hint (code, 1, 2, 0);
429 ia64_ldf8_a_hint (code, 1, 2, 0);
430 ia64_ldfe_a_hint (code, 1, 2, 0);
432 ia64_ldfs_sa_hint (code, 1, 2, 0);
433 ia64_ldfd_sa_hint (code, 1, 2, 0);
434 ia64_ldf8_sa_hint (code, 1, 2, 0);
435 ia64_ldfe_sa_hint (code, 1, 2, 0);
437 ia64_ldfs_c_clr_hint (code, 1, 2, 0);
438 ia64_ldfd_c_clr_hint (code, 1, 2, 0);
439 ia64_ldf8_c_clr_hint (code, 1, 2, 0);
440 ia64_ldfe_c_clr_hint (code, 1, 2, 0);
442 ia64_ldfs_c_nc_hint (code, 1, 2, 0);
443 ia64_ldfd_c_nc_hint (code, 1, 2, 0);
444 ia64_ldf8_c_nc_hint (code, 1, 2, 0);
445 ia64_ldfe_c_nc_hint (code, 1, 2, 0);
447 ia64_ldf_fill_hint (code, 1, 2, 0);
449 ia64_ldfs_inc_hint (code, 1, 2, 3, 0);
450 ia64_ldfd_inc_hint (code, 1, 2, 3, 0);
451 ia64_ldf8_inc_hint (code, 1, 2, 3, 0);
452 ia64_ldfe_inc_hint (code, 1, 2, 3, 0);
454 ia64_ldfs_s_inc_hint (code, 1, 2, 3, 0);
455 ia64_ldfd_s_inc_hint (code, 1, 2, 3, 0);
456 ia64_ldf8_s_inc_hint (code, 1, 2, 3, 0);
457 ia64_ldfe_s_inc_hint (code, 1, 2, 3, 0);
459 ia64_ldfs_a_inc_hint (code, 1, 2, 3, 0);
460 ia64_ldfd_a_inc_hint (code, 1, 2, 3, 0);
461 ia64_ldf8_a_inc_hint (code, 1, 2, 3, 0);
462 ia64_ldfe_a_inc_hint (code, 1, 2, 3, 0);
464 ia64_ldfs_sa_inc_hint (code, 1, 2, 3, 0);
465 ia64_ldfd_sa_inc_hint (code, 1, 2, 3, 0);
466 ia64_ldf8_sa_inc_hint (code, 1, 2, 3, 0);
467 ia64_ldfe_sa_inc_hint (code, 1, 2, 3, 0);
469 ia64_ldfs_c_clr_inc_hint (code, 1, 2, 3, 0);
470 ia64_ldfd_c_clr_inc_hint (code, 1, 2, 3, 0);
471 ia64_ldf8_c_clr_inc_hint (code, 1, 2, 3, 0);
472 ia64_ldfe_c_clr_inc_hint (code, 1, 2, 3, 0);
474 ia64_ldfs_c_nc_inc_hint (code, 1, 2, 3, 0);
475 ia64_ldfd_c_nc_inc_hint (code, 1, 2, 3, 0);
476 ia64_ldf8_c_nc_inc_hint (code, 1, 2, 3, 0);
477 ia64_ldfe_c_nc_inc_hint (code, 1, 2, 3, 0);
479 ia64_ldf_fill_inc_hint (code, 1, 2, 3, 0);
481 ia64_ldfs_inc_imm_hint (code, 1, 2, 255, 0);
482 ia64_ldfd_inc_imm_hint (code, 1, 2, 255, 0);
483 ia64_ldf8_inc_imm_hint (code, 1, 2, 255, 0);
484 ia64_ldfe_inc_imm_hint (code, 1, 2, 255, 0);
486 ia64_ldfs_s_inc_imm_hint (code, 1, 2, 255, 0);
487 ia64_ldfd_s_inc_imm_hint (code, 1, 2, 255, 0);
488 ia64_ldf8_s_inc_imm_hint (code, 1, 2, 255, 0);
489 ia64_ldfe_s_inc_imm_hint (code, 1, 2, 255, 0);
491 ia64_ldfs_a_inc_imm_hint (code, 1, 2, 255, 0);
492 ia64_ldfd_a_inc_imm_hint (code, 1, 2, 255, 0);
493 ia64_ldf8_a_inc_imm_hint (code, 1, 2, 255, 0);
494 ia64_ldfe_a_inc_imm_hint (code, 1, 2, 255, 0);
496 ia64_ldfs_sa_inc_imm_hint (code, 1, 2, 255, 0);
497 ia64_ldfd_sa_inc_imm_hint (code, 1, 2, 255, 0);
498 ia64_ldf8_sa_inc_imm_hint (code, 1, 2, 255, 0);
499 ia64_ldfe_sa_inc_imm_hint (code, 1, 2, 255, 0);
501 ia64_ldfs_c_clr_inc_imm_hint (code, 1, 2, 255, 0);
502 ia64_ldfd_c_clr_inc_imm_hint (code, 1, 2, 255, 0);
503 ia64_ldf8_c_clr_inc_imm_hint (code, 1, 2, 255, 0);
504 ia64_ldfe_c_clr_inc_imm_hint (code, 1, 2, 255, 0);
506 ia64_ldfs_c_nc_inc_imm_hint (code, 1, 2, 255, 0);
507 ia64_ldfd_c_nc_inc_imm_hint (code, 1, 2, 255, 0);
508 ia64_ldf8_c_nc_inc_imm_hint (code, 1, 2, 255, 0);
509 ia64_ldfe_c_nc_inc_imm_hint (code, 1, 2, 255, 0);
511 ia64_ldf_fill_inc_imm_hint (code, 1, 2, 255, 0);
513 ia64_stfs_hint (code, 1, 2, 0);
514 ia64_stfd_hint (code, 1, 2, 0);
515 ia64_stf8_hint (code, 1, 2, 0);
516 ia64_stfe_hint (code, 1, 2, 0);
518 ia64_stf_spill_hint (code, 1, 2, 0);
520 ia64_stfs_inc_imm_hint (code, 1, 2, 255, 0);
521 ia64_stfd_inc_imm_hint (code, 1, 2, 255, 0);
522 ia64_stf8_inc_imm_hint (code, 1, 2, 255, 0);
523 ia64_stfe_inc_imm_hint (code, 1, 2, 255, 0);
525 ia64_stf_spill_inc_imm_hint (code, 1, 2, 255, 0);
527 ia64_ldfps_hint (code, 1, 2, 3, 0);
528 ia64_ldfpd_hint (code, 1, 2, 3, 0);
529 ia64_ldfp8_hint (code, 1, 2, 3, 0);
531 ia64_ldfps_s_hint (code, 1, 2, 3, 0);
532 ia64_ldfpd_s_hint (code, 1, 2, 3, 0);
533 ia64_ldfp8_s_hint (code, 1, 2, 3, 0);
535 ia64_ldfps_a_hint (code, 1, 2, 3, 0);
536 ia64_ldfpd_a_hint (code, 1, 2, 3, 0);
537 ia64_ldfp8_a_hint (code, 1, 2, 3, 0);
539 ia64_ldfps_sa_hint (code, 1, 2, 3, 0);
540 ia64_ldfpd_sa_hint (code, 1, 2, 3, 0);
541 ia64_ldfp8_sa_hint (code, 1, 2, 3, 0);
543 ia64_ldfps_c_clr_hint (code, 1, 2, 3, 0);
544 ia64_ldfpd_c_clr_hint (code, 1, 2, 3, 0);
545 ia64_ldfp8_c_clr_hint (code, 1, 2, 3, 0);
547 ia64_ldfps_c_nc_hint (code, 1, 2, 3, 0);
548 ia64_ldfpd_c_nc_hint (code, 1, 2, 3, 0);
549 ia64_ldfp8_c_nc_hint (code, 1, 2, 3, 0);
551 ia64_ldfps_inc_hint (code, 1, 2, 3, 0);
552 ia64_ldfpd_inc_hint (code, 1, 2, 3, 0);
553 ia64_ldfp8_inc_hint (code, 1, 2, 3, 0);
555 ia64_ldfps_s_inc_hint (code, 1, 2, 3, 0);
556 ia64_ldfpd_s_inc_hint (code, 1, 2, 3, 0);
557 ia64_ldfp8_s_inc_hint (code, 1, 2, 3, 0);
559 ia64_ldfps_a_inc_hint (code, 1, 2, 3, 0);
560 ia64_ldfpd_a_inc_hint (code, 1, 2, 3, 0);
561 ia64_ldfp8_a_inc_hint (code, 1, 2, 3, 0);
563 ia64_ldfps_sa_inc_hint (code, 1, 2, 3, 0);
564 ia64_ldfpd_sa_inc_hint (code, 1, 2, 3, 0);
565 ia64_ldfp8_sa_inc_hint (code, 1, 2, 3, 0);
567 ia64_ldfps_c_clr_inc_hint (code, 1, 2, 3, 0);
568 ia64_ldfpd_c_clr_inc_hint (code, 1, 2, 3, 0);
569 ia64_ldfp8_c_clr_inc_hint (code, 1, 2, 3, 0);
571 ia64_ldfps_c_nc_inc_hint (code, 1, 2, 3, 0);
572 ia64_ldfpd_c_nc_inc_hint (code, 1, 2, 3, 0);
573 ia64_ldfp8_c_nc_inc_hint (code, 1, 2, 3, 0);
575 ia64_lfetch_hint (code, 1, 0);
576 ia64_lfetch_excl_hint (code, 1, 0);
577 ia64_lfetch_fault_hint (code, 1, 0);
578 ia64_lfetch_fault_excl_hint (code, 1, 0);
580 ia64_lfetch_hint (code, 1, IA64_LFHINT_NT1);
581 ia64_lfetch_hint (code, 1, IA64_LFHINT_NT2);
582 ia64_lfetch_hint (code, 1, IA64_LFHINT_NTA);
584 ia64_lfetch_inc_hint (code, 1, 2, 0);
585 ia64_lfetch_excl_inc_hint (code, 1, 2, 0);
586 ia64_lfetch_fault_inc_hint (code, 1, 2, 0);
587 ia64_lfetch_fault_excl_inc_hint (code, 1, 2, 0);
589 ia64_lfetch_inc_imm_hint (code, 1, 255, 0);
590 ia64_lfetch_excl_inc_imm_hint (code, 1, 255, 0);
591 ia64_lfetch_fault_inc_imm_hint (code, 1, 255, 0);
592 ia64_lfetch_fault_excl_inc_imm_hint (code, 1, 255, 0);
594 ia64_cmpxchg1_acq_hint (code, 1, 2, 3, 0);
595 ia64_cmpxchg2_acq_hint (code, 1, 2, 3, 0);
596 ia64_cmpxchg4_acq_hint (code, 1, 2, 3, 0);
597 ia64_cmpxchg8_acq_hint (code, 1, 2, 3, 0);
598 ia64_cmpxchg1_rel_hint (code, 1, 2, 3, 0);
599 ia64_cmpxchg2_rel_hint (code, 1, 2, 3, 0);
600 ia64_cmpxchg4_rel_hint (code, 1, 2, 3, 0);
601 ia64_cmpxchg8_rel_hint (code, 1, 2, 3, 0);
602 ia64_cmpxchg16_acq_hint (code, 1, 2, 3, 0);
603 ia64_cmpxchg16_rel_hint (code, 1, 2, 3, 0);
604 ia64_xchg1_hint (code, 1, 2, 3, 0);
605 ia64_xchg2_hint (code, 1, 2, 3, 0);
606 ia64_xchg4_hint (code, 1, 2, 3, 0);
607 ia64_xchg8_hint (code, 1, 2, 3, 0);
609 ia64_fetchadd4_acq_hint (code, 1, 2, -16, 0);
610 ia64_fetchadd4_acq_hint (code, 1, 2, -8, 0);
611 ia64_fetchadd4_acq_hint (code, 1, 2, -4, 0);
612 ia64_fetchadd4_acq_hint (code, 1, 2, -1, 0);
613 ia64_fetchadd4_acq_hint (code, 1, 2, 1, 0);
614 ia64_fetchadd4_acq_hint (code, 1, 2, 4, 0);
615 ia64_fetchadd4_acq_hint (code, 1, 2, 8, 0);
616 ia64_fetchadd4_acq_hint (code, 1, 2, 16, 0);
618 ia64_fetchadd4_acq_hint (code, 1, 2, 16, 0);
619 ia64_fetchadd8_acq_hint (code, 1, 2, 16, 0);
620 ia64_fetchadd4_rel_hint (code, 1, 2, 16, 0);
621 ia64_fetchadd8_rel_hint (code, 1, 2, 16, 0);
623 ia64_setf_sig (code, 1, 2);
624 ia64_setf_exp (code, 1, 2);
625 ia64_setf_s (code, 1, 2);
626 ia64_setf_d (code, 1, 2);
628 ia64_getf_sig (code, 1, 2);
629 ia64_getf_exp (code, 1, 2);
630 ia64_getf_s (code, 1, 2);
631 ia64_getf_d (code, 1, 2);
633 ia64_chk_s_m (code, 1, 0);
634 ia64_chk_s_m (code, 1, 1);
635 ia64_chk_s_m (code, 1, -1);
637 ia64_chk_s_float_m (code, 1, 0);
639 ia64_chk_a_nc (code, 1, 0);
640 ia64_chk_a_nc (code, 1, 1);
641 ia64_chk_a_nc (code, 1, -1);
643 ia64_chk_a_nc (code, 1, 0);
644 ia64_chk_a_clr (code, 1, 0);
646 ia64_chk_a_nc_float (code, 1, 0);
647 ia64_chk_a_clr_float (code, 1, 0);
660 ia64_invala_e (code, 1);
661 ia64_invala_e_float (code, 1);
666 ia64_mov_to_ar_m (code, 1, 1);
668 ia64_mov_to_ar_imm_m (code, 1, 127);
670 ia64_mov_from_ar_m (code, 1, 1);
672 ia64_mov_to_cr (code, 1, 2);
674 ia64_mov_from_cr (code, 1, 2);
676 ia64_alloc (code, 1, 3, 4, 5, 0);
677 ia64_alloc (code, 1, 3, 4, 5, 8);
679 ia64_mov_to_psr_l (code, 1);
680 ia64_mov_to_psr_um (code, 1);
682 ia64_mov_from_psr (code, 1);
683 ia64_mov_from_psr_um (code, 1);
685 ia64_break_m (code, 0x1234);
686 ia64_nop_m (code, 0x1234);
687 ia64_hint_m (code, 0x1234);
689 ia64_br_cond_hint (code, 0, 0, 0, 0);
690 ia64_br_wexit_hint (code, 0, 0, 0, 0);
691 ia64_br_wtop_hint (code, 0, 0, 0, 0);
693 ia64_br_cloop_hint (code, 0, 0, 0, 0);
694 ia64_br_cexit_hint (code, 0, 0, 0, 0);
695 ia64_br_ctop_hint (code, 0, 0, 0, 0);
697 ia64_br_call_hint (code, 1, 0, 0, 0, 0);
699 ia64_br_cond_reg_hint (code, 1, 0, 0, 0);
700 ia64_br_ia_reg_hint (code, 1, 0, 0, 0);
701 ia64_br_ret_reg_hint (code, 1, 0, 0, 0);
703 ia64_br_call_reg_hint (code, 1, 2, 0, 0, 0);
707 ia64_clrrrb_pr (code);
713 ia64_break_b (code, 0x1234);
714 ia64_nop_b (code, 0x1234);
715 ia64_hint_b (code, 0x1234);
717 ia64_break_x (code, 0x2123456789ABCDEFULL);
719 ia64_movl (code, 1, 0x123456789ABCDEF0LL);
721 ia64_brl_cond_hint (code, 0, 0, 0, 0);
722 ia64_brl_cond_hint (code, -1, 0, 0, 0);
724 ia64_brl_call_hint (code, 1, 0, 0, 0, 0);
725 ia64_brl_call_hint (code, 1, -1, 0, 0, 0);
727 ia64_nop_x (code, 0x2123456789ABCDEFULL);
728 ia64_hint_x (code, 0x2123456789ABCDEFULL);
730 ia64_movl_pred (code, 1, 1, 0x123456789ABCDEF0LL);
733 ia64_fma_sf_pred (code, 1, 1, 2, 3, 4, 2);
734 ia64_fma_s_sf_pred (code, 1, 1, 2, 3, 4, 2);
735 ia64_fma_d_sf_pred (code, 1, 1, 2, 3, 4, 2);
736 ia64_fpma_sf_pred (code, 1, 1, 2, 3, 4, 2);
737 ia64_fms_sf_pred (code, 1, 1, 2, 3, 4, 2);
738 ia64_fms_s_sf_pred (code, 1, 1, 2, 3, 4, 2);
739 ia64_fms_d_sf_pred (code, 1, 1, 2, 3, 4, 2);
740 ia64_fpms_sf_pred (code, 1, 1, 2, 3, 4, 2);
741 ia64_fnma_sf_pred (code, 1, 1, 2, 3, 4, 2);
742 ia64_fnma_s_sf_pred (code, 1, 1, 2, 3, 4, 2);
743 ia64_fnma_d_sf_pred (code, 1, 1, 2, 3, 4, 2);
744 ia64_fpnma_sf_pred (code, 1, 1, 2, 3, 4, 2);
746 ia64_xma_l_pred (code, 1, 1, 2, 3, 4);
747 ia64_xma_h_pred (code, 1, 1, 2, 3, 4);
748 ia64_xma_hu_pred (code, 1, 1, 2, 3, 4);
750 ia64_fselect_pred (code, 1, 1, 2, 3, 4);
752 ia64_fcmp_eq_sf_pred (code, 1, 1, 2, 3, 4, 0);
753 ia64_fcmp_lt_sf_pred (code, 1, 1, 2, 3, 4, 0);
754 ia64_fcmp_le_sf_pred (code, 1, 1, 2, 3, 4, 0);
755 ia64_fcmp_unord_sf_pred (code, 1, 1, 2, 3, 4, 0);
756 ia64_fcmp_eq_unc_sf_pred (code, 1, 1, 2, 3, 4, 0);
757 ia64_fcmp_lt_unc_sf_pred (code, 1, 1, 2, 3, 4, 0);
758 ia64_fcmp_le_unc_sf_pred (code, 1, 1, 2, 3, 4, 0);
759 ia64_fcmp_unord_unc_sf_pred (code, 1, 1, 2, 3, 4, 0);
761 ia64_fclass_m_pred (code, 1, 1, 2, 3, 0x1ff);
762 ia64_fclass_m_unc_pred (code, 1, 1, 2, 3, 0x1ff);
764 ia64_frcpa_sf_pred (code, 1, 1, 2, 3, 4, 0);
765 ia64_fprcpa_sf_pred (code, 1, 1, 2, 3, 4, 0);
767 ia64_frsqrta_sf_pred (code, 1, 1, 2, 4, 0);
768 ia64_fprsqrta_sf_pred (code, 1, 1, 2, 4, 0);
770 ia64_fmin_sf_pred (code, 1, 2, 3, 4, 0);
771 ia64_fman_sf_pred (code, 1, 2, 3, 4, 0);
772 ia64_famin_sf_pred (code, 1, 2, 3, 4, 0);
773 ia64_famax_sf_pred (code, 1, 2, 3, 4, 0);
774 ia64_fpmin_sf_pred (code, 1, 2, 3, 4, 0);
775 ia64_fpman_sf_pred (code, 1, 2, 3, 4, 0);
776 ia64_fpamin_sf_pred (code, 1, 2, 3, 4, 0);
777 ia64_fpamax_sf_pred (code, 1, 2, 3, 4, 0);
778 ia64_fpcmp_eq_sf_pred (code, 1, 2, 3, 4, 0);
779 ia64_fpcmp_lt_sf_pred (code, 1, 2, 3, 4, 0);
780 ia64_fpcmp_le_sf_pred (code, 1, 2, 3, 4, 0);
781 ia64_fpcmp_unord_sf_pred (code, 1, 2, 3, 4, 0);
782 ia64_fpcmp_neq_sf_pred (code, 1, 2, 3, 4, 0);
783 ia64_fpcmp_nlt_sf_pred (code, 1, 2, 3, 4, 0);
784 ia64_fpcmp_nle_sf_pred (code, 1, 2, 3, 4, 0);
785 ia64_fpcmp_ord_sf_pred (code, 1, 2, 3, 4, 0);
787 ia64_fmerge_s_pred (code, 1, 2, 3, 4);
788 ia64_fmerge_ns_pred (code, 1, 2, 3, 4);
789 ia64_fmerge_se_pred (code, 1, 2, 3, 4);
790 ia64_fmix_lr_pred (code, 1, 2, 3, 4);
791 ia64_fmix_r_pred (code, 1, 2, 3, 4);
792 ia64_fmix_l_pred (code, 1, 2, 3, 4);
793 ia64_fsxt_r_pred (code, 1, 2, 3, 4);
794 ia64_fsxt_l_pred (code, 1, 2, 3, 4);
795 ia64_fpack_pred (code, 1, 2, 3, 4);
796 ia64_fswap_pred (code, 1, 2, 3, 4);
797 ia64_fswap_nl_pred (code, 1, 2, 3, 4);
798 ia64_fswap_nr_pred (code, 1, 2, 3, 4);
799 ia64_fand_pred (code, 1, 2, 3, 4);
800 ia64_fandcm_pred (code, 1, 2, 3, 4);
801 ia64_for_pred (code, 1, 2, 3, 4);
802 ia64_fxor_pred (code, 1, 2, 3, 4);
803 ia64_fpmerge_s_pred (code, 1, 2, 3, 4);
804 ia64_fpmerge_ns_pred (code, 1, 2, 3, 4);
805 ia64_fpmerge_se_pred (code, 1, 2, 3, 4);
807 ia64_fcvt_fx_sf_pred ((code), 1, 2, 3, 0);
808 ia64_fcvt_fxu_sf_pred ((code), 1, 2, 3, 0);
809 ia64_fcvt_fx_trunc_sf_pred ((code), 1, 2, 3, 0);
810 ia64_fcvt_fxu_trunc_sf_pred ((code), 1, 2, 3, 0);
811 ia64_fpcvt_fx_sf_pred ((code), 1, 2, 3, 0);
812 ia64_fpcvt_fxu_sf_pred ((code), 1, 2, 3, 0);
813 ia64_fpcvt_fx_trunc_sf_pred ((code), 1, 2, 3, 0);
814 ia64_fpcvt_fxu_trunc_sf_pred ((code), 1, 2, 3, 0);
816 ia64_fcvt_xf_pred ((code), 1, 2, 3);
818 ia64_fsetc_sf_pred ((code), 1, 0x33, 0x33, 3);
820 ia64_fclrf_sf_pred ((code), 1, 3);
822 ia64_fchkf_sf_pred ((code), 1, -1, 3);
824 ia64_break_f_pred ((code), 1, 0x1234);
826 ia64_movl (code, 31, -123456);
828 ia64_codegen_close (code);
833 guint8 *buf = code.buf;
836 guint64 ins1, ins2, ins3;
838 ia64_break_i (code, 0x1234);
840 ia64_codegen_close (code);
842 dw1 = ((guint64*)buf) [0];
843 dw2 = ((guint64*)buf) [1];
845 template = ia64_bundle_template (buf);
846 ins1 = ia64_bundle_ins1 (buf);
847 ins2 = ia64_bundle_ins2 (buf);
848 ins3 = ia64_bundle_ins3 (buf);
851 ia64_emit_bundle_template (&code, template, ins1, ins2, ins3);
853 g_assert (dw1 == ((guint64*)buf) [0]);
854 g_assert (dw2 == ((guint64*)buf) [1]);
858 mono_disassemble_code (buf, 40960, "code");