1 ;;- Instruction patterns for the System z vector facility builtins.
2 ;; Copyright (C) 2015 Free Software Foundation, Inc.
3 ;; Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify it under
8 ;; the terms of the GNU General Public License as published by the Free
9 ;; Software Foundation; either version 3, or (at your option) any later
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ; The patterns in this file are enabled with -mzvector
23 (define_mode_iterator V_HW_64 [V2DI V2DF])
24 (define_mode_iterator V_HW_32_64 [V4SI V2DI V2DF])
25 (define_mode_iterator VI_HW_SD [V4SI V2DI])
26 (define_mode_iterator V_HW_HSD [V8HI V4SI V2DI V2DF])
27 (define_mode_iterator VI_HW_HSD [V8HI V4SI V2DI])
29 ; The element type of the vector with floating point modes translated
30 ; to int modes of the same size.
31 (define_mode_attr non_vec_int[(V2QI "QI") (V4QI "QI") (V8QI "QI") (V16QI "QI")
32 (V2HI "HI") (V4HI "HI") (V8HI "HI")
33 (V2SI "SI") (V4SI "SI")
35 (V2SF "SI") (V4SF "SI")
38 ; Condition code modes generated by int comparisons
39 (define_mode_iterator VICMP [CCVEQ CCVH CCVHU])
41 ; Comparisons supported by the vec_cmp* builtins
42 (define_code_iterator intcmp [eq gt gtu ge geu lt ltu le leu])
43 (define_code_iterator fpcmp [eq gt ge lt le])
45 ; Comparisons supported by the vec_all/any* builtins
46 (define_code_iterator intcmpcc [eq ne gt ge lt le gtu geu ltu leu])
47 (define_code_iterator fpcmpcc [eq ne gt ge unle unlt lt le])
49 ; Flags for vector string instructions (vfae all 4, vfee only ZS and CS, vstrc all 4)
51 [(VSTRING_FLAG_IN 8) ; invert result
52 (VSTRING_FLAG_RT 4) ; result type
53 (VSTRING_FLAG_ZS 2) ; zero search
54 (VSTRING_FLAG_CS 1)]) ; condition code set
56 ; Rounding modes as being used for e.g. VFI
59 (VEC_RND_NEAREST_AWAY_FROM_ZERO 1)
60 (VEC_RND_SHORT_PREC 3)
61 (VEC_RND_NEAREST_TO_EVEN 4)
67 ; Vector gather element
69 (define_insn "vec_gather_element<mode>"
70 [(set (match_operand:V_HW_32_64 0 "register_operand" "=v")
71 (unspec:V_HW_32_64 [(match_operand:V_HW_32_64 1 "register_operand" "0")
72 (match_operand:<tointvec> 2 "register_operand" "v")
73 (match_operand:BLK 3 "memory_operand" "QR")
74 (match_operand:QI 4 "immediate_operand" "C")]
77 "vge<bhfgq>\t%0,%O3(%v2,%R3),%b4"
78 [(set_attr "op_type" "VRV")])
80 (define_expand "vec_genmask<mode>"
81 [(match_operand:VI_HW 0 "register_operand" "=v")
82 (match_operand:QI 1 "immediate_operand" "C")
83 (match_operand:QI 2 "immediate_operand" "C")]
86 int nunits = GET_MODE_NUNITS (<VI_HW:MODE>mode);
87 int bitlen = GET_MODE_UNIT_BITSIZE (<VI_HW:MODE>mode);
88 /* To bit little endian style. */
89 int end = bitlen - 1 - INTVAL (operands[1]);
90 int start = bitlen - 1 - INTVAL (operands[2]);
93 unsigned HOST_WIDE_INT mask;
94 bool swapped_p = false;
98 i = start - 1; start = end + 1; end = i;
102 mask = HOST_WIDE_INT_M1U;
104 mask = (HOST_WIDE_INT_1U << (end + 1)) - 1;
106 mask &= ~((HOST_WIDE_INT_1U << start) - 1);
111 for (i = 0; i < nunits; i++)
112 const_vec[i] = GEN_INT (trunc_int_for_mode (mask,
113 GET_MODE_INNER (<VI_HW:MODE>mode)));
115 emit_insn (gen_rtx_SET (operands[0],
116 gen_rtx_CONST_VECTOR (<VI_HW:MODE>mode,
117 gen_rtvec_v (nunits, const_vec))));
121 (define_expand "vec_genbytemaskv16qi"
122 [(match_operand:V16QI 0 "register_operand" "")
123 (match_operand 1 "immediate_operand" "")]
124 "TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[1]), 'K', \"K\")"
127 unsigned mask = 0x8000;
129 unsigned HOST_WIDE_INT byte_mask = INTVAL (operands[1]);
131 for (i = 0; i < 16; i++)
133 if (mask & byte_mask)
134 const_vec[i] = constm1_rtx;
136 const_vec[i] = const0_rtx;
139 emit_insn (gen_rtx_SET (operands[0],
140 gen_rtx_CONST_VECTOR (V16QImode,
141 gen_rtvec_v (16, const_vec))));
145 (define_expand "vec_splats<mode>"
146 [(set (match_operand:V_HW 0 "register_operand" "")
147 (vec_duplicate:V_HW (match_operand:<non_vec> 1 "general_operand" "")))]
150 (define_expand "vec_insert<mode>"
151 [(set (match_operand:V_HW 0 "register_operand" "")
152 (unspec:V_HW [(match_operand:<non_vec> 2 "register_operand" "")
153 (match_operand:SI 3 "shift_count_or_setmem_operand" "")
154 (match_operand:V_HW 1 "register_operand" "")]
159 ; This is vec_set + modulo arithmetic on the element selector (op 2)
160 (define_expand "vec_promote<mode>"
161 [(set (match_operand:V_HW 0 "register_operand" "")
162 (unspec:V_HW [(match_operand:<non_vec> 1 "register_operand" "")
163 (match_operand:SI 2 "shift_count_or_setmem_operand" "")
169 ; vec_extract is also an RTL standard name -> vector.md
171 (define_insn "vec_insert_and_zero<mode>"
172 [(set (match_operand:V_HW 0 "register_operand" "=v")
173 (unspec:V_HW [(match_operand:<non_vec> 1 "memory_operand" "QR")]
174 UNSPEC_VEC_INSERT_AND_ZERO))]
176 "vllez<bhfgq>\t%v0,%1"
177 [(set_attr "op_type" "VRX")])
180 [(set (match_operand:V16QI 0 "register_operand" "=v")
181 (unspec:V16QI [(match_operand:BLK 1 "memory_operand" "QR")
182 (match_operand:HI 2 "immediate_operand" " K")]
183 UNSPEC_VEC_LOAD_BNDRY))]
186 [(set_attr "op_type" "VRX")])
188 ; FIXME: The following two patterns might using vec_merge. But what is
189 ; the canonical form: (vec_select (vec_merge op0 op1)) or (vec_merge
190 ; (vec_select op0) (vec_select op1)
191 (define_insn "vec_mergeh<mode>"
192 [(set (match_operand:V_HW 0 "register_operand" "=v")
193 (unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v")
194 (match_operand:V_HW 2 "register_operand" "v")]
197 "vmrh<bhfgq>\t%v0,%1,%2"
198 [(set_attr "op_type" "VRR")])
200 (define_insn "vec_mergel<mode>"
201 [(set (match_operand:V_HW 0 "register_operand" "=v")
202 (unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v")
203 (match_operand:V_HW 2 "register_operand" "v")]
206 "vmrl<bhfgq>\t%v0,%1,%2"
207 [(set_attr "op_type" "VRR")])
212 (define_insn "vec_pack<mode>"
213 [(set (match_operand:<vec_half> 0 "register_operand" "=v")
214 (unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v")
215 (match_operand:VI_HW_HSD 2 "register_operand" "v")]
218 "vpk<bhfgq>\t%v0,%v1,%v2"
219 [(set_attr "op_type" "VRR")])
222 ; Vector pack saturate
224 (define_insn "vec_packs<mode>"
225 [(set (match_operand:<vec_half> 0 "register_operand" "=v")
226 (unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v")
227 (match_operand:VI_HW_HSD 2 "register_operand" "v")]
228 UNSPEC_VEC_PACK_SATURATE))]
230 "vpks<bhfgq>\t%v0,%v1,%v2"
231 [(set_attr "op_type" "VRR")])
234 ; This is vec_packs_cc + loading cc into a caller specified memory location.
235 (define_expand "vec_packs_cc<mode>"
237 [(set (reg:CCRAW CC_REGNUM)
238 (unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "")
239 (match_operand:VI_HW_HSD 2 "register_operand" "")]
240 UNSPEC_VEC_PACK_SATURATE_GENCC))
241 (set (match_operand:<vec_half> 0 "register_operand" "")
242 (unspec:<vec_half> [(match_dup 1) (match_dup 2)]
243 UNSPEC_VEC_PACK_SATURATE_CC))])
245 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))
246 (set (match_operand:SI 3 "memory_operand" "")
250 operands[4] = gen_reg_rtx (SImode);
253 (define_insn "*vec_packs_cc<mode>"
254 [(set (reg:CCRAW CC_REGNUM)
255 (unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "v")
256 (match_operand:VI_HW_HSD 2 "register_operand" "v")]
257 UNSPEC_VEC_PACK_SATURATE_GENCC))
258 (set (match_operand:<vec_half> 0 "register_operand" "=v")
259 (unspec:<vec_half> [(match_dup 1) (match_dup 2)]
260 UNSPEC_VEC_PACK_SATURATE_CC))]
262 "vpks<bhfgq>s\t%v0,%v1,%v2"
263 [(set_attr "op_type" "VRR")])
266 ; Vector pack logical saturate
268 (define_insn "vec_packsu<mode>"
269 [(set (match_operand:<vec_half> 0 "register_operand" "=v")
270 (unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v")
271 (match_operand:VI_HW_HSD 2 "register_operand" "v")]
272 UNSPEC_VEC_PACK_UNSIGNED_SATURATE))]
274 "vpkls<bhfgq>\t%v0,%v1,%v2"
275 [(set_attr "op_type" "VRR")])
277 ; Emulate saturate unsigned pack on signed operands.
278 ; Zero out negative elements and continue with the unsigned saturating pack.
279 (define_expand "vec_packsu_u<mode>"
280 [(set (match_operand:<vec_half> 0 "register_operand" "=v")
281 (unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v")
282 (match_operand:VI_HW_HSD 2 "register_operand" "v")]
283 UNSPEC_VEC_PACK_UNSIGNED_SATURATE))]
286 rtx null_vec = CONST0_RTX(<MODE>mode);
287 machine_mode half_mode;
290 case V8HImode: half_mode = V16QImode; break;
291 case V4SImode: half_mode = V8HImode; break;
292 case V2DImode: half_mode = V4SImode; break;
293 default: gcc_unreachable ();
295 s390_expand_vcond (operands[1], operands[1], null_vec,
296 GE, operands[1], null_vec);
297 s390_expand_vcond (operands[2], operands[2], null_vec,
298 GE, operands[2], null_vec);
299 emit_insn (gen_rtx_SET (operands[0],
300 gen_rtx_UNSPEC (half_mode,
301 gen_rtvec (2, operands[1], operands[2]),
302 UNSPEC_VEC_PACK_UNSIGNED_SATURATE)));
306 ; This is vec_packsu_cc + loading cc into a caller specified memory location.
307 ; FIXME: The reg to target mem copy should be issued by reload?!
308 (define_expand "vec_packsu_cc<mode>"
310 [(set (reg:CCRAW CC_REGNUM)
311 (unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "")
312 (match_operand:VI_HW_HSD 2 "register_operand" "")]
313 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC))
314 (set (match_operand:<vec_half> 0 "register_operand" "")
315 (unspec:<vec_half> [(match_dup 1) (match_dup 2)]
316 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC))])
318 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))
319 (set (match_operand:SI 3 "memory_operand" "")
323 operands[4] = gen_reg_rtx (SImode);
326 (define_insn "*vec_packsu_cc<mode>"
327 [(set (reg:CCRAW CC_REGNUM)
328 (unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "v")
329 (match_operand:VI_HW_HSD 2 "register_operand" "v")]
330 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC))
331 (set (match_operand:<vec_half> 0 "register_operand" "=v")
332 (unspec:<vec_half> [(match_dup 1) (match_dup 2)]
333 UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC))]
335 "vpkls<bhfgq>s\t%v0,%v1,%v2"
336 [(set_attr "op_type" "VRR")])
341 ; vec_perm is also RTL standard name, but we can only use it for V16QI
343 (define_insn "vec_zperm<mode>"
344 [(set (match_operand:V_HW_HSD 0 "register_operand" "=v")
345 (unspec:V_HW_HSD [(match_operand:V_HW_HSD 1 "register_operand" "v")
346 (match_operand:V_HW_HSD 2 "register_operand" "v")
347 (match_operand:V16QI 3 "register_operand" "v")]
350 "vperm\t%v0,%v1,%v2,%v3"
351 [(set_attr "op_type" "VRR")])
353 (define_expand "vec_permi<mode>"
354 [(set (match_operand:V_HW_64 0 "register_operand" "")
355 (unspec:V_HW_64 [(match_operand:V_HW_64 1 "register_operand" "")
356 (match_operand:V_HW_64 2 "register_operand" "")
357 (match_operand:QI 3 "immediate_operand" "")]
361 HOST_WIDE_INT val = INTVAL (operands[3]);
362 operands[3] = GEN_INT ((val & 1) | (val & 2) << 1);
365 (define_insn "*vec_permi<mode>"
366 [(set (match_operand:V_HW_64 0 "register_operand" "=v")
367 (unspec:V_HW_64 [(match_operand:V_HW_64 1 "register_operand" "v")
368 (match_operand:V_HW_64 2 "register_operand" "v")
369 (match_operand:QI 3 "immediate_operand" "C")]
372 "vpdi\t%v0,%v1,%v2,%b3"
373 [(set_attr "op_type" "VRR")])
379 ; Replicate from vector element
380 (define_expand "vec_splat<mode>"
381 [(set (match_operand:V_HW 0 "register_operand" "")
382 (vec_duplicate:V_HW (vec_select:<non_vec>
383 (match_operand:V_HW 1 "register_operand" "")
385 [(match_operand:QI 2 "immediate_operand" "")]))))]
388 ; Vector scatter element
392 ; A 64 bit target adress generated from 32 bit elements
393 (define_insn "vec_scatter_elementv4si_DI"
395 (plus:DI (zero_extend:DI
396 (unspec:SI [(match_operand:V4SI 1 "register_operand" "v")
397 (match_operand:DI 3 "immediate_operand" "I")]
399 (match_operand:SI 2 "address_operand" "ZQ")))
400 (unspec:SI [(match_operand:V4SI 0 "register_operand" "v")
401 (match_dup 3)] UNSPEC_VEC_EXTRACT))]
402 "TARGET_VX && TARGET_64BIT"
403 "vscef\t%v0,%O2(%v1,%R2),%3"
404 [(set_attr "op_type" "VRV")])
406 ; A 31 bit target address is generated from 64 bit elements
407 (define_insn "vec_scatter_element<V_HW_64:mode>_SI"
410 (unspec:<non_vec_int> [(match_operand:V_HW_64 1 "register_operand" "v")
411 (match_operand:DI 3 "immediate_operand" "I")]
412 UNSPEC_VEC_EXTRACT) 4)
413 (match_operand:SI 2 "address_operand" "ZQ")))
414 (unspec:<non_vec> [(match_operand:V_HW_64 0 "register_operand" "v")
415 (match_dup 3)] UNSPEC_VEC_EXTRACT))]
416 "TARGET_VX && !TARGET_64BIT"
417 "vsce<V_HW_64:bhfgq>\t%v0,%O2(%v1,%R2),%3"
418 [(set_attr "op_type" "VRV")])
420 ; Element size and target adress size is the same
421 (define_insn "vec_scatter_element<mode>_<non_vec_int>"
423 (plus:<non_vec_int> (unspec:<non_vec_int>
424 [(match_operand:<tointvec> 1 "register_operand" "v")
425 (match_operand:DI 3 "immediate_operand" "I")]
427 (match_operand:DI 2 "address_operand" "ZQ")))
428 (unspec:<non_vec> [(match_operand:V_HW_32_64 0 "register_operand" "v")
429 (match_dup 3)] UNSPEC_VEC_EXTRACT))]
431 "vsce<bhfgq>\t%v0,%O2(%v1,%R2),%3"
432 [(set_attr "op_type" "VRV")])
434 ; Depending on the address size we have to expand a different pattern.
435 ; This however cannot be represented in s390-builtins.def so we do the
436 ; multiplexing here in the expander.
437 (define_expand "vec_scatter_element<V_HW_32_64:mode>"
438 [(match_operand:V_HW_32_64 0 "register_operand" "")
439 (match_operand:<tointvec> 1 "register_operand" "")
440 (match_operand 2 "address_operand" "")
441 (match_operand:DI 3 "immediate_operand" "")]
446 PUT_MODE (operands[2], DImode);
448 gen_vec_scatter_element<V_HW_32_64:mode>_DI (operands[0], operands[1],
449 operands[2], operands[3]));
453 PUT_MODE (operands[2], SImode);
455 gen_vec_scatter_element<V_HW_32_64:mode>_SI (operands[0], operands[1],
456 operands[2], operands[3]));
464 ; Operand 3 selects bits from either OP1 (0) or OP2 (1)
466 ; Comparison operator should not matter as long as we always use the same ?!
468 ; Operands 1 and 2 are swapped in order to match the altivec builtin.
469 ; If operand 3 is a const_int bitmask this would be vec_merge
470 (define_expand "vec_sel<mode>"
471 [(set (match_operand:V_HW 0 "register_operand" "")
473 (eq (match_operand:<tointvec> 3 "register_operand" "")
475 (match_operand:V_HW 2 "register_operand" "")
476 (match_operand:V_HW 1 "register_operand" "")))]
479 operands[4] = CONST0_RTX (<tointvec>mode);
483 ; Vector sign extend to doubleword
485 ; Sign extend of right most vector element to respective double-word
486 (define_insn "vec_extend<mode>"
487 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
488 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")]
491 "vseg<bhfgq>\t%v0,%1"
492 [(set_attr "op_type" "VRR")])
495 ; Vector store with length
497 ; Store bytes in OP1 from OP0 with the highest indexed byte to be
498 ; stored from OP0 given by OP2
499 (define_insn "vstl<mode>"
500 [(set (match_operand:BLK 2 "memory_operand" "=Q")
501 (unspec:BLK [(match_operand:V 0 "register_operand" "v")
502 (match_operand:SI 1 "register_operand" "d")]
503 UNSPEC_VEC_STORE_LEN))]
506 [(set_attr "op_type" "VRS")])
511 ; vuphb, vuphh, vuphf
512 (define_insn "vec_unpackh<mode>"
513 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
514 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")]
515 UNSPEC_VEC_UNPACKH))]
517 "vuph<bhfgq>\t%v0,%v1"
518 [(set_attr "op_type" "VRR")])
520 ; vuplhb, vuplhh, vuplhf
521 (define_insn "vec_unpackh_l<mode>"
522 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
523 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")]
524 UNSPEC_VEC_UNPACKH_L))]
526 "vuplh<bhfgq>\t%v0,%v1"
527 [(set_attr "op_type" "VRR")])
532 ; vuplb, vuplhw, vuplf
533 (define_insn "vec_unpackl<mode>"
534 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
535 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")]
536 UNSPEC_VEC_UNPACKL))]
538 "vupl<bhfgq><w>\t%v0,%v1"
539 [(set_attr "op_type" "VRR")])
541 ; vupllb, vupllh, vupllf
542 (define_insn "vec_unpackl_l<mode>"
543 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
544 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")]
545 UNSPEC_VEC_UNPACKL_L))]
547 "vupll<bhfgq>\t%v0,%v1"
548 [(set_attr "op_type" "VRR")])
555 ; zvector builtins uses V16QI operands. So replace the modes in order
556 ; to map this to a TImode add. We have to keep the V16QI mode
557 ; operands in the expander in order to allow some operand type
558 ; checking when expanding the builtin.
559 (define_expand "vec_add_u128"
560 [(match_operand:V16QI 0 "register_operand" "")
561 (match_operand:V16QI 1 "register_operand" "")
562 (match_operand:V16QI 2 "register_operand" "")]
565 rtx op0 = gen_rtx_SUBREG (TImode, operands[0], 0);
566 rtx op1 = gen_rtx_SUBREG (TImode, operands[1], 0);
567 rtx op2 = gen_rtx_SUBREG (TImode, operands[2], 0);
569 emit_insn (gen_rtx_SET (op0,
570 gen_rtx_PLUS (TImode, op1, op2)));
574 ; Vector add compute carry
576 (define_insn "vec_addc<mode>"
577 [(set (match_operand:VI_HW 0 "register_operand" "=v")
578 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v")
579 (match_operand:VI_HW 2 "register_operand" "v")]
582 "vacc<bhfgq>\t%v0,%v1,%v2"
583 [(set_attr "op_type" "VRR")])
585 (define_insn "vec_addc_u128"
586 [(set (match_operand:V16QI 0 "register_operand" "=v")
587 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
588 (match_operand:V16QI 2 "register_operand" "v")]
589 UNSPEC_VEC_ADDC_U128))]
592 [(set_attr "op_type" "VRR")])
595 ; Vector add with carry
597 (define_insn "vec_adde_u128"
598 [(set (match_operand:V16QI 0 "register_operand" "=v")
599 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
600 (match_operand:V16QI 2 "register_operand" "v")
601 (match_operand:V16QI 3 "register_operand" "v")]
602 UNSPEC_VEC_ADDE_U128))]
604 "vacq\t%v0,%v1,%v2,%v3"
605 [(set_attr "op_type" "VRR")])
608 ; Vector add with carry compute carry
610 (define_insn "vec_addec_u128"
611 [(set (match_operand:V16QI 0 "register_operand" "=v")
612 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
613 (match_operand:V16QI 2 "register_operand" "v")
614 (match_operand:V16QI 3 "register_operand" "v")]
615 UNSPEC_VEC_ADDEC_U128))]
617 "vacccq\t%v0,%v1,%v2,%v3"
618 [(set_attr "op_type" "VRR")])
623 ; The following two patterns allow mixed mode and's as required for the intrinsics.
624 (define_insn "and_av2df3"
625 [(set (match_operand:V2DF 0 "register_operand" "=v")
626 (and:V2DF (subreg:V2DF (match_operand:V2DI 1 "register_operand" "v") 0)
627 (match_operand:V2DF 2 "register_operand" "v")))]
630 [(set_attr "op_type" "VRR")])
632 (define_insn "and_cv2df3"
633 [(set (match_operand:V2DF 0 "register_operand" "=v")
634 (and:V2DF (match_operand:V2DF 1 "register_operand" "v")
635 (subreg:V2DF (match_operand:V2DI 2 "register_operand" "v") 0)))]
638 [(set_attr "op_type" "VRR")])
641 ; Vector and with complement
644 (define_insn "vec_andc<mode>3"
645 [(set (match_operand:VT_HW 0 "register_operand" "=v")
646 (and:VT_HW (not:VT_HW (match_operand:VT_HW 2 "register_operand" "v"))
647 (match_operand:VT_HW 1 "register_operand" "v")))]
650 [(set_attr "op_type" "VRR")])
652 ; The following two patterns allow mixed mode and's as required for the intrinsics.
653 (define_insn "vec_andc_av2df3"
654 [(set (match_operand:V2DF 0 "register_operand" "=v")
655 (and:V2DF (not:V2DF (match_operand:V2DF 2 "register_operand" "v"))
656 (subreg:V2DF (match_operand:V2DI 1 "register_operand" "v") 0)))]
660 [(set_attr "op_type" "VRR")])
662 (define_insn "vec_andc_cv2df3"
663 [(set (match_operand:V2DF 0 "register_operand" "=v")
664 (and:V2DF (not:V2DF (subreg:V2DF (match_operand:V2DI 2 "register_operand" "v") 0))
665 (match_operand:V2DF 1 "register_operand" "v")))]
668 [(set_attr "op_type" "VRR")])
673 (define_insn "vec_avg<mode>"
674 [(set (match_operand:VI_HW 0 "register_operand" "=v")
675 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v")
676 (match_operand:VI_HW 2 "register_operand" "v")]
679 "vavg<bhfgq>\t%v0,%v1,%v2"
680 [(set_attr "op_type" "VRR")])
682 ; Vector average logical
684 (define_insn "vec_avgu<mode>"
685 [(set (match_operand:VI_HW 0 "register_operand" "=v")
686 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v")
687 (match_operand:VI_HW 2 "register_operand" "v")]
690 "vavgl<bhfgq>\t%v0,%v1,%v2"
691 [(set_attr "op_type" "VRR")])
696 (define_insn "vec_checksum"
697 [(set (match_operand:V4SI 0 "register_operand" "=v")
698 (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
699 (match_operand:V4SI 2 "register_operand" "v")]
700 UNSPEC_VEC_CHECKSUM))]
703 [(set_attr "op_type" "VRR")])
709 ; vec_all/any int compares
711 (define_expand "vec_all_<intcmpcc:code><VI_HW:mode>"
712 [(match_operand:SI 0 "register_operand" "")
713 (intcmpcc (match_operand:VI_HW 1 "register_operand" "")
714 (match_operand:VI_HW 2 "register_operand" ""))]
717 s390_expand_vec_compare_cc (operands[0],
725 (define_expand "vec_any_<intcmpcc:code><VI_HW:mode>"
726 [(match_operand:SI 0 "register_operand" "")
727 (intcmpcc (match_operand:VI_HW 1 "register_operand" "")
728 (match_operand:VI_HW 2 "register_operand" ""))]
731 s390_expand_vec_compare_cc (operands[0],
739 ; vec_all/any fp compares
741 (define_expand "vec_all_<fpcmpcc:code>v2df"
742 [(match_operand:SI 0 "register_operand" "")
743 (fpcmpcc (match_operand:V2DF 1 "register_operand" "")
744 (match_operand:V2DF 2 "register_operand" ""))]
747 s390_expand_vec_compare_cc (operands[0],
755 (define_expand "vec_any_<fpcmpcc:code>v2df"
756 [(match_operand:SI 0 "register_operand" "")
757 (fpcmpcc (match_operand:V2DF 1 "register_operand" "")
758 (match_operand:V2DF 2 "register_operand" ""))]
761 s390_expand_vec_compare_cc (operands[0],
770 ; Compare without generating CC
772 (define_expand "vec_cmp<intcmp:code><VI_HW:mode>"
773 [(set (match_operand:VI_HW 0 "register_operand" "=v")
774 (intcmp:VI_HW (match_operand:VI_HW 1 "register_operand" "v")
775 (match_operand:VI_HW 2 "register_operand" "v")))]
778 s390_expand_vec_compare (operands[0], <intcmp:CODE>, operands[1], operands[2]);
782 (define_expand "vec_cmp<fpcmp:code>v2df"
783 [(set (match_operand:V2DI 0 "register_operand" "=v")
784 (fpcmp:V2DI (match_operand:V2DF 1 "register_operand" "v")
785 (match_operand:V2DF 2 "register_operand" "v")))]
788 s390_expand_vec_compare (operands[0], <fpcmp:CODE>, operands[1], operands[2]);
793 ; Vector count leading zeros
802 ; The following two patterns allow mixed mode xor's as required for the intrinsics.
803 (define_insn "xor_av2df3"
804 [(set (match_operand:V2DF 0 "register_operand" "=v")
805 (xor:V2DF (subreg:V2DF (match_operand:V2DI 1 "register_operand" "v") 0)
806 (match_operand:V2DF 2 "register_operand" "v")))]
809 [(set_attr "op_type" "VRR")])
811 (define_insn "xor_cv2df3"
812 [(set (match_operand:V2DF 0 "register_operand" "=v")
813 (xor:V2DF (match_operand:V2DF 1 "register_operand" "v")
814 (subreg:V2DF (match_operand:V2DI 2 "register_operand" "v") 0)))]
817 [(set_attr "op_type" "VRR")])
820 ; Vector Galois field multiply sum
822 (define_insn "vec_gfmsum<mode>"
823 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
824 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
825 (match_operand:VI_HW_QHS 2 "register_operand" "v")]
828 "vgfm<bhfgq>\t%v0,%v1,%v2"
829 [(set_attr "op_type" "VRR")])
831 (define_insn "vec_gfmsum_128"
832 [(set (match_operand:V16QI 0 "register_operand" "=v")
833 (unspec:V16QI [(match_operand:V2DI 1 "register_operand" "v")
834 (match_operand:V2DI 2 "register_operand" "v")]
835 UNSPEC_VEC_GFMSUM_128))]
838 [(set_attr "op_type" "VRR")])
840 (define_insn "vec_gfmsum_accum<mode>"
841 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
842 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")
843 (match_operand:VI_HW_QHS 2 "register_operand" "v")
844 (match_operand:<vec_double> 3 "register_operand" "v")]
845 UNSPEC_VEC_GFMSUM_ACCUM))]
847 "vgfma<bhfgq>\t%v0,%v1,%v2,%v3"
848 [(set_attr "op_type" "VRR")])
850 (define_insn "vec_gfmsum_accum_128"
851 [(set (match_operand:V16QI 0 "register_operand" "=v")
852 (unspec:V16QI [(match_operand:V2DI 1 "register_operand" "v")
853 (match_operand:V2DI 2 "register_operand" "v")
854 (match_operand:V16QI 3 "register_operand" "v")]
855 UNSPEC_VEC_GFMSUM_ACCUM_128))]
857 "vgfmag\t%v0,%v1,%v2,%v3"
858 [(set_attr "op_type" "VRR")])
863 ; Vector load positive: vec_abs -> abs
864 ; Vector maximum vec_max -> smax, logical vec_max -> umax
865 ; Vector maximum vec_min -> smin, logical vec_min -> umin
868 ; Vector multiply and add high
870 ; vec_mladd -> vec_vmal
871 ; vmalb, vmalh, vmalf, vmalg
872 (define_insn "vec_vmal<mode>"
873 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
874 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
875 (match_operand:VI_HW_QHS 2 "register_operand" "v")
876 (match_operand:VI_HW_QHS 3 "register_operand" "v")]
879 "vmal<bhfgq><w>\t%v0,%v1,%v2,%v3"
880 [(set_attr "op_type" "VRR")])
882 ; vec_mhadd -> vec_vmah/vec_vmalh
884 ; vmahb; vmahh, vmahf, vmahg
885 (define_insn "vec_vmah<mode>"
886 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
887 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
888 (match_operand:VI_HW_QHS 2 "register_operand" "v")
889 (match_operand:VI_HW_QHS 3 "register_operand" "v")]
892 "vmah<bhfgq>\t%v0,%v1,%v2,%v3"
893 [(set_attr "op_type" "VRR")])
895 ; vmalhb; vmalhh, vmalhf, vmalhg
896 (define_insn "vec_vmalh<mode>"
897 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
898 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
899 (match_operand:VI_HW_QHS 2 "register_operand" "v")
900 (match_operand:VI_HW_QHS 3 "register_operand" "v")]
903 "vmalh<bhfgq>\t%v0,%v1,%v2,%v3"
904 [(set_attr "op_type" "VRR")])
906 ; vec_meadd -> vec_vmae/vec_vmale
908 ; vmaeb; vmaeh, vmaef, vmaeg
909 (define_insn "vec_vmae<mode>"
910 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
911 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")
912 (match_operand:VI_HW_QHS 2 "register_operand" "v")
913 (match_operand:<vec_double> 3 "register_operand" "v")]
916 "vmae<bhfgq>\t%v0,%v1,%v2,%v3"
917 [(set_attr "op_type" "VRR")])
919 ; vmaleb; vmaleh, vmalef, vmaleg
920 (define_insn "vec_vmale<mode>"
921 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
922 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")
923 (match_operand:VI_HW_QHS 2 "register_operand" "v")
924 (match_operand:<vec_double> 3 "register_operand" "v")]
927 "vmale<bhfgq>\t%v0,%v1,%v2,%v3"
928 [(set_attr "op_type" "VRR")])
930 ; vec_moadd -> vec_vmao/vec_vmalo
932 ; vmaob; vmaoh, vmaof, vmaog
933 (define_insn "vec_vmao<mode>"
934 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
935 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")
936 (match_operand:VI_HW_QHS 2 "register_operand" "v")
937 (match_operand:<vec_double> 3 "register_operand" "v")]
940 "vmao<bhfgq>\t%v0,%v1,%v2,%v3"
941 [(set_attr "op_type" "VRR")])
943 ; vmalob; vmaloh, vmalof, vmalog
944 (define_insn "vec_vmalo<mode>"
945 [(set (match_operand:<vec_double> 0 "register_operand" "=v")
946 (unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v")
947 (match_operand:VI_HW_QHS 2 "register_operand" "v")
948 (match_operand:<vec_double> 3 "register_operand" "v")]
951 "vmalo<bhfgq>\t%v0,%v1,%v2,%v3"
952 [(set_attr "op_type" "VRR")])
955 ; Vector multiply high
957 ; vec_mulh -> vec_smulh/vec_umulh
960 (define_insn "vec_smulh<mode>"
961 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
962 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
963 (match_operand:VI_HW_QHS 2 "register_operand" "v")]
964 UNSPEC_VEC_SMULT_HI))]
966 "vmh<bhfgq>\t%v0,%v1,%v2"
967 [(set_attr "op_type" "VRR")])
969 ; vmlhb, vmlhh, vmlhf
970 (define_insn "vec_umulh<mode>"
971 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
972 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
973 (match_operand:VI_HW_QHS 2 "register_operand" "v")]
974 UNSPEC_VEC_UMULT_HI))]
976 "vmlh<bhfgq>\t%v0,%v1,%v2"
977 [(set_attr "op_type" "VRR")])
980 ; Vector multiply low
982 ; vec_mule -> vec_widen_umult_even/vec_widen_smult_even
983 ; vec_mulo -> vec_widen_umult_odd/vec_widen_smult_odd
988 (define_insn "vec_nor<mode>3"
989 [(set (match_operand:VT_HW 0 "register_operand" "=v")
990 (not:VT_HW (ior:VT_HW (match_operand:VT_HW 1 "register_operand" "v")
991 (match_operand:VT_HW 2 "register_operand" "v"))))]
994 [(set_attr "op_type" "VRR")])
996 ; The following two patterns allow mixed mode and's as required for the intrinsics.
997 (define_insn "vec_nor_av2df3"
998 [(set (match_operand:V2DF 0 "register_operand" "=v")
999 (not:V2DF (ior:V2DF (subreg:V2DF (match_operand:V2DI 1 "register_operand" "v") 0)
1000 (match_operand:V2DF 2 "register_operand" "v"))))]
1003 [(set_attr "op_type" "VRR")])
1005 (define_insn "vec_nor_cv2df3"
1006 [(set (match_operand:V2DF 0 "register_operand" "=v")
1007 (not:V2DF (ior:V2DF (match_operand:V2DF 1 "register_operand" "v")
1008 (subreg:V2DF (match_operand:V2DI 2 "register_operand" "v") 0))))]
1011 [(set_attr "op_type" "VRR")])
1016 ; The following two patterns allow mixed mode or's as required for the intrinsics.
1017 (define_insn "ior_av2df3"
1018 [(set (match_operand:V2DF 0 "register_operand" "=v")
1019 (ior:V2DF (subreg:V2DF (match_operand:V2DI 1 "register_operand" "v") 0)
1020 (match_operand:V2DF 2 "register_operand" "v")))]
1023 [(set_attr "op_type" "VRR")])
1025 (define_insn "ior_cv2df3"
1026 [(set (match_operand:V2DF 0 "register_operand" "=v")
1027 (ior:V2DF (match_operand:V2DF 1 "register_operand" "v")
1028 (subreg:V2DF (match_operand:V2DI 2 "register_operand" "v") 0)))]
1031 [(set_attr "op_type" "VRR")])
1034 ; Vector population count vec_popcnt -> popcount
1035 ; Vector element rotate left logical vec_rl -> vrotl, vec_rli -> rot
1037 ; Vector element rotate and insert under mask
1039 ; verimb, verimh, verimf, verimg
1040 (define_insn "verim<mode>"
1041 [(set (match_operand:VI_HW 0 "register_operand" "=v")
1042 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "0")
1043 (match_operand:VI_HW 2 "register_operand" "v")
1044 (match_operand:VI_HW 3 "register_operand" "v")
1045 (match_operand:SI 4 "immediate_operand" "I")]
1046 UNSPEC_VEC_RL_MASK))]
1048 "verim<bhfgq>\t%v0,%v2,%v3,%b4"
1049 [(set_attr "op_type" "VRI")])
1054 (define_insn "vec_sll<VI_HW:mode><VI_HW_QHS:mode>"
1055 [(set (match_operand:VI_HW 0 "register_operand" "=v")
1056 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v")
1057 (match_operand:VI_HW_QHS 2 "register_operand" "v")]
1061 [(set_attr "op_type" "VRR")])
1064 ; Vector shift left by byte
1066 (define_insn "vec_slb<mode>"
1067 [(set (match_operand:V_HW 0 "register_operand" "=v")
1068 (unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v")
1069 (match_operand:<tointvec> 2 "register_operand" "v")]
1073 [(set_attr "op_type" "VRR")])
1076 ; Vector shift left double by byte
1078 (define_insn "vec_sld<mode>"
1079 [(set (match_operand:V_HW 0 "register_operand" "=v")
1080 (unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v")
1081 (match_operand:V_HW 2 "register_operand" "v")
1082 (match_operand:DI 3 "immediate_operand" "C")]
1085 "vsldb\t%v0,%v1,%v2,%b3"
1086 [(set_attr "op_type" "VRI")])
1088 (define_expand "vec_sldw<mode>"
1089 [(set (match_operand:V_HW 0 "register_operand" "")
1090 (unspec:V_HW [(match_operand:V_HW 1 "register_operand" "")
1091 (match_operand:V_HW 2 "register_operand" "")
1092 (match_operand:DI 3 "immediate_operand" "")]
1096 operands[3] = GEN_INT (INTVAL (operands[3]) << 2);
1099 ; Vector shift right arithmetic
1101 (define_insn "vec_sral<VI_HW:mode><VI_HW_QHS:mode>"
1102 [(set (match_operand:VI_HW 0 "register_operand" "=v")
1103 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v")
1104 (match_operand:VI_HW_QHS 2 "register_operand" "v")]
1108 [(set_attr "op_type" "VRR")])
1111 ; Vector shift right arithmetic by byte
1113 (define_insn "vec_srab<mode>"
1114 [(set (match_operand:V_HW 0 "register_operand" "=v")
1115 (unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v")
1116 (match_operand:<tointvec> 2 "register_operand" "v")]
1119 "vsrab\t%v0,%v1,%v2"
1120 [(set_attr "op_type" "VRR")])
1123 ; Vector shift right logical
1125 (define_insn "vec_srl<VI_HW:mode><VI_HW_QHS:mode>"
1126 [(set (match_operand:VI_HW 0 "register_operand" "=v")
1127 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v")
1128 (match_operand:VI_HW_QHS 2 "register_operand" "v")]
1132 [(set_attr "op_type" "VRR")])
1135 ; Vector shift right logical by byte
1137 ; Pattern definition in vector.md
1138 (define_expand "vec_srb<mode>"
1139 [(set (match_operand:V_HW 0 "register_operand" "")
1140 (unspec:V_HW [(match_operand:V_HW 1 "register_operand" "")
1141 (match_operand:<tointvec> 2 "register_operand" "")]
1148 (define_insn "vec_sub_u128"
1149 [(set (match_operand:V16QI 0 "register_operand" "=v")
1150 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1151 (match_operand:V16QI 2 "register_operand" "v")]
1152 UNSPEC_VEC_SUB_U128))]
1155 [(set_attr "op_type" "VRR")])
1158 ; Vector subtract compute borrow indication
1160 (define_insn "vec_subc<mode>"
1161 [(set (match_operand:VI_HW 0 "register_operand" "=v")
1162 (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v")
1163 (match_operand:VI_HW 2 "register_operand" "v")]
1166 "vscbi<bhfgq>\t%v0,%v1,%v2"
1167 [(set_attr "op_type" "VRR")])
1169 (define_insn "vec_subc_u128"
1170 [(set (match_operand:V16QI 0 "register_operand" "=v")
1171 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1172 (match_operand:V16QI 2 "register_operand" "v")]
1173 UNSPEC_VEC_SUBC_U128))]
1175 "vscbiq\t%v0,%v1,%v2"
1176 [(set_attr "op_type" "VRR")])
1179 ; Vector subtract with borrow indication
1181 (define_insn "vec_sube_u128"
1182 [(set (match_operand:V16QI 0 "register_operand" "=v")
1183 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1184 (match_operand:V16QI 2 "register_operand" "v")
1185 (match_operand:V16QI 3 "register_operand" "v")]
1186 UNSPEC_VEC_SUBE_U128))]
1188 "vsbiq\t%v0,%v1,%v2,%v3"
1189 [(set_attr "op_type" "VRR")])
1192 ; Vector subtract with borrow compute and borrow indication
1194 (define_insn "vec_subec_u128"
1195 [(set (match_operand:V16QI 0 "register_operand" "=v")
1196 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
1197 (match_operand:V16QI 2 "register_operand" "v")
1198 (match_operand:V16QI 3 "register_operand" "v")]
1199 UNSPEC_VEC_SUBEC_U128))]
1201 "vsbcbiq\t%v0,%v1,%v2,%v3"
1202 [(set_attr "op_type" "VRR")])
1207 ; Sum across DImode parts of the 1st operand and add the rightmost
1208 ; element of 2nd operand
1210 (define_expand "vec_sum2<mode>"
1211 [(set (match_operand:V2DI 0 "register_operand" "")
1212 (unspec:V2DI [(match_operand:VI_HW_HS 1 "register_operand" "")
1213 (match_operand:VI_HW_HS 2 "register_operand" "")]
1218 (define_insn "vec_sum_u128<mode>"
1219 [(set (match_operand:V2DI 0 "register_operand" "=v")
1220 (unspec:V2DI [(match_operand:VI_HW_SD 1 "register_operand" "v")
1221 (match_operand:VI_HW_SD 2 "register_operand" "v")]
1224 "vsumq<bhfgq>\t%v0,%v1,%v2"
1225 [(set_attr "op_type" "VRR")])
1228 (define_expand "vec_sum4<mode>"
1229 [(set (match_operand:V4SI 0 "register_operand" "")
1230 (unspec:V4SI [(match_operand:VI_HW_QH 1 "register_operand" "")
1231 (match_operand:VI_HW_QH 2 "register_operand" "")]
1236 ; Vector test under mask
1238 (define_expand "vec_test_mask_int<mode>"
1239 [(set (reg:CCRAW CC_REGNUM)
1240 (unspec:CCRAW [(match_operand:V_HW 1 "register_operand" "")
1241 (match_operand:<tointvec> 2 "register_operand" "")]
1242 UNSPEC_VEC_TEST_MASK))
1243 (set (match_operand:SI 0 "register_operand" "")
1244 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1247 (define_insn "*vec_test_mask<mode>"
1248 [(set (reg:CCRAW CC_REGNUM)
1249 (unspec:CCRAW [(match_operand:V_HW 0 "register_operand" "v")
1250 (match_operand:<tointvec> 1 "register_operand" "v")]
1251 UNSPEC_VEC_TEST_MASK))]
1254 [(set_attr "op_type" "VRR")])
1257 ; Vector find any element equal
1259 ; vfaeb, vfaeh, vfaef
1260 ; vfaezb, vfaezh, vfaezf
1261 (define_insn "vfae<mode>"
1262 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1263 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1264 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1265 (match_operand:SI 3 "immediate_operand" "C")]
1269 unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
1271 if (flags & VSTRING_FLAG_ZS)
1273 flags &= ~VSTRING_FLAG_ZS;
1274 operands[3] = GEN_INT (flags);
1275 return "vfaez<bhfgq>\t%v0,%v1,%v2,%b3";
1277 return "vfae<bhfgq>\t%v0,%v1,%v2,%b3";
1279 [(set_attr "op_type" "VRR")])
1281 ; vfaebs, vfaehs, vfaefs
1282 ; vfaezbs, vfaezhs, vfaezfs
1283 (define_insn "*vfaes<mode>"
1284 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1285 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1286 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1287 (match_operand:SI 3 "immediate_operand" "C")]
1289 (set (reg:CCRAW CC_REGNUM)
1290 (unspec:CCRAW [(match_dup 1)
1293 UNSPEC_VEC_VFAECC))]
1296 unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
1298 if (flags & VSTRING_FLAG_ZS)
1300 flags &= ~VSTRING_FLAG_ZS;
1301 operands[3] = GEN_INT (flags);
1302 return "vfaez<bhfgq>s\t%v0,%v1,%v2,%b3";
1304 return "vfae<bhfgq>s\t%v0,%v1,%v2,%b3";
1306 [(set_attr "op_type" "VRR")])
1308 (define_expand "vfaez<mode>"
1309 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1310 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1311 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1312 (match_operand:SI 3 "immediate_operand" "C")]
1316 operands[3] = GEN_INT (INTVAL (operands[3]) | VSTRING_FLAG_ZS);
1319 (define_expand "vfaes<mode>"
1321 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1322 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1323 (match_operand:VI_HW_QHS 2 "register_operand" "")
1324 (match_operand:SI 3 "immediate_operand" "C")]
1326 (set (reg:CCRAW CC_REGNUM)
1327 (unspec:CCRAW [(match_dup 1)
1330 UNSPEC_VEC_VFAECC))])
1331 (set (match_operand:SI 4 "memory_operand" "")
1332 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1335 operands[3] = GEN_INT (INTVAL (operands[3]) | VSTRING_FLAG_CS);
1338 (define_expand "vfaezs<mode>"
1340 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1341 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1342 (match_operand:VI_HW_QHS 2 "register_operand" "")
1343 (match_operand:SI 3 "immediate_operand" "C")]
1345 (set (reg:CCRAW CC_REGNUM)
1346 (unspec:CCRAW [(match_dup 1)
1349 UNSPEC_VEC_VFAECC))])
1350 (set (match_operand:SI 4 "memory_operand" "")
1351 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1354 operands[3] = GEN_INT (INTVAL (operands[3]) | VSTRING_FLAG_CS | VSTRING_FLAG_ZS);
1358 ; Vector find element equal
1360 ; vfeebs, vfeehs, vfeefs
1361 ; vfeezbs, vfeezhs, vfeezfs
1362 (define_insn "*vfees<mode>"
1363 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1364 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1365 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1366 (match_operand:QI 3 "immediate_operand" "C")]
1368 (set (reg:CCRAW CC_REGNUM)
1369 (unspec:CCRAW [(match_dup 1)
1372 UNSPEC_VEC_VFEECC))]
1375 unsigned HOST_WIDE_INT flags = INTVAL (operands[3]);
1377 gcc_assert (!(flags & ~(VSTRING_FLAG_ZS | VSTRING_FLAG_CS)));
1378 flags &= ~VSTRING_FLAG_CS;
1380 if (flags == VSTRING_FLAG_ZS)
1381 return "vfeez<bhfgq>s\t%v0,%v1,%v2";
1382 return "vfee<bhfgq>s\t%v0,%v1,%v2,%b3";
1384 [(set_attr "op_type" "VRR")])
1386 ; vfeeb, vfeeh, vfeef
1387 (define_insn "vfee<mode>"
1388 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1389 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1390 (match_operand:VI_HW_QHS 2 "register_operand" "")
1394 "vfee<bhfgq>\t%v0,%v1,%v2,0"
1395 [(set_attr "op_type" "VRR")])
1397 ; vfeezb, vfeezh, vfeezf
1398 (define_insn "vfeez<mode>"
1399 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1400 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1401 (match_operand:VI_HW_QHS 2 "register_operand" "")
1402 (const_int VSTRING_FLAG_ZS)]
1405 "vfeez<bhfgq>s\t%v0,%v1,%v2,2"
1406 [(set_attr "op_type" "VRR")])
1408 (define_expand "vfees<mode>"
1410 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1411 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1412 (match_operand:VI_HW_QHS 2 "register_operand" "")
1413 (const_int VSTRING_FLAG_CS)]
1415 (set (reg:CCRAW CC_REGNUM)
1416 (unspec:CCRAW [(match_dup 1)
1418 (const_int VSTRING_FLAG_CS)]
1419 UNSPEC_VEC_VFEECC))])
1420 (set (match_operand:SI 3 "memory_operand" "")
1421 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1424 (define_expand "vfeezs<mode>"
1426 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1427 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1428 (match_operand:VI_HW_QHS 2 "register_operand" "")
1431 (set (reg:CCRAW CC_REGNUM)
1432 (unspec:CCRAW [(match_dup 1)
1435 UNSPEC_VEC_VFEECC))])
1436 (set (match_operand:SI 3 "memory_operand" "")
1437 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1440 operands[4] = GEN_INT (VSTRING_FLAG_ZS | VSTRING_FLAG_CS);
1443 ; Vector find element not equal
1445 ; vfeneb, vfeneh, vfenef
1446 (define_insn "vfene<mode>"
1447 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1448 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1449 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1453 "vfene<bhfgq>\t%v0,%v1,%v2,0"
1454 [(set_attr "op_type" "VRR")])
1456 ; vec_vfenes can be found in vector.md since it is used for strlen
1458 ; vfenezb, vfenezh, vfenezf
1459 (define_insn "vfenez<mode>"
1460 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1461 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1462 (match_operand:VI_HW_QHS 2 "register_operand" "")
1463 (const_int VSTRING_FLAG_ZS)]
1466 "vfenez<bhfgq>\t%v0,%v1,%v2"
1467 [(set_attr "op_type" "VRR")])
1469 (define_expand "vfenes<mode>"
1471 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1472 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1473 (match_operand:VI_HW_QHS 2 "register_operand" "")
1474 (const_int VSTRING_FLAG_CS)]
1476 (set (reg:CCRAW CC_REGNUM)
1477 (unspec:CCRAW [(match_dup 1)
1479 (const_int VSTRING_FLAG_CS)]
1480 UNSPEC_VEC_VFENECC))])
1481 (set (match_operand:SI 3 "memory_operand" "")
1482 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1485 (define_expand "vfenezs<mode>"
1487 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1488 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1489 (match_operand:VI_HW_QHS 2 "register_operand" "")
1492 (set (reg:CCRAW CC_REGNUM)
1493 (unspec:CCRAW [(match_dup 1)
1496 UNSPEC_VEC_VFENECC))])
1497 (set (match_operand:SI 3 "memory_operand" "")
1498 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1501 operands[4] = GEN_INT (VSTRING_FLAG_ZS | VSTRING_FLAG_CS);
1504 ; Vector isolate string
1506 ; vistrb, vistrh, vistrf
1507 (define_insn "vistr<mode>"
1508 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1509 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")]
1512 "vistr<bhfgq>\t%v0,%v1"
1513 [(set_attr "op_type" "VRR")])
1515 ; vistrbs, vistrhs, vistrfs
1516 (define_insn "*vistrs<mode>"
1517 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1518 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")]
1520 (set (reg:CCRAW CC_REGNUM)
1521 (unspec:CCRAW [(match_dup 1)] UNSPEC_VEC_VISTRCC))]
1523 "vistr<bhfgq>s\t%v0,%v1"
1524 [(set_attr "op_type" "VRR")])
1526 (define_expand "vistrs<mode>"
1528 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1529 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")]
1531 (set (reg:CCRAW CC_REGNUM)
1532 (unspec:CCRAW [(match_dup 1)]
1533 UNSPEC_VEC_VISTRCC))])
1534 (set (match_operand:SI 2 "memory_operand" "")
1535 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1539 ; Vector compare range
1541 ; vstrcb, vstrch, vstrcf
1542 ; vstrczb, vstrczh, vstrczf
1543 (define_insn "vstrc<mode>"
1544 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1545 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1546 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1547 (match_operand:VI_HW_QHS 3 "register_operand" "v")
1548 (match_operand:SI 4 "immediate_operand" "C")]
1552 unsigned HOST_WIDE_INT flags = INTVAL (operands[4]);
1554 if (flags & VSTRING_FLAG_ZS)
1556 flags &= ~VSTRING_FLAG_ZS;
1557 operands[4] = GEN_INT (flags);
1558 return "vstrcz<bhfgq>\t%v0,%v1,%v2,%v3,%b4";
1560 return "vstrc<bhfgq>\t%v0,%v1,%v2,%v3,%b4";
1562 [(set_attr "op_type" "VRR")])
1564 ; vstrcbs, vstrchs, vstrcfs
1565 ; vstrczbs, vstrczhs, vstrczfs
1566 (define_insn "*vstrcs<mode>"
1567 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1568 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1569 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1570 (match_operand:VI_HW_QHS 3 "register_operand" "v")
1571 (match_operand:SI 4 "immediate_operand" "C")]
1573 (set (reg:CCRAW CC_REGNUM)
1574 (unspec:CCRAW [(match_dup 1)
1578 UNSPEC_VEC_VSTRCCC))]
1581 unsigned HOST_WIDE_INT flags = INTVAL (operands[4]);
1583 if (flags & VSTRING_FLAG_ZS)
1585 flags &= ~VSTRING_FLAG_ZS;
1586 operands[4] = GEN_INT (flags);
1587 return "vstrcz<bhfgq>s\t%v0,%v1,%v2,%v3,%b4";
1589 return "vstrc<bhfgq>s\t%v0,%v1,%v2,%v3,%b4";
1591 [(set_attr "op_type" "VRR")])
1593 (define_expand "vstrcz<mode>"
1594 [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v")
1595 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")
1596 (match_operand:VI_HW_QHS 2 "register_operand" "v")
1597 (match_operand:VI_HW_QHS 3 "register_operand" "v")
1598 (match_operand:SI 4 "immediate_operand" "C")]
1602 operands[4] = GEN_INT (INTVAL (operands[4]) | VSTRING_FLAG_ZS);
1605 (define_expand "vstrcs<mode>"
1607 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1608 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1609 (match_operand:VI_HW_QHS 2 "register_operand" "")
1610 (match_operand:VI_HW_QHS 3 "register_operand" "")
1611 (match_operand:SI 4 "immediate_operand" "C")]
1613 (set (reg:CCRAW CC_REGNUM)
1614 (unspec:CCRAW [(match_dup 1)
1618 UNSPEC_VEC_VSTRCCC))])
1619 (set (match_operand:SI 5 "memory_operand" "")
1620 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1623 operands[4] = GEN_INT (INTVAL (operands[4]) | VSTRING_FLAG_CS);
1626 (define_expand "vstrczs<mode>"
1628 [(set (match_operand:VI_HW_QHS 0 "register_operand" "")
1629 (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")
1630 (match_operand:VI_HW_QHS 2 "register_operand" "")
1631 (match_operand:VI_HW_QHS 3 "register_operand" "")
1632 (match_operand:SI 4 "immediate_operand" "C")]
1634 (set (reg:CCRAW CC_REGNUM)
1635 (unspec:CCRAW [(match_dup 1)
1639 UNSPEC_VEC_VSTRCCC))])
1640 (set (match_operand:SI 5 "memory_operand" "")
1641 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1644 operands[4] = GEN_INT (INTVAL (operands[4]) | VSTRING_FLAG_CS | VSTRING_FLAG_ZS);
1648 ; Signed V2DI -> V2DF conversion - inexact exception disabled
1649 (define_insn "vec_di_to_df_s64"
1650 [(set (match_operand:V2DF 0 "register_operand" "=v")
1651 (unspec:V2DF [(match_operand:V2DI 1 "register_operand" "v")
1652 (match_operand:QI 2 "immediate_operand" "C")]
1655 "vcdgb\t%v0,%v1,4,%b2"
1656 [(set_attr "op_type" "VRR")])
1658 ; The result needs to be multiplied with 2**-op2
1659 (define_expand "vec_ctd_s64"
1660 [(set (match_operand:V2DF 0 "register_operand" "")
1661 (unspec:V2DF [(match_operand:V2DI 1 "register_operand" "")
1662 (const_int 0)] ; According to current BFP rounding mode
1664 (use (match_operand:QI 2 "immediate_operand" ""))
1665 (set (match_dup 0) (mult:V2DF (match_dup 0) (match_dup 3)))]
1671 real_2expN (&f, -INTVAL (operands[2]), DFmode);
1672 c = CONST_DOUBLE_FROM_REAL_VALUE (f, DFmode);
1674 operands[3] = gen_rtx_CONST_VECTOR (V2DFmode, gen_rtvec (2, c, c));
1675 operands[3] = force_reg (V2DFmode, operands[3]);
1678 ; Unsigned V2DI -> V2DF conversion - inexact exception disabled
1679 (define_insn "vec_di_to_df_u64"
1680 [(set (match_operand:V2DF 0 "register_operand" "=v")
1681 (unspec:V2DF [(match_operand:V2DI 1 "register_operand" "v")
1682 (match_operand:QI 2 "immediate_operand" "C")]
1683 UNSPEC_VEC_VCDLGB))]
1685 "vcdlgb\t%v0,%v1,4,%b2"
1686 [(set_attr "op_type" "VRR")])
1688 ; The result needs to be multiplied with 2**-op2
1689 (define_expand "vec_ctd_u64"
1690 [(set (match_operand:V2DF 0 "register_operand" "")
1691 (unspec:V2DF [(match_operand:V2DI 1 "register_operand" "")
1692 (const_int 0)] ; According to current BFP rounding mode
1694 (use (match_operand:QI 2 "immediate_operand" ""))
1695 (set (match_dup 0) (mult:V2DF (match_dup 0) (match_dup 3)))]
1701 real_2expN (&f, -INTVAL (operands[2]), DFmode);
1702 c = CONST_DOUBLE_FROM_REAL_VALUE (f, DFmode);
1704 operands[3] = gen_rtx_CONST_VECTOR (V2DFmode, gen_rtvec (2, c, c));
1705 operands[3] = force_reg (V2DFmode, operands[3]);
1709 ; Signed V2DF -> V2DI conversion - inexact exception disabled
1710 (define_insn "vec_df_to_di_s64"
1711 [(set (match_operand:V2DI 0 "register_operand" "=v")
1712 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "v")
1713 (match_operand:QI 2 "immediate_operand" "C")]
1716 "vcgdb\t%v0,%v1,4,%b2"
1717 [(set_attr "op_type" "VRR")])
1719 ; The input needs to be multiplied with 2**op2
1720 (define_expand "vec_ctsl"
1721 [(use (match_operand:QI 2 "immediate_operand" ""))
1722 (set (match_dup 4) (mult:V2DF (match_operand:V2DF 1 "register_operand" "")
1724 (set (match_operand:V2DI 0 "register_operand" "")
1725 (unspec:V2DI [(match_dup 4) (const_int 0)] ; According to current BFP rounding mode
1732 real_2expN (&f, INTVAL (operands[2]), DFmode);
1733 c = CONST_DOUBLE_FROM_REAL_VALUE (f, DFmode);
1735 operands[3] = gen_rtx_CONST_VECTOR (V2DFmode, gen_rtvec (2, c, c));
1736 operands[3] = force_reg (V2DFmode, operands[3]);
1737 operands[4] = gen_reg_rtx (V2DFmode);
1740 ; Unsigned V2DF -> V2DI conversion - inexact exception disabled
1741 (define_insn "vec_df_to_di_u64"
1742 [(set (match_operand:V2DI 0 "register_operand" "=v")
1743 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "v")
1744 (match_operand:QI 2 "immediate_operand" "C")]
1745 UNSPEC_VEC_VCLGDB))]
1747 "vclgdb\t%v0,%v1,4,%b2"
1748 [(set_attr "op_type" "VRR")])
1750 ; The input needs to be multiplied with 2**op2
1751 (define_expand "vec_ctul"
1752 [(use (match_operand:QI 2 "immediate_operand" ""))
1753 (set (match_dup 4) (mult:V2DF (match_operand:V2DF 1 "register_operand" "")
1755 (set (match_operand:V2DI 0 "register_operand" "")
1756 (unspec:V2DI [(match_dup 4) (const_int 0)] ; According to current BFP rounding mode
1757 UNSPEC_VEC_VCLGDB))]
1763 real_2expN (&f, INTVAL (operands[2]), DFmode);
1764 c = CONST_DOUBLE_FROM_REAL_VALUE (f, DFmode);
1766 operands[3] = gen_rtx_CONST_VECTOR (V2DFmode, gen_rtvec (2, c, c));
1767 operands[3] = force_reg (V2DFmode, operands[3]);
1768 operands[4] = gen_reg_rtx (V2DFmode);
1771 ; Vector load fp integer - IEEE inexact exception is suppressed
1772 (define_insn "vfidb"
1773 [(set (match_operand:V2DI 0 "register_operand" "=v")
1774 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "v")
1775 (match_operand:QI 2 "immediate_operand" "C")
1776 (match_operand:QI 3 "immediate_operand" "C")]
1779 "vfidb\t%v0,%v1,%b2,%b3"
1780 [(set_attr "op_type" "VRR")])
1782 (define_expand "vec_ceil"
1783 [(set (match_operand:V2DI 0 "register_operand" "")
1784 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "")
1785 (const_int VEC_RND_TO_INF)]
1789 (define_expand "vec_floor"
1790 [(set (match_operand:V2DI 0 "register_operand" "")
1791 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "")
1792 (const_int VEC_RND_TO_MINF)]
1796 (define_expand "vec_trunc"
1797 [(set (match_operand:V2DI 0 "register_operand" "")
1798 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "")
1799 (const_int VEC_RND_TO_ZERO)]
1803 (define_expand "vec_roundc"
1804 [(set (match_operand:V2DI 0 "register_operand" "")
1805 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "")
1806 (const_int VEC_RND_CURRENT)]
1810 (define_expand "vec_round"
1811 [(set (match_operand:V2DI 0 "register_operand" "")
1812 (unspec:V2DI [(match_operand:V2DF 1 "register_operand" "")
1813 (const_int VEC_RND_NEAREST_TO_EVEN)]
1818 ; Vector load lengthened - V4SF -> V2DF
1820 (define_insn "*vldeb"
1821 [(set (match_operand:V2DF 0 "register_operand" "=v")
1822 (unspec:V2DF [(match_operand:V4SF 1 "register_operand" "v")]
1826 [(set_attr "op_type" "VRR")])
1828 (define_expand "vec_ld2f"
1829 [; Initialize a vector to all zeroes. FIXME: This should not be
1830 ; necessary since all elements of the vector will be set anyway.
1831 ; This is just to make it explicit to the data flow framework.
1832 (set (match_dup 2) (match_dup 3))
1833 (set (match_dup 2) (unspec:V4SF [(match_operand:SF 1 "memory_operand" "")
1837 (set (match_dup 2) (unspec:V4SF [(match_dup 4)
1841 (set (match_operand:V2DF 0 "register_operand" "")
1842 (unspec:V2DF [(match_dup 2)] UNSPEC_VEC_VLDEB))]
1845 operands[2] = gen_reg_rtx (V4SFmode);
1846 operands[3] = CONST0_RTX (V4SFmode);
1847 operands[4] = adjust_address (operands[1], SFmode, 4);
1851 ; Vector load rounded - V2DF -> V4SF
1853 (define_insn "*vledb"
1854 [(set (match_operand:V4SF 0 "register_operand" "=v")
1855 (unspec:V4SF [(match_operand:V2DF 1 "register_operand" "v")]
1858 "vledb\t%v0,%v1,0,0"
1859 [(set_attr "op_type" "VRR")])
1861 (define_expand "vec_st2f"
1863 (unspec:V4SF [(match_operand:V2DF 0 "register_operand" "")]
1865 (set (match_operand:SF 1 "memory_operand" "")
1866 (unspec:SF [(match_dup 2) (const_int 0)] UNSPEC_VEC_EXTRACT))
1868 (unspec:SF [(match_dup 2) (const_int 2)] UNSPEC_VEC_EXTRACT))]
1871 operands[2] = gen_reg_rtx (V4SFmode);
1872 operands[3] = adjust_address (operands[1], SFmode, 4);
1876 ; Vector load negated fp
1878 (define_expand "vec_nabs"
1879 [(set (match_operand:V2DF 0 "register_operand" "")
1880 (neg:V2DF (abs:V2DF (match_operand:V2DF 1 "register_operand" ""))))]
1883 ; Vector square root fp vec_sqrt -> sqrt rtx standard name
1885 ; Vector FP test data class immediate
1887 (define_insn "*vftcidb"
1888 [(set (match_operand:V2DF 0 "register_operand" "=v")
1889 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "v")
1890 (match_operand:SI 2 "immediate_operand" "J")]
1891 UNSPEC_VEC_VFTCIDB))
1892 (set (reg:CCRAW CC_REGNUM)
1893 (unspec:CCRAW [(match_dup 1) (match_dup 2)] UNSPEC_VEC_VFTCIDBCC))]
1895 "vftcidb\t%v0,%v1,%x2"
1896 [(set_attr "op_type" "VRR")])
1898 (define_insn "*vftcidb_cconly"
1899 [(set (reg:CCRAW CC_REGNUM)
1900 (unspec:CCRAW [(match_operand:V2DF 1 "register_operand" "v")
1901 (match_operand:SI 2 "immediate_operand" "J")]
1902 UNSPEC_VEC_VFTCIDBCC))
1903 (clobber (match_scratch:V2DI 0 "=v"))]
1905 "vftcidb\t%v0,%v1,%x2"
1906 [(set_attr "op_type" "VRR")])
1908 (define_expand "vftcidb"
1910 [(set (match_operand:V2DF 0 "register_operand" "")
1911 (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "")
1912 (match_operand:SI 2 "immediate_operand" "")]
1913 UNSPEC_VEC_VFTCIDB))
1914 (set (reg:CCRAW CC_REGNUM)
1915 (unspec:CCRAW [(match_dup 1) (match_dup 2)] UNSPEC_VEC_VFTCIDBCC))])
1916 (set (match_operand:SI 3 "memory_operand" "")
1917 (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
1924 ; All comparisons which produce a CC need fully populated (VI_HW)
1925 ; vector arguments. Otherwise the any/all CCs would be just bogus.
1927 (define_insn "*vec_cmp<VICMP:insn_cmp><VI_HW:mode>_cconly"
1928 [(set (reg:VICMP CC_REGNUM)
1929 (compare:VICMP (match_operand:VI_HW 0 "register_operand" "v")
1930 (match_operand:VI_HW 1 "register_operand" "v")))
1931 (clobber (match_scratch:VI_HW 2 "=v"))]
1933 "vc<VICMP:insn_cmp><VI_HW:bhfgq>s\t%v2,%v0,%v1"
1934 [(set_attr "op_type" "VRR")])
1936 ; FIXME: The following 2x3 definitions should be merged into 2 with
1937 ; VICMP like above but I could not find a way to set the comparison
1938 ; operator (eq) depending on the mode CCVEQ (mode_iterator). Or the
1939 ; other way around - setting the mode depending on the code
1941 (define_expand "vec_cmpeq<VI_HW:mode>_cc"
1943 [(set (reg:CCVEQ CC_REGNUM)
1944 (compare:CCVEQ (match_operand:VI_HW 1 "register_operand" "v")
1945 (match_operand:VI_HW 2 "register_operand" "v")))
1946 (set (match_operand:VI_HW 0 "register_operand" "=v")
1947 (eq:VI_HW (match_dup 1) (match_dup 2)))])
1948 (set (match_operand:SI 3 "memory_operand" "")
1949 (unspec:SI [(reg:CCVEQ CC_REGNUM)] UNSPEC_CC_TO_INT))]
1952 (define_expand "vec_cmph<VI_HW:mode>_cc"
1954 [(set (reg:CCVH CC_REGNUM)
1955 (compare:CCVH (match_operand:VI_HW 1 "register_operand" "v")
1956 (match_operand:VI_HW 2 "register_operand" "v")))
1957 (set (match_operand:VI_HW 0 "register_operand" "=v")
1958 (gt:VI_HW (match_dup 1) (match_dup 2)))])
1959 (set (match_operand:SI 3 "memory_operand" "")
1960 (unspec:SI [(reg:CCVH CC_REGNUM)] UNSPEC_CC_TO_INT))]
1963 (define_expand "vec_cmphl<VI_HW:mode>_cc"
1965 [(set (reg:CCVHU CC_REGNUM)
1966 (compare:CCVHU (match_operand:VI_HW 1 "register_operand" "v")
1967 (match_operand:VI_HW 2 "register_operand" "v")))
1968 (set (match_operand:VI_HW 0 "register_operand" "=v")
1969 (gtu:VI_HW (match_dup 1) (match_dup 2)))])
1970 (set (match_operand:SI 3 "memory_operand" "")
1971 (unspec:SI [(reg:CCVHU CC_REGNUM)] UNSPEC_CC_TO_INT))]
1975 (define_insn "*vec_cmpeq<VI_HW:mode>_cc"
1976 [(set (reg:CCVEQ CC_REGNUM)
1977 (compare:CCVEQ (match_operand:VI_HW 0 "register_operand" "v")
1978 (match_operand:VI_HW 1 "register_operand" "v")))
1979 (set (match_operand:VI_HW 2 "register_operand" "=v")
1980 (eq:VI_HW (match_dup 0) (match_dup 1)))]
1982 "vceq<VI_HW:bhfgq>s\t%v2,%v0,%v1"
1983 [(set_attr "op_type" "VRR")])
1985 (define_insn "*vec_cmph<VI_HW:mode>_cc"
1986 [(set (reg:CCVH CC_REGNUM)
1987 (compare:CCVH (match_operand:VI_HW 0 "register_operand" "v")
1988 (match_operand:VI_HW 1 "register_operand" "v")))
1989 (set (match_operand:VI_HW 2 "register_operand" "=v")
1990 (gt:VI_HW (match_dup 0) (match_dup 1)))]
1992 "vch<VI_HW:bhfgq>s\t%v2,%v0,%v1"
1993 [(set_attr "op_type" "VRR")])
1995 (define_insn "*vec_cmphl<VI_HW:mode>_cc"
1996 [(set (reg:CCVHU CC_REGNUM)
1997 (compare:CCVHU (match_operand:VI_HW 0 "register_operand" "v")
1998 (match_operand:VI_HW 1 "register_operand" "v")))
1999 (set (match_operand:VI_HW 2 "register_operand" "=v")
2000 (gtu:VI_HW (match_dup 0) (match_dup 1)))]
2002 "vchl<VI_HW:bhfgq>s\t%v2,%v0,%v1"
2003 [(set_attr "op_type" "VRR")])
2006 ;; Floating point comparesg
2009 (define_insn "*vec_cmp<insn_cmp>v2df_cconly"
2010 [(set (reg:VFCMP CC_REGNUM)
2011 (compare:VFCMP (match_operand:V2DF 0 "register_operand" "v")
2012 (match_operand:V2DF 1 "register_operand" "v")))
2013 (clobber (match_scratch:V2DI 2 "=v"))]
2015 "vfc<asm_fcmp>dbs\t%v2,%v0,%v1"
2016 [(set_attr "op_type" "VRR")])
2018 ; FIXME: Merge the following 2x3 patterns with VFCMP
2019 (define_expand "vec_cmpeqv2df_cc"
2021 [(set (reg:CCVEQ CC_REGNUM)
2022 (compare:CCVEQ (match_operand:V2DF 1 "register_operand" "v")
2023 (match_operand:V2DF 2 "register_operand" "v")))
2024 (set (match_operand:V2DI 0 "register_operand" "=v")
2025 (eq:V2DI (match_dup 1) (match_dup 2)))])
2026 (set (match_operand:SI 3 "memory_operand" "")
2027 (unspec:SI [(reg:CCVEQ CC_REGNUM)] UNSPEC_CC_TO_INT))]
2030 (define_expand "vec_cmphv2df_cc"
2032 [(set (reg:CCVH CC_REGNUM)
2033 (compare:CCVH (match_operand:V2DF 1 "register_operand" "v")
2034 (match_operand:V2DF 2 "register_operand" "v")))
2035 (set (match_operand:V2DI 0 "register_operand" "=v")
2036 (gt:V2DI (match_dup 1) (match_dup 2)))])
2037 (set (match_operand:SI 3 "memory_operand" "")
2038 (unspec:SI [(reg:CCVH CC_REGNUM)] UNSPEC_CC_TO_INT))]
2041 (define_expand "vec_cmphev2df_cc"
2043 [(set (reg:CCVFHE CC_REGNUM)
2044 (compare:CCVFHE (match_operand:V2DF 1 "register_operand" "v")
2045 (match_operand:V2DF 2 "register_operand" "v")))
2046 (set (match_operand:V2DI 0 "register_operand" "=v")
2047 (ge:V2DI (match_dup 1) (match_dup 2)))])
2048 (set (match_operand:SI 3 "memory_operand" "")
2049 (unspec:SI [(reg:CCVFHE CC_REGNUM)] UNSPEC_CC_TO_INT))]
2053 (define_insn "*vec_cmpeqv2df_cc"
2054 [(set (reg:CCVEQ CC_REGNUM)
2055 (compare:CCVEQ (match_operand:V2DF 0 "register_operand" "v")
2056 (match_operand:V2DF 1 "register_operand" "v")))
2057 (set (match_operand:V2DI 2 "register_operand" "=v")
2058 (eq:V2DI (match_dup 0) (match_dup 1)))]
2060 "vfcedbs\t%v2,%v0,%v1"
2061 [(set_attr "op_type" "VRR")])
2063 (define_insn "*vec_cmphv2df_cc"
2064 [(set (reg:CCVH CC_REGNUM)
2065 (compare:CCVH (match_operand:V2DF 0 "register_operand" "v")
2066 (match_operand:V2DF 1 "register_operand" "v")))
2067 (set (match_operand:V2DI 2 "register_operand" "=v")
2068 (gt:V2DI (match_dup 0) (match_dup 1)))]
2070 "vfchdbs\t%v2,%v0,%v1"
2071 [(set_attr "op_type" "VRR")])
2073 (define_insn "*vec_cmphev2df_cc"
2074 [(set (reg:CCVFHE CC_REGNUM)
2075 (compare:CCVFHE (match_operand:V2DF 0 "register_operand" "v")
2076 (match_operand:V2DF 1 "register_operand" "v")))
2077 (set (match_operand:V2DI 2 "register_operand" "=v")
2078 (ge:V2DI (match_dup 0) (match_dup 1)))]
2080 "vfchedbs\t%v2,%v0,%v1"
2081 [(set_attr "op_type" "VRR")])