1 ;; IA-64 machine description for vector operations.
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 2, 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 COPYING. If not, write to
18 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
19 ;; Boston, MA 02111-1307, USA.
22 ;; Integer vector operations
24 (define_mode_macro VECINT [V8QI V4HI V2SI])
25 (define_mode_macro VECINT12 [V8QI V4HI])
26 (define_mode_macro VECINT24 [V4HI V2SI])
27 (define_mode_attr vecsize [(V8QI "1") (V4HI "2") (V2SI "4")])
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 l1, h1, l2, h2, lm, hm, lz, hz;
177 l1 = gen_reg_rtx (V4HImode);
178 h1 = gen_reg_rtx (V4HImode);
179 l2 = gen_reg_rtx (V4HImode);
180 h2 = gen_reg_rtx (V4HImode);
182 /* Zero-extend the QImode elements into two words of HImode elements. */
183 emit_insn (gen_unpack1_l (gen_lowpart (V8QImode, l1),
184 operands[1], CONST0_RTX (V8QImode)));
185 emit_insn (gen_unpack1_l (gen_lowpart (V8QImode, l2),
186 operands[2], CONST0_RTX (V8QImode)));
187 emit_insn (gen_unpack1_h (gen_lowpart (V8QImode, h1),
188 operands[1], CONST0_RTX (V8QImode)));
189 emit_insn (gen_unpack1_h (gen_lowpart (V8QImode, h2),
190 operands[2], CONST0_RTX (V8QImode)));
193 lm = gen_reg_rtx (V4HImode);
194 hm = gen_reg_rtx (V4HImode);
195 emit_insn (gen_mulv4hi3 (lm, l1, l2));
196 emit_insn (gen_mulv4hi3 (hm, h1, h2));
198 /* Zap the high order bytes of the HImode elements. There are several
199 ways that this could be done. On Itanium2, there's 1 cycle latency
200 moving between the ALU units and the PALU units, so using AND would
201 be 3 cycles latency into the eventual pack insn, whereas using MIX
203 lz = gen_reg_rtx (V4HImode);
204 hz = gen_reg_rtx (V4HImode);
205 emit_insn (gen_mix1_r (gen_lowpart (V8QImode, lz),
206 gen_lowpart (V8QImode, lm), CONST0_RTX (V8QImode)));
207 emit_insn (gen_mix1_r (gen_lowpart (V8QImode, lz),
208 gen_lowpart (V8QImode, lm), CONST0_RTX (V8QImode)));
210 /* Repack the HImode elements as QImode elements. */
211 emit_insn (gen_pack2_sss (operands[0], lz, hz));
215 (define_insn "mulv4hi3"
216 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
217 (mult:V4HI (match_operand:V4HI 1 "gr_register_operand" "r")
218 (match_operand:V4HI 2 "gr_register_operand" "r")))]
220 "pmpyshr2 %0 = %1, %2, 0"
221 [(set_attr "itanium_class" "mmalua")])
223 (define_expand "umax<mode>3"
224 [(set (match_operand:VECINT 0 "gr_register_operand" "")
225 (smax:VECINT (match_operand:VECINT 1 "gr_register_operand" "")
226 (match_operand:VECINT 2 "gr_register_operand" "")))]
229 if (ia64_expand_vecint_minmax (UMAX, <MODE>mode, operands))
233 (define_expand "smax<mode>3"
234 [(set (match_operand:VECINT 0 "gr_register_operand" "")
235 (smax:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
236 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
239 if (ia64_expand_vecint_minmax (SMAX, <MODE>mode, operands))
243 (define_expand "umin<mode>3"
244 [(set (match_operand:VECINT 0 "gr_register_operand" "")
245 (umin:VECINT (match_operand:VECINT 1 "gr_register_operand" "")
246 (match_operand:VECINT 2 "gr_register_operand" "")))]
249 if (ia64_expand_vecint_minmax (UMIN, <MODE>mode, operands))
253 (define_expand "smin<mode>3"
254 [(set (match_operand:VECINT 0 "gr_register_operand" "")
255 (smin:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
256 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
259 if (ia64_expand_vecint_minmax (SMIN, <MODE>mode, operands))
263 (define_insn "*umaxv8qi3"
264 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
265 (umax:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
266 (match_operand:V8QI 2 "gr_register_operand" "r")))]
268 "pmax1.u %0 = %1, %2"
269 [(set_attr "itanium_class" "mmshf")])
271 (define_insn "*smaxv4hi3"
272 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
273 (smax:V4HI (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
274 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU")))]
276 "pmax2 %0 = %r1, %r2"
277 [(set_attr "itanium_class" "mmshf")])
279 (define_insn "*uminv8qi3"
280 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
281 (umin:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
282 (match_operand:V8QI 2 "gr_register_operand" "r")))]
284 "pmin1.u %0 = %1, %2"
285 [(set_attr "itanium_class" "mmshf")])
287 (define_insn "*sminv4hi3"
288 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
289 (smin:V4HI (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
290 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU")))]
292 "pmin2 %0 = %r1, %r2"
293 [(set_attr "itanium_class" "mmshf")])
295 (define_insn "ashl<mode>3"
296 [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
298 (match_operand:VECINT24 1 "gr_register_operand" "r")
299 (match_operand:VECINT24 2 "gr_reg_or_5bit_operand" "rn")))]
301 "pshl<vecsize> %0 = %1, %2"
302 [(set_attr "itanium_class" "mmshf")])
304 (define_insn "ashr<mode>3"
305 [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
307 (match_operand:VECINT24 1 "gr_register_operand" "r")
308 (match_operand:VECINT24 2 "gr_reg_or_5bit_operand" "rn")))]
310 "pshr<vecsize> %0 = %1, %2"
311 [(set_attr "itanium_class" "mmshf")])
313 (define_insn "lshr<mode>3"
314 [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
316 (match_operand:VECINT24 1 "gr_register_operand" "r")
317 (match_operand:VECINT24 2 "gr_reg_or_5bit_operand" "rn")))]
319 "pshr<vecsize>.u %0 = %1, %2"
320 [(set_attr "itanium_class" "mmshf")])
322 (define_expand "vcond<mode>"
323 [(set (match_operand:VECINT 0 "gr_register_operand" "")
326 [(match_operand:VECINT 4 "gr_reg_or_0_operand" "")
327 (match_operand:VECINT 5 "gr_reg_or_0_operand" "")])
328 (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
329 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
332 ia64_expand_vecint_cmov (operands);
336 (define_expand "vcondu<mode>"
337 [(set (match_operand:VECINT 0 "gr_register_operand" "")
340 [(match_operand:VECINT 4 "gr_reg_or_0_operand" "")
341 (match_operand:VECINT 5 "gr_reg_or_0_operand" "")])
342 (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
343 (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
346 ia64_expand_vecint_cmov (operands);
350 (define_insn "*cmpeq_<mode>"
351 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
352 (eq:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "rU")
353 (match_operand:VECINT 2 "gr_reg_or_0_operand" "rU")))]
355 "pcmp<vecsize>.eq %0 = %r1, %r2"
356 [(set_attr "itanium_class" "mmalua")])
358 (define_insn "*cmpgt_<mode>"
359 [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
360 (gt:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "rU")
361 (match_operand:VECINT 2 "gr_reg_or_0_operand" "rU")))]
363 "pcmp<vecsize>.gt %0 = %r1, %r2"
364 [(set_attr "itanium_class" "mmalua")])
366 (define_insn "pack2_sss"
367 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
370 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU"))
372 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))))]
374 "pack2.sss %0 = %r1, %r2"
375 [(set_attr "itanium_class" "mmshf")])
377 (define_insn "*pack2_uss"
378 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
381 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU"))
383 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))))]
385 "pack2.uss %0 = %r1, %r2"
386 [(set_attr "itanium_class" "mmshf")])
388 (define_insn "pack4_sss"
389 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
392 (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU"))
394 (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))))]
396 "pack4.sss %0 = %r1, %r2"
397 [(set_attr "itanium_class" "mmshf")])
399 (define_insn "unpack1_l"
400 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
403 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
404 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
405 (parallel [(const_int 0)
414 "unpack1.l %0 = %r2, %r1"
415 [(set_attr "itanium_class" "mmshf")])
417 (define_insn "unpack1_h"
418 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
421 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
422 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
423 (parallel [(const_int 4)
432 "unpack1.h %0 = %r2, %r1"
433 [(set_attr "itanium_class" "mmshf")])
435 (define_insn "mix1_r"
436 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
439 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
440 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
441 (parallel [(const_int 0)
450 "mix1.r %0 = %r2, %r1"
451 [(set_attr "itanium_class" "mmshf")])
453 (define_insn "*mix1_l"
454 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
457 (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
458 (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
459 (parallel [(const_int 1)
468 "mix1.l %0 = %r2, %r1"
469 [(set_attr "itanium_class" "mmshf")])
471 (define_insn "*mux1_rev"
472 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
474 (match_operand:V8QI 1 "gr_register_operand" "r")
475 (parallel [(const_int 7)
485 [(set_attr "itanium_class" "mmshf")])
487 (define_insn "*mux1_mix"
488 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
490 (match_operand:V8QI 1 "gr_register_operand" "r")
491 (parallel [(const_int 0)
501 [(set_attr "itanium_class" "mmshf")])
503 (define_insn "*mux1_shuf"
504 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
506 (match_operand:V8QI 1 "gr_register_operand" "r")
507 (parallel [(const_int 0)
516 "mux1 %0 = %1, @shuf"
517 [(set_attr "itanium_class" "mmshf")])
519 (define_insn "*mux1_alt"
520 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
522 (match_operand:V8QI 1 "gr_register_operand" "r")
523 (parallel [(const_int 0)
533 [(set_attr "itanium_class" "mmshf")])
535 (define_insn "*mux1_brcst_v8qi"
536 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
538 (match_operand:V8QI 1 "gr_register_operand" "r")
539 (parallel [(const_int 0)
548 "mux1 %0 = %1, @brcst"
549 [(set_attr "itanium_class" "mmshf")])
551 (define_insn "*mux1_brcst_qi"
552 [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
554 (match_operand:QI 1 "gr_register_operand" "r")))]
556 "mux1 %0 = %1, @brcst"
557 [(set_attr "itanium_class" "mmshf")])
559 (define_insn "unpack2_l"
560 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
563 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
564 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
565 (parallel [(const_int 0)
570 "unpack2.l %0 = %r2, %r1"
571 [(set_attr "itanium_class" "mmshf")])
573 (define_insn "unpack2_h"
574 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
577 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
578 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
579 (parallel [(const_int 2)
584 "unpack2.h %0 = %r2, %r1"
585 [(set_attr "itanium_class" "mmshf")])
587 (define_insn "*mix2_r"
588 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
591 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
592 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
593 (parallel [(const_int 0)
598 "mix2.r %0 = %r2, %r1"
599 [(set_attr "itanium_class" "mmshf")])
601 (define_insn "*mix2_l"
602 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
605 (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
606 (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
607 (parallel [(const_int 1)
612 "mix2.l %0 = %r2, %r1"
613 [(set_attr "itanium_class" "mmshf")])
616 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
618 (match_operand:V4HI 1 "gr_register_operand" "r")
619 (parallel [(match_operand 2 "const_int_2bit_operand" "")
620 (match_operand 3 "const_int_2bit_operand" "")
621 (match_operand 4 "const_int_2bit_operand" "")
622 (match_operand 5 "const_int_2bit_operand" "")])))]
626 mask = INTVAL (operands[2]);
627 mask |= INTVAL (operands[3]) << 2;
628 mask |= INTVAL (operands[4]) << 4;
629 mask |= INTVAL (operands[5]) << 6;
630 operands[2] = GEN_INT (mask);
631 return "%,mux2 %0 = %1, %2";
633 [(set_attr "itanium_class" "mmshf")])
635 (define_insn "*mux2_brcst_hi"
636 [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
638 (match_operand:HI 1 "gr_register_operand" "r")))]
641 [(set_attr "itanium_class" "mmshf")])
643 ;; Note that mix4.r performs the exact same operation.
644 (define_insn "*unpack4_l"
645 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
648 (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU")
649 (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))
650 (parallel [(const_int 0)
653 "unpack4.l %0 = %r2, %r1"
654 [(set_attr "itanium_class" "mmshf")])
656 ;; Note that mix4.l performs the exact same operation.
657 (define_insn "*unpack4_h"
658 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
661 (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU")
662 (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))
663 (parallel [(const_int 1)
666 "unpack4.h %0 = %r2, %r1"
667 [(set_attr "itanium_class" "mmshf")])
669 (define_expand "vec_initv2si"
670 [(match_operand:V2SF 0 "gr_register_operand" "")
671 (match_operand 1 "" "")]
674 rtx op1 = XVECEXP (operands[1], 0, 0);
675 rtx op2 = XVECEXP (operands[1], 0, 1);
678 if (GET_CODE (op1) == CONST_INT && GET_CODE (op2) == CONST_INT)
680 x = gen_rtx_CONST_VECTOR (V2SImode, XVEC (operands[1], 0));
681 emit_move_insn (operands[0], x);
685 if (!gr_reg_or_0_operand (op1, SImode))
686 op1 = force_reg (SImode, op1);
687 if (!gr_reg_or_0_operand (op2, SImode))
688 op2 = force_reg (SImode, op2);
690 x = gen_rtx_VEC_CONCAT (V2SImode, op1, op2);
691 emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
695 (define_insn "*vecinit_v2si"
696 [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
698 (match_operand:SI 1 "gr_reg_or_0_operand" "rO")
699 (match_operand:SI 2 "gr_reg_or_0_operand" "rO")))]
701 "unpack4.l %0 = %r2, %r1"
702 [(set_attr "itanium_class" "mmshf")])
704 ;; Missing operations
709 ;; pmpyshr, general form
718 ;; Floating point vector operations
720 (define_expand "movv2sf"
721 [(set (match_operand:V2SF 0 "general_operand" "")
722 (match_operand:V2SF 1 "general_operand" ""))]
725 rtx op1 = ia64_expand_move (operands[0], operands[1]);
731 (define_insn "*movv2sf_internal"
732 [(set (match_operand:V2SF 0 "destination_operand"
733 "=f,f,f,Q,*r ,*r,*r,*r,m ,f ,*r")
734 (match_operand:V2SF 1 "move_operand"
735 "fU,Y,Q,f,U*r,W ,i ,m ,*r,*r,f "))]
736 "ia64_move_ok (operands[0], operands[1])"
738 static const char * const alt[] = {
740 "%,fpack %0 = %F2, %F1",
744 "%,addl %0 = %v1, r0",
746 "%,ld8%O1 %0 = %1%P1",
747 "%,st8%Q0 %0 = %r1%P0",
748 "%,setf.sig %0 = %1",
752 if (which_alternative == 1)
754 operands[2] = XVECEXP (operands[1], 0, 1);
755 operands[1] = XVECEXP (operands[1], 0, 0);
758 return alt[which_alternative];
760 [(set_attr "itanium_class" "fmisc,fmisc,fld,stf,ialu,ialu,long_i,ld,st,tofr,frfr")])
762 (define_insn "absv2sf2"
763 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
764 (abs:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")))]
767 [(set_attr "itanium_class" "fmisc")])
769 (define_insn "negv2sf2"
770 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
771 (neg:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")))]
774 [(set_attr "itanium_class" "fmisc")])
776 (define_insn "*negabsv2sf2"
777 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
779 (abs:V2SF (match_operand:V2SF 1 "fr_register_operand" "f"))))]
782 [(set_attr "itanium_class" "fmisc")])
784 (define_expand "addv2sf3"
785 [(set (match_operand:V2SF 0 "fr_register_operand" "")
787 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "")
789 (match_operand:V2SF 2 "fr_register_operand" "")))]
792 rtvec v = gen_rtvec (2, CONST1_RTX (SFmode), CONST1_RTX (SFmode));
793 operands[3] = force_reg (V2SFmode, gen_rtx_CONST_VECTOR (V2SFmode, v));
796 (define_expand "subv2sf3"
797 [(set (match_operand:V2SF 0 "fr_register_operand" "")
799 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "")
801 (match_operand:V2SF 2 "fr_register_operand" "")))]
804 rtvec v = gen_rtvec (2, CONST1_RTX (SFmode), CONST1_RTX (SFmode));
805 operands[3] = force_reg (V2SFmode, gen_rtx_CONST_VECTOR (V2SFmode, v));
808 (define_insn "mulv2sf3"
809 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
810 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
811 (match_operand:V2SF 2 "fr_register_operand" "f")))]
814 [(set_attr "itanium_class" "fmac")])
817 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
819 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
820 (match_operand:V2SF 2 "fr_register_operand" "f"))
821 (match_operand:V2SF 3 "fr_register_operand" "f")))]
823 "fpma %0 = %1, %2, %3"
824 [(set_attr "itanium_class" "fmac")])
827 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
829 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
830 (match_operand:V2SF 2 "fr_register_operand" "f"))
831 (match_operand:V2SF 3 "fr_register_operand" "f")))]
833 "fpms %0 = %1, %2, %3"
834 [(set_attr "itanium_class" "fmac")])
836 (define_insn "*fpnmpy"
837 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
839 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
840 (match_operand:V2SF 2 "fr_register_operand" "f"))))]
843 [(set_attr "itanium_class" "fmac")])
845 (define_insn "*fpnma"
846 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
849 (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
850 (match_operand:V2SF 2 "fr_register_operand" "f")))
851 (match_operand:V2SF 3 "fr_register_operand" "f")))]
853 "fpnma %0 = %1, %2, %3"
854 [(set_attr "itanium_class" "fmac")])
856 (define_insn "smaxv2sf2"
857 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
858 (smax:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
859 (match_operand:V2SF 2 "fr_register_operand" "f")))]
862 [(set_attr "itanium_class" "fmisc")])
864 (define_insn "sminv2sf2"
865 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
866 (smin:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
867 (match_operand:V2SF 2 "fr_register_operand" "f")))]
870 [(set_attr "itanium_class" "fmisc")])
872 (define_expand "vcondv2sf"
873 [(set (match_operand:V2SF 0 "fr_register_operand" "")
876 [(match_operand:V2SF 4 "fr_reg_or_0_operand" "")
877 (match_operand:V2SF 5 "fr_reg_or_0_operand" "")])
878 (match_operand:V2SF 1 "fr_reg_or_0_operand" "")
879 (match_operand:V2SF 2 "fr_reg_or_0_operand" "")))]
884 PUT_MODE (operands[3], V2SFmode);
885 switch (GET_CODE (operands[3]))
897 x = XEXP (operands[3], 0);
898 XEXP (operands[3], 0) = XEXP (operands[3], 1);
899 XEXP (operands[3], 1) = x;
900 PUT_CODE (operands[3], swap_condition (GET_CODE (operands[3])));
907 cmp = gen_reg_rtx (V2SFmode);
908 emit_insn (gen_rtx_SET (VOIDmode, cmp, operands[3]));
910 x = gen_rtx_IF_THEN_ELSE (V2SFmode, cmp, operands[1], operands[2]);
911 emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
915 (define_insn "*fpcmp"
916 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
918 (match_operand:V2SF 1 "fr_register_operand" "f")
919 (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU")
920 (match_operand:V2SF 3 "fr_reg_or_0_operand" "fU")))]
922 "fselect %0 = %2, %3, %1"
923 [(set_attr "itanium_class" "fmisc")])
925 (define_expand "vec_initv2sf"
926 [(match_operand:V2SF 0 "fr_register_operand" "")
927 (match_operand 1 "" "")]
930 rtx op1 = XVECEXP (operands[1], 0, 0);
931 rtx op2 = XVECEXP (operands[1], 0, 1);
934 if (GET_CODE (op1) == CONST_DOUBLE && GET_CODE (op2) == CONST_DOUBLE)
936 x = gen_rtx_CONST_VECTOR (V2SFmode, XVEC (operands[1], 0));
937 emit_move_insn (operands[0], x);
941 if (!fr_reg_or_fp01_operand (op1, SFmode))
942 op1 = force_reg (SFmode, op1);
943 if (!fr_reg_or_fp01_operand (op2, SFmode))
944 op2 = force_reg (SFmode, op2);
946 x = gen_rtx_VEC_CONCAT (V2SFmode, op1, op2);
947 emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
951 (define_insn "*fpack_sfsf"
952 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
954 (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
955 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
957 "fpack %0 = %F2, %F1"
958 [(set_attr "itanium_class" "fmisc")])
960 (define_insn "*fpack_sfxf"
961 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
963 (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
965 (match_operand 2 "fr_register_operand" "f"))))]
966 "GET_MODE (operands[2]) == DFmode || GET_MODE (operands[2]) == XFmode"
968 [(set_attr "itanium_class" "fmisc")])
970 (define_insn "*fpack_xfsf"
971 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
974 (match_operand 1 "fr_register_operand" "f"))
975 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
976 "GET_MODE (operands[1]) == DFmode || GET_MODE (operands[1]) == XFmode"
978 [(set_attr "itanium_class" "fmisc")])
980 (define_insn "*fpack_xfxf"
981 [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
984 (match_operand 1 "fr_register_operand" "f"))
986 (match_operand 2 "fr_register_operand" "f"))))]
987 "(GET_MODE (operands[1]) == DFmode || GET_MODE (operands[1]) == XFmode)
988 && (GET_MODE (operands[2]) == DFmode || GET_MODE (operands[2]) == XFmode)"
990 [(set_attr "itanium_class" "fmisc")])
992 ;; Missing operations