1 ;; IA-64 machine description for vector operations.
2 ;; Copyright (C) 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
21 ;; Integer vector operations
23 (define_mode_iterator VECINT [V8QI V4HI V2SI])
24 (define_mode_iterator VECINT12 [V8QI V4HI])
25 (define_mode_iterator VECINT24 [V4HI V2SI])
26 (define_mode_attr vecsize [(V8QI "1") (V4HI "2") (V2SI "4")])
27 (define_mode_attr vecwider [(V8QI "V4HI") (V4HI "V2SI")])
29 (define_expand "mov<mode>"
30 [(set (match_operand:VECINT 0 "general_operand" "")
31 (match_operand:VECINT 1 "general_operand" ""))]
34 rtx op1 = ia64_expand_move (operands[0], operands[1]);
40 (define_insn "*mov<mode>_internal"
41 [(set (match_operand:VECINT 0 "destination_operand"
42 "=r,r,r,r,m ,*f ,*f,Q ,r ,*f")
43 (match_operand:VECINT 1 "move_operand"
44 "rU,W,i,m,rU,U*f,Q ,*f,*f,r "))]
45 "ia64_move_ok (operands[0], operands[1])"
57 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,fmisc,fld,stf,frfr,tofr")])
59 (define_insn "one_cmpl<mode>2"
60 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
61 (not:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")))]
64 [(set_attr "itanium_class" "ilog")])
66 (define_insn "and<mode>3"
67 [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
69 (match_operand:VECINT 1 "grfr_register_operand" "r,*f")
70 (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
75 [(set_attr "itanium_class" "ilog,fmisc")])
77 (define_insn "*andnot<mode>"
78 [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
80 (not:VECINT (match_operand:VECINT 1 "grfr_register_operand" "r,*f"))
81 (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
86 [(set_attr "itanium_class" "ilog,fmisc")])
88 (define_insn "ior<mode>3"
89 [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
91 (match_operand:VECINT 1 "grfr_register_operand" "r,*f")
92 (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
97 [(set_attr "itanium_class" "ilog,fmisc")])
99 (define_insn "xor<mode>3"
100 [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
102 (match_operand:VECINT 1 "grfr_register_operand" "r,*f")
103 (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
108 [(set_attr "itanium_class" "ilog,fmisc")])
110 (define_insn "neg<mode>2"
111 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
112 (neg:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")))]
114 "psub<vecsize> %0 = r0, %1"
115 [(set_attr "itanium_class" "mmalua")])
117 (define_insn "add<mode>3"
118 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
119 (plus:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")
120 (match_operand:VECINT 2 "gr_register_operand" "r")))]
122 "padd<vecsize> %0 = %1, %2"
123 [(set_attr "itanium_class" "mmalua")])
125 (define_insn "*ssadd<mode>3"
126 [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
128 (match_operand:VECINT12 1 "gr_register_operand" "r")
129 (match_operand:VECINT12 2 "gr_register_operand" "r")))]
131 "padd<vecsize>.sss %0 = %1, %2"
132 [(set_attr "itanium_class" "mmalua")])
134 (define_insn "*usadd<mode>3"
135 [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
137 (match_operand:VECINT12 1 "gr_register_operand" "r")
138 (match_operand:VECINT12 2 "gr_register_operand" "r")))]
140 "padd<vecsize>.uuu %0 = %1, %2"
141 [(set_attr "itanium_class" "mmalua")])
143 (define_insn "sub<mode>3"
144 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
145 (minus:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")
146 (match_operand:VECINT 2 "gr_register_operand" "r")))]
148 "psub<vecsize> %0 = %1, %2"
149 [(set_attr "itanium_class" "mmalua")])
151 (define_insn "*sssub<mode>3"
152 [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
154 (match_operand:VECINT12 1 "gr_register_operand" "r")
155 (match_operand:VECINT12 2 "gr_register_operand" "r")))]
157 "psub<vecsize>.sss %0 = %1, %2"
158 [(set_attr "itanium_class" "mmalua")])
160 (define_insn "*ussub<mode>3"
161 [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
163 (match_operand:VECINT12 1 "gr_register_operand" "r")
164 (match_operand:VECINT12 2 "gr_register_operand" "r")))]
166 "psub<vecsize>.uuu %0 = %1, %2"
167 [(set_attr "itanium_class" "mmalua")])
169 (define_expand "mulv8qi3"
170 [(set (match_operand:V8QI 0 "gr_register_operand" "")
171 (mult:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
172 (match_operand:V8QI 2 "gr_register_operand" "r")))]
175 rtx l = gen_reg_rtx (V4HImode);
176 rtx h = gen_reg_rtx (V4HImode);
177 emit_insn (gen_vec_widen_umult_lo_v8qi (l, operands[1], operands[2]));
178 emit_insn (gen_vec_widen_umult_hi_v8qi (h, operands[1], operands[2]));
179 if (TARGET_BIG_ENDIAN)
180 emit_insn (gen_vec_pack_trunc_v4hi (operands[0], h, l));
182 emit_insn (gen_vec_pack_trunc_v4hi (operands[0], l, h));
186 (define_expand "vec_widen_umult_lo_v8qi"
187 [(match_operand:V4HI 0 "gr_register_operand" "")
188 (match_operand:V8QI 1 "gr_register_operand" "")
189 (match_operand:V8QI 2 "gr_register_operand" "")]
192 rtx op1 = gen_reg_rtx (V4HImode);
193 rtx op2 = gen_reg_rtx (V4HImode);
194 emit_insn (gen_vec_unpacku_lo_v8qi (op1, operands[1]));
195 emit_insn (gen_vec_unpacku_lo_v8qi (op2, operands[2]));
196 emit_insn (gen_mulv4hi3 (operands[0], op1, op2));
200 (define_expand "vec_widen_umult_hi_v8qi"
201 [(match_operand:V4HI 0 "gr_register_operand" "")
202 (match_operand:V8QI 1 "gr_register_operand" "")
203 (match_operand:V8QI 2 "gr_register_operand" "")]
206 rtx op1 = gen_reg_rtx (V4HImode);
207 rtx op2 = gen_reg_rtx (V4HImode);
208 emit_insn (gen_vec_unpacku_hi_v8qi (op1, operands[1]));
209 emit_insn (gen_vec_unpacku_hi_v8qi (op2, operands[2]));
210 emit_insn (gen_mulv4hi3 (operands[0], op1, op2));
214 (define_expand "vec_widen_smult_lo_v8qi"
215 [(match_operand:V4HI 0 "gr_register_operand" "")
216 (match_operand:V8QI 1 "gr_register_operand" "")
217 (match_operand:V8QI 2 "gr_register_operand" "")]
220 rtx op1 = gen_reg_rtx (V4HImode);
221 rtx op2 = gen_reg_rtx (V4HImode);
222 emit_insn (gen_vec_unpacks_lo_v8qi (op1, operands[1]));
223 emit_insn (gen_vec_unpacks_lo_v8qi (op2, operands[2]));
224 emit_insn (gen_mulv4hi3 (operands[0], op1, op2));
228 (define_expand "vec_widen_smult_hi_v8qi"
229 [(match_operand:V4HI 0 "gr_register_operand" "")
230 (match_operand:V8QI 1 "gr_register_operand" "")
231 (match_operand:V8QI 2 "gr_register_operand" "")]
234 rtx op1 = gen_reg_rtx (V4HImode);
235 rtx op2 = gen_reg_rtx (V4HImode);
236 emit_insn (gen_vec_unpacks_hi_v8qi (op1, operands[1]));
237 emit_insn (gen_vec_unpacks_hi_v8qi (op2, operands[2]));
238 emit_insn (gen_mulv4hi3 (operands[0], op1, op2));
242 (define_insn "mulv4hi3"
243 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
244 (mult:V4HI (match_operand:V4HI 1 "gr_register_operand" "r")
245 (match_operand:V4HI 2 "gr_register_operand" "r")))]
247 "pmpyshr2 %0 = %1, %2, 0"
248 [(set_attr "itanium_class" "mmmul")])
250 (define_insn "pmpyshr2"
251 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
256 (match_operand:V4HI 1 "gr_register_operand" "r"))
258 (match_operand:V4HI 2 "gr_register_operand" "r")))
259 (match_operand:SI 3 "pmpyshr_operand" "n"))))]
261 "pmpyshr2 %0 = %1, %2, %3"
262 [(set_attr "itanium_class" "mmmul")])
264 (define_insn "pmpyshr2_u"
265 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
270 (match_operand:V4HI 1 "gr_register_operand" "r"))
272 (match_operand:V4HI 2 "gr_register_operand" "r")))
273 (match_operand:SI 3 "pmpyshr_operand" "n"))))]
275 "pmpyshr2.u %0 = %1, %2, %3"
276 [(set_attr "itanium_class" "mmmul")])
278 (define_insn "pmpy2_even"
279 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
283 (match_operand:V4HI 1 "gr_register_operand" "r"))
284 (parallel [(const_int 0) (const_int 2)]))
287 (match_operand:V4HI 2 "gr_register_operand" "r"))
288 (parallel [(const_int 0) (const_int 2)]))))]
291 /* Recall that vector elements are numbered in memory order. */
292 if (TARGET_BIG_ENDIAN)
293 return "%,pmpy2.l %0 = %1, %2";
295 return "%,pmpy2.r %0 = %1, %2";
297 [(set_attr "itanium_class" "mmshf")])
299 (define_insn "pmpy2_odd"
300 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
304 (match_operand:V4HI 1 "gr_register_operand" "r"))
305 (parallel [(const_int 1) (const_int 3)]))
308 (match_operand:V4HI 2 "gr_register_operand" "r"))
309 (parallel [(const_int 1) (const_int 3)]))))]
312 /* Recall that vector elements are numbered in memory order. */
313 if (TARGET_BIG_ENDIAN)
314 return "%,pmpy2.r %0 = %1, %2";
316 return "%,pmpy2.l %0 = %1, %2";
318 [(set_attr "itanium_class" "mmshf")])
320 (define_expand "vec_widen_smult_lo_v4hi"
321 [(match_operand:V2SI 0 "gr_register_operand" "")
322 (match_operand:V4HI 1 "gr_register_operand" "")
323 (match_operand:V4HI 2 "gr_register_operand" "")]
326 rtx l = gen_reg_rtx (V4HImode);
327 rtx h = gen_reg_rtx (V4HImode);
328 emit_insn (gen_mulv4hi3 (l, operands[1], operands[2]));
329 emit_insn (gen_pmpyshr2 (h, operands[1], operands[2], GEN_INT (16)));
330 ia64_unpack_assemble (operands[0], l, h, false);
334 (define_expand "vec_widen_smult_hi_v4hi"
335 [(match_operand:V2SI 0 "gr_register_operand" "")
336 (match_operand:V4HI 1 "gr_register_operand" "")
337 (match_operand:V4HI 2 "gr_register_operand" "")]
340 rtx l = gen_reg_rtx (V4HImode);
341 rtx h = gen_reg_rtx (V4HImode);
342 emit_insn (gen_mulv4hi3 (l, operands[1], operands[2]));
343 emit_insn (gen_pmpyshr2 (h, operands[1], operands[2], GEN_INT (16)));
344 ia64_unpack_assemble (operands[0], l, h, true);
348 (define_expand "vec_widen_umult_lo_v4hi"
349 [(match_operand:V2SI 0 "gr_register_operand" "")
350 (match_operand:V4HI 1 "gr_register_operand" "")
351 (match_operand:V4HI 2 "gr_register_operand" "")]
354 rtx l = gen_reg_rtx (V4HImode);
355 rtx h = gen_reg_rtx (V4HImode);
356 emit_insn (gen_mulv4hi3 (l, operands[1], operands[2]));
357 emit_insn (gen_pmpyshr2_u (h, operands[1], operands[2], GEN_INT (16)));
358 ia64_unpack_assemble (operands[0], l, h, false);
362 (define_expand "vec_widen_umult_hi_v4hi"
363 [(match_operand:V2SI 0 "gr_register_operand" "")
364 (match_operand:V4HI 1 "gr_register_operand" "")
365 (match_operand:V4HI 2 "gr_register_operand" "")]
368 rtx l = gen_reg_rtx (V4HImode);
369 rtx h = gen_reg_rtx (V4HImode);
370 emit_insn (gen_mulv4hi3 (l, operands[1], operands[2]));
371 emit_insn (gen_pmpyshr2_u (h, operands[1], operands[2], GEN_INT (16)));
372 ia64_unpack_assemble (operands[0], l, h, true);
376 (define_expand "mulv2si3"
377 [(set (match_operand:V2SI 0 "gr_register_operand" "")
378 (mult:V2SI (match_operand:V2SI 1 "gr_register_operand" "r")
379 (match_operand:V2SI 2 "gr_register_operand" "r")))]
382 rtx t0, t1, t2, t3, t4, t5, t6, t7, x;
383 rtx op1h = gen_lowpart (V4HImode, operands[1]);
384 rtx op2h = gen_lowpart (V4HImode, operands[2]);
386 t0 = gen_reg_rtx (V4HImode);
387 t1 = gen_reg_rtx (V4HImode);
388 t2 = gen_reg_rtx (V4HImode);
389 t3 = gen_reg_rtx (V4HImode);
390 t4 = gen_reg_rtx (V2SImode);
391 t5 = gen_reg_rtx (V2SImode);
392 t6 = gen_reg_rtx (V2SImode);
393 t7 = gen_reg_rtx (V2SImode);
395 /* Consider the HImode components of op1 = DCBA, op2 = ZYXW.
396 Consider .l and .h suffixes below the low and high 16 bits
397 of the full 32-bit product. */
400 x = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (4, const1_rtx, const0_rtx,
401 GEN_INT (3), const2_rtx));
402 x = gen_rtx_VEC_SELECT (V4HImode, op1h, x);
403 emit_insn (gen_rtx_SET (VOIDmode, t0, x));
405 /* T1 = DZ.l, CY.l, BX.l, AW.l. */
406 emit_insn (gen_mulv4hi3 (t1, op1h, op2h));
408 /* T2 = DZ.h, CY.h, BX.h, AW.h. */
409 emit_insn (gen_pmpyshr2_u (t2, op1h, op2h, GEN_INT (16)));
411 /* T3 = CZ.l, DY.l, AX.l, BW.l. */
412 emit_insn (gen_mulv4hi3 (t3, t0, op2h));
414 /* T4 = CY.h, CY.l, AW.h, AW.l = CY, AW. */
415 x = gen_lowpart (V4HImode, t4);
416 if (TARGET_BIG_ENDIAN)
417 x = gen_mix2_odd (x, t2, t1);
419 x = gen_mix2_even (x, t1, t2);
422 /* T5 = CZ.l, 0, AX.l, 0 = CZ << 16, AX << 16. */
423 x = gen_lowpart (V4HImode, t5);
424 if (TARGET_BIG_ENDIAN)
425 x = gen_mix2_even (x, t3, CONST0_RTX (V4HImode));
427 x = gen_mix2_odd (x, CONST0_RTX (V4HImode), t3);
430 /* T6 = DY.l, 0, BW.l, 0 = DY << 16, BW << 16. */
431 x = gen_lowpart (V4HImode, t6);
432 if (TARGET_BIG_ENDIAN)
433 x = gen_mix2_odd (x, t3, CONST0_RTX (V4HImode));
435 x = gen_mix2_even (x, CONST0_RTX (V4HImode), t3);
438 emit_insn (gen_addv2si3 (t7, t4, t5));
439 emit_insn (gen_addv2si3 (operands[0], t6, t7));
443 (define_expand "umax<mode>3"
444 [(set (match_operand:VECINT 0 "gr_register_operand" "")
445 (umax:VECINT (match_operand:VECINT 1 "gr_register_operand" "")
446 (match_operand:VECINT 2 "gr_register_operand" "")))]
449 if (ia64_expand_vecint_minmax (UMAX, <MODE>mode, operands))
453 (define_expand "smax<mode>3"
454 [(set (match_operand:VECINT 0 "gr_register_operand" "")
455 (smax:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
456 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
459 if (ia64_expand_vecint_minmax (SMAX, <MODE>mode, operands))
463 (define_expand "umin<mode>3"
464 [(set (match_operand:VECINT 0 "gr_register_operand" "")
465 (umin:VECINT (match_operand:VECINT 1 "gr_register_operand" "")
466 (match_operand:VECINT 2 "gr_register_operand" "")))]
469 if (ia64_expand_vecint_minmax (UMIN, <MODE>mode, operands))
473 (define_expand "smin<mode>3"
474 [(set (match_operand:VECINT 0 "gr_register_operand" "")
475 (smin:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
476 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
479 if (ia64_expand_vecint_minmax (SMIN, <MODE>mode, operands))
483 (define_insn "*umaxv8qi3"
484 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
485 (umax:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
486 (match_operand:V8QI 2 "gr_register_operand" "r")))]
488 "pmax1.u %0 = %1, %2"
489 [(set_attr "itanium_class" "mmshf")])
491 (define_insn "*smaxv4hi3"
492 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
493 (smax:V4HI (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
494 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU")))]
496 "pmax2 %0 = %r1, %r2"
497 [(set_attr "itanium_class" "mmshf")])
499 (define_insn "*uminv8qi3"
500 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
501 (umin:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
502 (match_operand:V8QI 2 "gr_register_operand" "r")))]
504 "pmin1.u %0 = %1, %2"
505 [(set_attr "itanium_class" "mmshf")])
507 (define_insn "*sminv4hi3"
508 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
509 (smin:V4HI (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
510 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU")))]
512 "pmin2 %0 = %r1, %r2"
513 [(set_attr "itanium_class" "mmshf")])
515 (define_insn "ashl<mode>3"
516 [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
518 (match_operand:VECINT24 1 "gr_register_operand" "r")
519 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rn")))]
521 "pshl<vecsize> %0 = %1, %2"
522 [(set_attr "itanium_class" "mmshf")])
524 (define_insn "ashr<mode>3"
525 [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
527 (match_operand:VECINT24 1 "gr_register_operand" "r")
528 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rn")))]
530 "pshr<vecsize> %0 = %1, %2"
531 [(set_attr "itanium_class" "mmshf")])
533 (define_insn "lshr<mode>3"
534 [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
536 (match_operand:VECINT24 1 "gr_register_operand" "r")
537 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rn")))]
539 "pshr<vecsize>.u %0 = %1, %2"
540 [(set_attr "itanium_class" "mmshf")])
542 (define_expand "vec_shl_<mode>"
543 [(set (match_operand:VECINT 0 "gr_register_operand" "")
544 (ashift:DI (match_operand:VECINT 1 "gr_register_operand" "")
545 (match_operand:DI 2 "gr_reg_or_6bit_operand" "")))]
548 operands[0] = gen_lowpart (DImode, operands[0]);
549 operands[1] = gen_lowpart (DImode, operands[1]);
552 (define_expand "vec_shr_<mode>"
553 [(set (match_operand:VECINT 0 "gr_register_operand" "")
554 (lshiftrt:DI (match_operand:VECINT 1 "gr_register_operand" "")
555 (match_operand:DI 2 "gr_reg_or_6bit_operand" "")))]
558 operands[0] = gen_lowpart (DImode, operands[0]);
559 operands[1] = gen_lowpart (DImode, operands[1]);
562 (define_expand "widen_usumv8qi3"
563 [(match_operand:V4HI 0 "gr_register_operand" "")
564 (match_operand:V8QI 1 "gr_register_operand" "")
565 (match_operand:V4HI 2 "gr_register_operand" "")]
568 ia64_expand_widen_sum (operands, true);
572 (define_expand "widen_usumv4hi3"
573 [(match_operand:V2SI 0 "gr_register_operand" "")
574 (match_operand:V4HI 1 "gr_register_operand" "")
575 (match_operand:V2SI 2 "gr_register_operand" "")]
578 ia64_expand_widen_sum (operands, true);
582 (define_expand "widen_ssumv8qi3"
583 [(match_operand:V4HI 0 "gr_register_operand" "")
584 (match_operand:V8QI 1 "gr_register_operand" "")
585 (match_operand:V4HI 2 "gr_register_operand" "")]
588 ia64_expand_widen_sum (operands, false);
592 (define_expand "widen_ssumv4hi3"
593 [(match_operand:V2SI 0 "gr_register_operand" "")
594 (match_operand:V4HI 1 "gr_register_operand" "")
595 (match_operand:V2SI 2 "gr_register_operand" "")]
598 ia64_expand_widen_sum (operands, false);
602 (define_expand "udot_prodv8qi"
603 [(match_operand:V2SI 0 "gr_register_operand" "")
604 (match_operand:V8QI 1 "gr_register_operand" "")
605 (match_operand:V8QI 2 "gr_register_operand" "")
606 (match_operand:V2SI 3 "gr_register_operand" "")]
609 ia64_expand_dot_prod_v8qi (operands, true);
613 (define_expand "sdot_prodv8qi"
614 [(match_operand:V2SI 0 "gr_register_operand" "")
615 (match_operand:V8QI 1 "gr_register_operand" "")
616 (match_operand:V8QI 2 "gr_register_operand" "")
617 (match_operand:V2SI 3 "gr_register_operand" "")]
620 ia64_expand_dot_prod_v8qi (operands, false);
624 (define_expand "sdot_prodv4hi"
625 [(match_operand:V2SI 0 "gr_register_operand" "")
626 (match_operand:V4HI 1 "gr_register_operand" "")
627 (match_operand:V4HI 2 "gr_register_operand" "")
628 (match_operand:V2SI 3 "gr_register_operand" "")]
633 e = gen_reg_rtx (V2SImode);
634 o = gen_reg_rtx (V2SImode);
635 t = gen_reg_rtx (V2SImode);
637 emit_insn (gen_pmpy2_even (e, operands[1], operands[2]));
638 emit_insn (gen_pmpy2_odd (o, operands[1], operands[2]));
639 emit_insn (gen_addv2si3 (t, e, operands[3]));
640 emit_insn (gen_addv2si3 (operands[0], t, o));
644 (define_expand "udot_prodv4hi"
645 [(match_operand:V2SI 0 "gr_register_operand" "")
646 (match_operand:V4HI 1 "gr_register_operand" "")
647 (match_operand:V4HI 2 "gr_register_operand" "")
648 (match_operand:V2SI 3 "gr_register_operand" "")]
653 l = gen_reg_rtx (V2SImode);
654 h = gen_reg_rtx (V2SImode);
655 t = gen_reg_rtx (V2SImode);
657 emit_insn (gen_vec_widen_umult_lo_v4hi (l, operands[1], operands[2]));
658 emit_insn (gen_vec_widen_umult_hi_v4hi (h, operands[1], operands[2]));
659 emit_insn (gen_addv2si3 (t, l, operands[3]));
660 emit_insn (gen_addv2si3 (operands[0], t, h));
664 (define_expand "vcond<mode><mode>"
665 [(set (match_operand:VECINT 0 "gr_register_operand" "")
668 [(match_operand:VECINT 4 "gr_reg_or_0_operand" "")
669 (match_operand:VECINT 5 "gr_reg_or_0_operand" "")])
670 (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
671 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
674 ia64_expand_vecint_cmov (operands);
678 (define_expand "vcondu<mode><mode>"
679 [(set (match_operand:VECINT 0 "gr_register_operand" "")
682 [(match_operand:VECINT 4 "gr_reg_or_0_operand" "")
683 (match_operand:VECINT 5 "gr_reg_or_0_operand" "")])
684 (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
685 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
688 ia64_expand_vecint_cmov (operands);
692 (define_insn "*cmpeq_<mode>"
693 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
694 (eq:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "rU")
695 (match_operand:VECINT 2 "gr_reg_or_0_operand" "rU")))]
697 "pcmp<vecsize>.eq %0 = %r1, %r2"
698 [(set_attr "itanium_class" "mmalua")])
700 (define_insn "*cmpgt_<mode>"
701 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
702 (gt:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "rU")
703 (match_operand:VECINT 2 "gr_reg_or_0_operand" "rU")))]
705 "pcmp<vecsize>.gt %0 = %r1, %r2"
706 [(set_attr "itanium_class" "mmalua")])
708 (define_insn "vec_pack_ssat_v4hi"
709 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
712 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU"))
714 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))))]
717 /* Recall that vector elements are numbered in memory order. */
718 if (TARGET_BIG_ENDIAN)
719 return "%,pack2.sss %0 = %r2, %r1";
721 return "%,pack2.sss %0 = %r1, %r2";
723 [(set_attr "itanium_class" "mmshf")])
725 (define_insn "vec_pack_usat_v4hi"
726 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
729 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU"))
731 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))))]
734 /* Recall that vector elements are numbered in memory order. */
735 if (TARGET_BIG_ENDIAN)
736 return "%,pack2.uss %0 = %r2, %r1";
738 return "%,pack2.uss %0 = %r1, %r2";
740 [(set_attr "itanium_class" "mmshf")])
742 (define_insn "vec_pack_ssat_v2si"
743 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
746 (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU"))
748 (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))))]
751 /* Recall that vector elements are numbered in memory order. */
752 if (TARGET_BIG_ENDIAN)
753 return "%,pack4.sss %0 = %r2, %r1";
755 return "%,pack4.sss %0 = %r1, %r2";
757 [(set_attr "itanium_class" "mmshf")])
759 (define_insn "vec_interleave_lowv8qi"
760 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
763 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
764 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
765 (parallel [(const_int 0) (const_int 8)
766 (const_int 1) (const_int 9)
767 (const_int 2) (const_int 10)
768 (const_int 3) (const_int 11)])))]
771 /* Recall that vector elements are numbered in memory order. */
772 if (TARGET_BIG_ENDIAN)
773 return "%,unpack1.l %0 = %r1, %r2";
775 return "%,unpack1.l %0 = %r2, %r1";
777 [(set_attr "itanium_class" "mmshf")])
779 (define_insn "vec_interleave_highv8qi"
780 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
783 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
784 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
785 (parallel [(const_int 4) (const_int 12)
786 (const_int 5) (const_int 13)
787 (const_int 6) (const_int 14)
788 (const_int 7) (const_int 15)])))]
791 /* Recall that vector elements are numbered in memory order. */
792 if (TARGET_BIG_ENDIAN)
793 return "%,unpack1.h %0 = %r1, %r2";
795 return "%,unpack1.h %0 = %r2, %r1";
797 [(set_attr "itanium_class" "mmshf")])
799 (define_insn "mix1_even"
800 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
803 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
804 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
805 (parallel [(const_int 0) (const_int 8)
806 (const_int 2) (const_int 10)
807 (const_int 4) (const_int 12)
808 (const_int 6) (const_int 14)])))]
811 /* Recall that vector elements are numbered in memory order. */
812 if (TARGET_BIG_ENDIAN)
813 return "%,mix1.l %0 = %r1, %r2";
815 return "%,mix1.r %0 = %r2, %r1";
817 [(set_attr "itanium_class" "mmshf")])
819 (define_insn "mix1_odd"
820 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
823 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
824 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
825 (parallel [(const_int 1) (const_int 9)
826 (const_int 3) (const_int 11)
827 (const_int 5) (const_int 13)
828 (const_int 7) (const_int 15)])))]
831 /* Recall that vector elements are numbered in memory order. */
832 if (TARGET_BIG_ENDIAN)
833 return "%,mix1.r %0 = %r1, %r2";
835 return "%,mix1.l %0 = %r2, %r1";
837 [(set_attr "itanium_class" "mmshf")])
839 (define_insn "*mux1_rev"
840 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
842 (match_operand:V8QI 1 "gr_register_operand" "r")
843 (parallel [(const_int 7) (const_int 6)
844 (const_int 5) (const_int 4)
845 (const_int 3) (const_int 2)
846 (const_int 1) (const_int 0)])))]
849 [(set_attr "itanium_class" "mmshf")])
851 (define_insn "*mux1_mix"
852 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
854 (match_operand:V8QI 1 "gr_register_operand" "r")
855 (parallel [(const_int 0) (const_int 4)
856 (const_int 2) (const_int 6)
857 (const_int 1) (const_int 5)
858 (const_int 3) (const_int 7)])))]
861 [(set_attr "itanium_class" "mmshf")])
863 (define_insn "*mux1_shuf"
864 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
866 (match_operand:V8QI 1 "gr_register_operand" "r")
867 (parallel [(const_int 0) (const_int 4)
868 (const_int 1) (const_int 5)
869 (const_int 2) (const_int 6)
870 (const_int 3) (const_int 7)])))]
872 "mux1 %0 = %1, @shuf"
873 [(set_attr "itanium_class" "mmshf")])
875 (define_insn "mux1_alt"
876 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
878 (match_operand:V8QI 1 "gr_register_operand" "r")
879 (parallel [(const_int 0) (const_int 2)
880 (const_int 4) (const_int 6)
881 (const_int 1) (const_int 3)
882 (const_int 5) (const_int 7)])))]
885 [(set_attr "itanium_class" "mmshf")])
887 (define_insn "*mux1_brcst_v8qi"
888 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
890 (match_operand:V8QI 1 "gr_register_operand" "r")
891 (parallel [(match_operand 2 "mux1_brcst_element" "")
900 "mux1 %0 = %1, @brcst"
901 [(set_attr "itanium_class" "mmshf")])
903 (define_insn "*mux1_brcst_qi"
904 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
906 (match_operand:QI 1 "gr_register_operand" "r")))]
908 "mux1 %0 = %1, @brcst"
909 [(set_attr "itanium_class" "mmshf")])
911 (define_expand "vec_extract_evenv8qi"
912 [(match_operand:V8QI 0 "gr_register_operand" "")
913 (match_operand:V8QI 1 "gr_register_operand" "")
914 (match_operand:V8QI 2 "gr_register_operand" "")]
917 rtx temp = gen_reg_rtx (V8QImode);
918 emit_insn (gen_mix1_even (temp, operands[1], operands[2]));
919 emit_insn (gen_mux1_alt (operands[0], temp));
923 (define_expand "vec_extract_oddv8qi"
924 [(match_operand:V8QI 0 "gr_register_operand" "")
925 (match_operand:V8QI 1 "gr_register_operand" "")
926 (match_operand:V8QI 2 "gr_register_operand" "")]
929 rtx temp = gen_reg_rtx (V8QImode);
930 emit_insn (gen_mix1_odd (temp, operands[1], operands[2]));
931 emit_insn (gen_mux1_alt (operands[0], temp));
935 (define_insn "vec_interleave_lowv4hi"
936 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
939 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
940 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
941 (parallel [(const_int 0) (const_int 4)
942 (const_int 1) (const_int 5)])))]
945 /* Recall that vector elements are numbered in memory order. */
946 if (TARGET_BIG_ENDIAN)
947 return "%,unpack2.l %0 = %r1, %r2";
949 return "%,unpack2.l %0 = %r2, %r1";
951 [(set_attr "itanium_class" "mmshf")])
953 (define_insn "vec_interleave_highv4hi"
954 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
957 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
958 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
959 (parallel [(const_int 2) (const_int 6)
960 (const_int 3) (const_int 7)])))]
963 /* Recall that vector elements are numbered in memory order. */
964 if (TARGET_BIG_ENDIAN)
965 return "%,unpack2.h %0 = %r1, %r2";
967 return "%,unpack2.h %0 = %r2, %r1";
969 [(set_attr "itanium_class" "mmshf")])
971 (define_insn "mix2_even"
972 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
975 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
976 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
977 (parallel [(const_int 0) (const_int 4)
978 (const_int 2) (const_int 6)])))]
981 /* Recall that vector elements are numbered in memory order. */
982 if (TARGET_BIG_ENDIAN)
983 return "%,mix2.l %0 = %r1, %r2";
985 return "%,mix2.r %0 = %r2, %r1";
987 [(set_attr "itanium_class" "mmshf")])
989 (define_insn "mix2_odd"
990 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
993 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
994 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
995 (parallel [(const_int 1) (const_int 5)
996 (const_int 3) (const_int 7)])))]
999 /* Recall that vector elements are numbered in memory order. */
1000 if (TARGET_BIG_ENDIAN)
1001 return "%,mix2.r %0 = %r1, %r2";
1003 return "%,mix2.l %0 = %r2, %r1";
1005 [(set_attr "itanium_class" "mmshf")])
1007 (define_insn "*mux2"
1008 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
1010 (match_operand:V4HI 1 "gr_register_operand" "r")
1011 (parallel [(match_operand 2 "const_int_2bit_operand" "")
1012 (match_operand 3 "const_int_2bit_operand" "")
1013 (match_operand 4 "const_int_2bit_operand" "")
1014 (match_operand 5 "const_int_2bit_operand" "")])))]
1018 if (TARGET_BIG_ENDIAN)
1020 mask |= (3 - INTVAL (operands[2])) << 6;
1021 mask |= (3 - INTVAL (operands[3])) << 4;
1022 mask |= (3 - INTVAL (operands[4])) << 2;
1023 mask |= 3 - INTVAL (operands[5]);
1027 mask |= INTVAL (operands[2]);
1028 mask |= INTVAL (operands[3]) << 2;
1029 mask |= INTVAL (operands[4]) << 4;
1030 mask |= INTVAL (operands[5]) << 6;
1032 operands[2] = GEN_INT (mask);
1033 return "%,mux2 %0 = %1, %2";
1035 [(set_attr "itanium_class" "mmshf")])
1037 (define_expand "vec_extract_evenodd_helper"
1038 [(set (match_operand:V4HI 0 "gr_register_operand" "")
1040 (match_operand:V4HI 1 "gr_register_operand" "")
1041 (parallel [(const_int 0) (const_int 2)
1042 (const_int 1) (const_int 3)])))]
1045 (define_expand "vec_extract_evenv4hi"
1046 [(match_operand:V4HI 0 "gr_register_operand")
1047 (match_operand:V4HI 1 "gr_reg_or_0_operand")
1048 (match_operand:V4HI 2 "gr_reg_or_0_operand")]
1051 rtx temp = gen_reg_rtx (V4HImode);
1052 emit_insn (gen_mix2_even (temp, operands[1], operands[2]));
1053 emit_insn (gen_vec_extract_evenodd_helper (operands[0], temp));
1057 (define_expand "vec_extract_oddv4hi"
1058 [(match_operand:V4HI 0 "gr_register_operand")
1059 (match_operand:V4HI 1 "gr_reg_or_0_operand")
1060 (match_operand:V4HI 2 "gr_reg_or_0_operand")]
1063 rtx temp = gen_reg_rtx (V4HImode);
1064 emit_insn (gen_mix2_odd (temp, operands[1], operands[2]));
1065 emit_insn (gen_vec_extract_evenodd_helper (operands[0], temp));
1069 (define_insn "*mux2_brcst_hi"
1070 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
1072 (match_operand:HI 1 "gr_register_operand" "r")))]
1075 [(set_attr "itanium_class" "mmshf")])
1077 (define_insn "vec_interleave_lowv2si"
1078 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
1081 (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU")
1082 (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))
1083 (parallel [(const_int 0) (const_int 2)])))]
1086 /* Recall that vector elements are numbered in memory order. */
1087 if (TARGET_BIG_ENDIAN)
1088 return "%,unpack4.l %0 = %r1, %r2";
1090 return "%,unpack4.l %0 = %r2, %r1";
1092 [(set_attr "itanium_class" "mmshf")])
1094 (define_insn "vec_interleave_highv2si"
1095 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
1098 (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU")
1099 (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))
1100 (parallel [(const_int 1) (const_int 3)])))]
1103 /* Recall that vector elements are numbered in memory order. */
1104 if (TARGET_BIG_ENDIAN)
1105 return "%,unpack4.h %0 = %r1, %r2";
1107 return "%,unpack4.h %0 = %r2, %r1";
1109 [(set_attr "itanium_class" "mmshf")])
1111 (define_expand "vec_extract_evenv2si"
1112 [(match_operand:V2SI 0 "gr_register_operand" "")
1113 (match_operand:V2SI 1 "gr_register_operand" "")
1114 (match_operand:V2SI 2 "gr_register_operand" "")]
1117 if (TARGET_BIG_ENDIAN)
1118 emit_insn (gen_vec_interleave_highv2si (operands[0], operands[1],
1121 emit_insn (gen_vec_interleave_lowv2si (operands[0], operands[1],
1126 (define_expand "vec_extract_oddv2si"
1127 [(match_operand:V2SI 0 "gr_register_operand" "")
1128 (match_operand:V2SI 1 "gr_register_operand" "")
1129 (match_operand:V2SI 2 "gr_register_operand" "")]
1132 if (TARGET_BIG_ENDIAN)
1133 emit_insn (gen_vec_interleave_lowv2si (operands[0], operands[1],
1136 emit_insn (gen_vec_interleave_highv2si (operands[0], operands[1],
1141 (define_expand "vec_initv2si"
1142 [(match_operand:V2SI 0 "gr_register_operand" "")
1143 (match_operand 1 "" "")]
1146 rtx op1 = XVECEXP (operands[1], 0, 0);
1147 rtx op2 = XVECEXP (operands[1], 0, 1);
1150 if (GET_CODE (op1) == CONST_INT && GET_CODE (op2) == CONST_INT)
1152 x = gen_rtx_CONST_VECTOR (V2SImode, XVEC (operands[1], 0));
1153 emit_move_insn (operands[0], x);
1157 if (!gr_reg_or_0_operand (op1, SImode))
1158 op1 = force_reg (SImode, op1);
1159 if (!gr_reg_or_0_operand (op2, SImode))
1160 op2 = force_reg (SImode, op2);
1162 x = gen_rtx_VEC_CONCAT (V2SImode, op1, op2);
1163 emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
1167 (define_insn "*vecinit_v2si"
1168 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
1170 (match_operand:SI 1 "gr_reg_or_0_operand" "rO")
1171 (match_operand:SI 2 "gr_reg_or_0_operand" "rO")))]
1174 /* Recall that vector elements are numbered in memory order. */
1175 if (TARGET_BIG_ENDIAN)
1176 return "%,unpack4.l %0 = %r1, %r2";
1178 return "%,unpack4.l %0 = %r2, %r1";
1180 [(set_attr "itanium_class" "mmshf")])
1182 ;; Missing operations
1191 ;; Floating point vector operations
1193 (define_expand "movv2sf"
1194 [(set (match_operand:V2SF 0 "general_operand" "")
1195 (match_operand:V2SF 1 "general_operand" ""))]
1198 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1204 (define_insn "*movv2sf_internal"
1205 [(set (match_operand:V2SF 0 "destination_operand"
1206 "=f,f,f,Q,*r ,*r,*r,*r,m ,f ,*r")
1207 (match_operand:V2SF 1 "move_operand"
1208 "fU,Y,Q,f,U*r,W ,i ,m ,*r,*r,f "))]
1209 "ia64_move_ok (operands[0], operands[1])"
1211 static const char * const alt[] = {
1213 "%,fpack %0 = %F2, %F1",
1214 "%,ldf8 %0 = %1%P1",
1215 "%,stf8 %0 = %1%P0",
1217 "%,addl %0 = %v1, r0",
1219 "%,ld8%O1 %0 = %1%P1",
1220 "%,st8%Q0 %0 = %r1%P0",
1221 "%,setf.sig %0 = %1",
1222 "%,getf.sig %0 = %1"
1225 if (which_alternative == 1)
1227 operands[2] = XVECEXP (operands[1], 0, TARGET_BIG_ENDIAN ? 0 : 1);
1228 operands[1] = XVECEXP (operands[1], 0, TARGET_BIG_ENDIAN ? 1 : 0);
1231 return alt[which_alternative];
1233 [(set_attr "itanium_class" "fmisc,fmisc,fld,stf,ialu,ialu,long_i,ld,st,tofr,frfr")])
1235 (define_insn "absv2sf2"
1236 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1237 (abs:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")))]
1240 [(set_attr "itanium_class" "fmisc")])
1242 (define_insn "negv2sf2"
1243 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1244 (neg:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")))]
1247 [(set_attr "itanium_class" "fmisc")])
1249 (define_insn "*negabsv2sf2"
1250 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1252 (abs:V2SF (match_operand:V2SF 1 "fr_register_operand" "f"))))]
1255 [(set_attr "itanium_class" "fmisc")])
1257 (define_expand "addv2sf3"
1258 [(set (match_operand:V2SF 0 "fr_register_operand" "")
1259 (fma:V2SF (match_operand:V2SF 1 "fr_register_operand" "")
1261 (match_operand:V2SF 2 "fr_register_operand" "")))]
1264 rtvec v = gen_rtvec (2, CONST1_RTX (SFmode), CONST1_RTX (SFmode));
1265 operands[3] = force_reg (V2SFmode, gen_rtx_CONST_VECTOR (V2SFmode, v));
1268 (define_expand "subv2sf3"
1269 [(set (match_operand:V2SF 0 "fr_register_operand" "")
1271 (match_operand:V2SF 1 "fr_register_operand" "")
1273 (neg:V2SF (match_operand:V2SF 2 "fr_register_operand" ""))))]
1276 rtvec v = gen_rtvec (2, CONST1_RTX (SFmode), CONST1_RTX (SFmode));
1277 operands[3] = force_reg (V2SFmode, gen_rtx_CONST_VECTOR (V2SFmode, v));
1280 (define_insn "mulv2sf3"
1281 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1282 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1283 (match_operand:V2SF 2 "fr_register_operand" "f")))]
1286 [(set_attr "itanium_class" "fmac")])
1288 (define_insn "fmav2sf4"
1289 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1291 (match_operand:V2SF 1 "fr_register_operand" "f")
1292 (match_operand:V2SF 2 "fr_register_operand" "f")
1293 (match_operand:V2SF 3 "fr_register_operand" "f")))]
1295 "fpma %0 = %1, %2, %3"
1296 [(set_attr "itanium_class" "fmac")])
1298 (define_insn "fmsv2sf4"
1299 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1301 (match_operand:V2SF 1 "fr_register_operand" "f")
1302 (match_operand:V2SF 2 "fr_register_operand" "f")
1303 (neg:V2SF (match_operand:V2SF 3 "fr_register_operand" "f"))))]
1305 "fpms %0 = %1, %2, %3"
1306 [(set_attr "itanium_class" "fmac")])
1308 (define_insn "*fpnmpy"
1309 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1311 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1312 (match_operand:V2SF 2 "fr_register_operand" "f"))))]
1314 "fpnmpy %0 = %1, %2"
1315 [(set_attr "itanium_class" "fmac")])
1317 (define_insn "fnmav2sf4"
1318 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1320 (neg:V2SF (match_operand:V2SF 1 "fr_register_operand" "f"))
1321 (match_operand:V2SF 2 "fr_register_operand" "f")
1322 (match_operand:V2SF 3 "fr_register_operand" "f")))]
1324 "fpnma %0 = %1, %2, %3"
1325 [(set_attr "itanium_class" "fmac")])
1327 (define_insn "smaxv2sf3"
1328 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1329 (smax:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1330 (match_operand:V2SF 2 "fr_register_operand" "f")))]
1333 [(set_attr "itanium_class" "fmisc")])
1335 (define_insn "sminv2sf3"
1336 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1337 (smin:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1338 (match_operand:V2SF 2 "fr_register_operand" "f")))]
1341 [(set_attr "itanium_class" "fmisc")])
1343 (define_expand "reduc_splus_v2sf"
1344 [(match_operand:V2SF 0 "fr_register_operand" "")
1345 (match_operand:V2SF 1 "fr_register_operand" "")]
1348 rtx tmp = gen_reg_rtx (V2SFmode);
1349 if (TARGET_BIG_ENDIAN)
1350 emit_insn (gen_fswap (tmp, CONST0_RTX (V2SFmode), operands[1]));
1352 emit_insn (gen_fswap (tmp, operands[1], CONST0_RTX (V2SFmode)));
1353 emit_insn (gen_addv2sf3 (operands[0], operands[1], tmp));
1357 (define_expand "reduc_smax_v2sf"
1358 [(match_operand:V2SF 0 "fr_register_operand" "")
1359 (match_operand:V2SF 1 "fr_register_operand" "")]
1362 rtx tmp = gen_reg_rtx (V2SFmode);
1363 if (TARGET_BIG_ENDIAN)
1364 emit_insn (gen_fswap (tmp, CONST0_RTX (V2SFmode), operands[1]));
1366 emit_insn (gen_fswap (tmp, operands[1], CONST0_RTX (V2SFmode)));
1367 emit_insn (gen_smaxv2sf3 (operands[0], operands[1], tmp));
1371 (define_expand "reduc_smin_v2sf"
1372 [(match_operand:V2SF 0 "fr_register_operand" "")
1373 (match_operand:V2SF 1 "fr_register_operand" "")]
1376 rtx tmp = gen_reg_rtx (V2SFmode);
1377 if (TARGET_BIG_ENDIAN)
1378 emit_insn (gen_fswap (tmp, CONST0_RTX (V2SFmode), operands[1]));
1380 emit_insn (gen_fswap (tmp, operands[1], CONST0_RTX (V2SFmode)));
1381 emit_insn (gen_sminv2sf3 (operands[0], operands[1], tmp));
1385 (define_expand "vcondv2sfv2sf"
1386 [(set (match_operand:V2SF 0 "fr_register_operand" "")
1388 (match_operator 3 ""
1389 [(match_operand:V2SF 4 "fr_reg_or_0_operand" "")
1390 (match_operand:V2SF 5 "fr_reg_or_0_operand" "")])
1391 (match_operand:V2SF 1 "fr_reg_or_0_operand" "")
1392 (match_operand:V2SF 2 "fr_reg_or_0_operand" "")))]
1397 cmp = gen_reg_rtx (V2SFmode);
1398 PUT_MODE (operands[3], V2SFmode);
1399 emit_insn (gen_rtx_SET (VOIDmode, cmp, operands[3]));
1401 x = gen_rtx_IF_THEN_ELSE (V2SFmode, cmp, operands[1], operands[2]);
1402 emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
1406 (define_insn "*fpcmp"
1407 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1408 (match_operator:V2SF 3 "comparison_operator"
1409 [(match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1410 (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU")]))]
1412 "fpcmp.%D3 %0 = %F1, %F2"
1413 [(set_attr "itanium_class" "fmisc")])
1415 (define_insn "*fselect"
1416 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1418 (match_operand:V2SF 1 "fr_register_operand" "f")
1419 (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU")
1420 (match_operand:V2SF 3 "fr_reg_or_0_operand" "fU")))]
1422 "fselect %0 = %F2, %F3, %1"
1423 [(set_attr "itanium_class" "fmisc")])
1425 (define_expand "vec_initv2sf"
1426 [(match_operand:V2SF 0 "fr_register_operand" "")
1427 (match_operand 1 "" "")]
1430 rtx op1 = XVECEXP (operands[1], 0, 0);
1431 rtx op2 = XVECEXP (operands[1], 0, 1);
1434 if (GET_CODE (op1) == CONST_DOUBLE && GET_CODE (op2) == CONST_DOUBLE)
1436 x = gen_rtx_CONST_VECTOR (V2SFmode, XVEC (operands[1], 0));
1437 emit_move_insn (operands[0], x);
1441 if (!fr_reg_or_fp01_operand (op1, SFmode))
1442 op1 = force_reg (SFmode, op1);
1443 if (!fr_reg_or_fp01_operand (op2, SFmode))
1444 op2 = force_reg (SFmode, op2);
1446 emit_insn (gen_fpack (operands[0], op1, op2));
1450 (define_insn "fpack"
1451 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1453 (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
1454 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
1457 /* Recall that vector elements are numbered in memory order. */
1458 if (TARGET_BIG_ENDIAN)
1459 return "%,fpack %0 = %F1, %F2";
1461 return "%,fpack %0 = %F2, %F1";
1463 [(set_attr "itanium_class" "fmisc")])
1465 (define_insn "fswap"
1466 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1469 (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1470 (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1471 (parallel [(const_int 1) (const_int 2)])))]
1474 /* Recall that vector elements are numbered in memory order. */
1475 if (TARGET_BIG_ENDIAN)
1476 return "%,fswap %0 = %F2, %F1";
1478 return "%,fswap %0 = %F1, %F2";
1480 [(set_attr "itanium_class" "fmisc")])
1482 (define_insn "vec_interleave_highv2sf"
1483 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1486 (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1487 (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1488 (parallel [(const_int 1) (const_int 3)])))]
1491 /* Recall that vector elements are numbered in memory order. */
1492 if (TARGET_BIG_ENDIAN)
1493 return "%,fmix.l %0 = %F1, %F2";
1495 return "%,fmix.l %0 = %F2, %F1";
1497 [(set_attr "itanium_class" "fmisc")])
1499 (define_insn "vec_interleave_lowv2sf"
1500 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1503 (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1504 (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1505 (parallel [(const_int 0) (const_int 2)])))]
1508 /* Recall that vector elements are numbered in memory order. */
1509 if (TARGET_BIG_ENDIAN)
1510 return "%,fmix.r %0 = %F1, %F2";
1512 return "%,fmix.r %0 = %F2, %F1";
1514 [(set_attr "itanium_class" "fmisc")])
1516 (define_insn "fmix_lr"
1517 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1520 (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1521 (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1522 (parallel [(const_int 0) (const_int 3)])))]
1525 /* Recall that vector elements are numbered in memory order. */
1526 if (TARGET_BIG_ENDIAN)
1527 return "%,fmix.lr %0 = %F1, %F2";
1529 return "%,fmix.lr %0 = %F2, %F1";
1531 [(set_attr "itanium_class" "fmisc")])
1533 (define_expand "vec_extract_evenv2sf"
1534 [(match_operand:V2SF 0 "gr_register_operand" "")
1535 (match_operand:V2SF 1 "gr_register_operand" "")
1536 (match_operand:V2SF 2 "gr_register_operand" "")]
1539 if (TARGET_BIG_ENDIAN)
1540 emit_insn (gen_vec_interleave_highv2sf (operands[0], operands[1],
1543 emit_insn (gen_vec_interleave_lowv2sf (operands[0], operands[1],
1548 (define_expand "vec_extract_oddv2sf"
1549 [(match_operand:V2SF 0 "gr_register_operand" "")
1550 (match_operand:V2SF 1 "gr_register_operand" "")
1551 (match_operand:V2SF 2 "gr_register_operand" "")]
1554 if (TARGET_BIG_ENDIAN)
1555 emit_insn (gen_vec_interleave_lowv2sf (operands[0], operands[1],
1558 emit_insn (gen_vec_interleave_highv2sf (operands[0], operands[1],
1563 (define_expand "vec_setv2sf"
1564 [(match_operand:V2SF 0 "fr_register_operand" "")
1565 (match_operand:SF 1 "fr_register_operand" "")
1566 (match_operand 2 "const_int_operand" "")]
1569 rtx op0 = operands[0];
1570 rtx tmp = gen_reg_rtx (V2SFmode);
1572 emit_insn (gen_fpack (tmp, operands[1], CONST0_RTX (SFmode)));
1574 switch (INTVAL (operands[2]))
1577 emit_insn (gen_fmix_lr (op0, tmp, op0));
1580 emit_insn (gen_vec_interleave_lowv2sf (op0, op0, tmp));
1588 (define_insn_and_split "*vec_extractv2sf_0_le"
1589 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,f,m")
1590 (unspec:SF [(match_operand:V2SF 1 "nonimmediate_operand" "rfm,rm,r")
1593 "!TARGET_BIG_ENDIAN"
1596 [(set (match_dup 0) (match_dup 1))]
1598 if (REG_P (operands[1]) && FR_REGNO_P (REGNO (operands[1])))
1599 operands[0] = gen_rtx_REG (V2SFmode, REGNO (operands[0]));
1600 else if (MEM_P (operands[1]))
1601 operands[1] = adjust_address (operands[1], SFmode, 0);
1603 operands[1] = gen_rtx_REG (SFmode, REGNO (operands[1]));
1606 (define_insn_and_split "*vec_extractv2sf_0_be"
1607 [(set (match_operand:SF 0 "register_operand" "=rf,r")
1608 (unspec:SF [(match_operand:V2SF 1 "nonimmediate_operand" "m,r")
1614 [(set (match_dup 0) (match_dup 1))]
1616 if (MEM_P (operands[1]))
1617 operands[1] = adjust_address (operands[1], SFmode, 0);
1620 emit_insn (gen_lshrdi3 (operands[0], operands[1], GEN_INT (32)));
1625 (define_insn_and_split "*vec_extractv2sf_1_le"
1626 [(set (match_operand:SF 0 "register_operand" "=r")
1627 (unspec:SF [(match_operand:V2SF 1 "register_operand" "r")
1630 "!TARGET_BIG_ENDIAN"
1632 "&& reload_completed"
1635 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
1636 operands[1] = gen_rtx_REG (DImode, REGNO (operands[1]));
1637 emit_insn (gen_lshrdi3 (operands[0], operands[1], GEN_INT (32)));
1641 (define_insn_and_split "*vec_extractv2sf_1_be"
1642 [(set (match_operand:SF 0 "register_operand" "=rf")
1643 (unspec:SF [(match_operand:V2SF 1 "register_operand" "r")
1648 "&& reload_completed"
1649 [(set (match_dup 0) (match_dup 1))]
1651 operands[1] = gen_rtx_REG (SFmode, REGNO (operands[1]));
1654 (define_expand "vec_extractv2sf"
1655 [(set (match_operand:SF 0 "register_operand" "")
1656 (unspec:SF [(match_operand:V2SF 1 "register_operand" "")
1657 (match_operand:DI 2 "const_int_operand" "")]
1662 (define_expand "vec_unpacku_lo_<mode>"
1663 [(match_operand:<vecwider> 0 "register_operand" "")
1664 (match_operand:VECINT12 1 "register_operand" "")]
1667 ia64_expand_unpack (operands, true, false);
1671 (define_expand "vec_unpacku_hi_<mode>"
1672 [(match_operand:<vecwider> 0 "register_operand" "")
1673 (match_operand:VECINT12 1 "register_operand" "")]
1676 ia64_expand_unpack (operands, true, true);
1680 (define_expand "vec_unpacks_lo_<mode>"
1681 [(match_operand:<vecwider> 0 "register_operand" "")
1682 (match_operand:VECINT12 1 "register_operand" "")]
1685 ia64_expand_unpack (operands, false, false);
1689 (define_expand "vec_unpacks_hi_<mode>"
1690 [(match_operand:<vecwider> 0 "register_operand" "")
1691 (match_operand:VECINT12 1 "register_operand" "")]
1694 ia64_expand_unpack (operands, false, true);
1698 (define_expand "vec_pack_trunc_v4hi"
1699 [(match_operand:V8QI 0 "gr_register_operand" "")
1700 (match_operand:V4HI 1 "gr_register_operand" "")
1701 (match_operand:V4HI 2 "gr_register_operand" "")]
1704 rtx op1 = gen_lowpart (V8QImode, operands[1]);
1705 rtx op2 = gen_lowpart (V8QImode, operands[2]);
1706 if (TARGET_BIG_ENDIAN)
1707 emit_insn (gen_vec_extract_oddv8qi (operands[0], op1, op2));
1709 emit_insn (gen_vec_extract_evenv8qi (operands[0], op1, op2));
1713 (define_expand "vec_pack_trunc_v2si"
1714 [(match_operand:V4HI 0 "gr_register_operand" "")
1715 (match_operand:V2SI 1 "gr_register_operand" "")
1716 (match_operand:V2SI 2 "gr_register_operand" "")]
1719 rtx op1 = gen_lowpart (V4HImode, operands[1]);
1720 rtx op2 = gen_lowpart (V4HImode, operands[2]);
1721 if (TARGET_BIG_ENDIAN)
1722 emit_insn (gen_vec_extract_oddv4hi (operands[0], op1, op2));
1724 emit_insn (gen_vec_extract_evenv4hi (operands[0], op1, op2));
1728 ;; Missing operations