1 ;; ARM NEON coprocessor Machine Description
2 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012
3 ;; Free Software Foundation, Inc.
4 ;; Written by CodeSourcery.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify it
9 ;; under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful, but
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;; General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;; Enumerators for unspecs.
23 (define_c_enum "unspec" [
25 UNSPEC_ASHIFT_UNSIGNED
147 UNSPEC_MISALIGNED_ACCESS
153 ;; Attribute used to permit string comparisons against <VQH_mnem> in
154 ;; neon_type attribute definitions.
155 (define_attr "vqh_mnem" "vadd,vmin,vmax" (const_string "vadd"))
157 (define_insn "*neon_mov<mode>"
158 [(set (match_operand:VDX 0 "nonimmediate_operand"
159 "=w,Uv,w, w, ?r,?w,?r,?r, ?Us")
160 (match_operand:VDX 1 "general_operand"
161 " w,w, Dn,Uvi, w, r, r, Usi,r"))]
163 && (register_operand (operands[0], <MODE>mode)
164 || register_operand (operands[1], <MODE>mode))"
166 if (which_alternative == 2)
169 static char templ[40];
171 is_valid = neon_immediate_valid_for_move (operands[1], <MODE>mode,
172 &operands[1], &width);
174 gcc_assert (is_valid != 0);
177 return "vmov.f32\t%P0, %1 @ <mode>";
179 sprintf (templ, "vmov.i%d\t%%P0, %%x1 @ <mode>", width);
184 /* FIXME: If the memory layout is changed in big-endian mode, output_move_vfp
185 below must be changed to output_move_neon (which will use the
186 element/structure loads/stores), and the constraint changed to 'Um' instead
189 switch (which_alternative)
191 case 0: return "vmov\t%P0, %P1 @ <mode>";
192 case 1: case 3: return output_move_vfp (operands);
193 case 2: gcc_unreachable ();
194 case 4: return "vmov\t%Q0, %R0, %P1 @ <mode>";
195 case 5: return "vmov\t%P0, %Q1, %R1 @ <mode>";
196 default: return output_move_double (operands, true, NULL);
199 [(set_attr "neon_type" "neon_int_1,*,neon_vmov,*,neon_mrrc,neon_mcr_2_mcrr,*,*,*")
200 (set_attr "type" "*,f_stored,*,f_loadd,*,*,alu,load2,store2")
201 (set_attr "insn" "*,*,*,*,*,*,mov,*,*")
202 (set_attr "length" "4,4,4,4,4,4,8,8,8")
203 (set_attr "pool_range" "*,*,*,1020,*,*,*,1020,*")
204 (set_attr "neg_pool_range" "*,*,*,1004,*,*,*,1004,*")])
206 (define_insn "*neon_mov<mode>"
207 [(set (match_operand:VQXMOV 0 "nonimmediate_operand"
208 "=w,Un,w, w, ?r,?w,?r,?r, ?Us")
209 (match_operand:VQXMOV 1 "general_operand"
210 " w,w, Dn,Uni, w, r, r, Usi, r"))]
212 && (register_operand (operands[0], <MODE>mode)
213 || register_operand (operands[1], <MODE>mode))"
215 if (which_alternative == 2)
218 static char templ[40];
220 is_valid = neon_immediate_valid_for_move (operands[1], <MODE>mode,
221 &operands[1], &width);
223 gcc_assert (is_valid != 0);
226 return "vmov.f32\t%q0, %1 @ <mode>";
228 sprintf (templ, "vmov.i%d\t%%q0, %%1 @ <mode>", width);
233 switch (which_alternative)
235 case 0: return "vmov\t%q0, %q1 @ <mode>";
236 case 1: case 3: return output_move_neon (operands);
237 case 2: gcc_unreachable ();
238 case 4: return "vmov\t%Q0, %R0, %e1 @ <mode>\;vmov\t%J0, %K0, %f1";
239 case 5: return "vmov\t%e0, %Q1, %R1 @ <mode>\;vmov\t%f0, %J1, %K1";
240 default: return output_move_quad (operands);
243 [(set_attr "neon_type" "neon_int_1,neon_stm_2,neon_vmov,neon_ldm_2,\
244 neon_mrrc,neon_mcr_2_mcrr,*,*,*")
245 (set_attr "type" "*,*,*,*,*,*,alu,load4,store4")
246 (set_attr "insn" "*,*,*,*,*,*,mov,*,*")
247 (set_attr "length" "4,8,4,8,8,8,16,8,16")
248 (set_attr "pool_range" "*,*,*,1020,*,*,*,1020,*")
249 (set_attr "neg_pool_range" "*,*,*,996,*,*,*,996,*")])
251 (define_expand "movti"
252 [(set (match_operand:TI 0 "nonimmediate_operand" "")
253 (match_operand:TI 1 "general_operand" ""))]
256 if (can_create_pseudo_p ())
258 if (GET_CODE (operands[0]) != REG)
259 operands[1] = force_reg (TImode, operands[1]);
263 (define_expand "mov<mode>"
264 [(set (match_operand:VSTRUCT 0 "nonimmediate_operand" "")
265 (match_operand:VSTRUCT 1 "general_operand" ""))]
268 if (can_create_pseudo_p ())
270 if (GET_CODE (operands[0]) != REG)
271 operands[1] = force_reg (<MODE>mode, operands[1]);
275 (define_insn "*neon_mov<mode>"
276 [(set (match_operand:VSTRUCT 0 "nonimmediate_operand" "=w,Ut,w")
277 (match_operand:VSTRUCT 1 "general_operand" " w,w, Ut"))]
279 && (register_operand (operands[0], <MODE>mode)
280 || register_operand (operands[1], <MODE>mode))"
282 switch (which_alternative)
285 case 1: case 2: return output_move_neon (operands);
286 default: gcc_unreachable ();
289 [(set_attr "neon_type" "neon_int_1,neon_stm_2,neon_ldm_2")
290 (set (attr "length") (symbol_ref "arm_attr_length_move_neon (insn)"))])
293 [(set (match_operand:EI 0 "s_register_operand" "")
294 (match_operand:EI 1 "s_register_operand" ""))]
295 "TARGET_NEON && reload_completed"
296 [(set (match_dup 0) (match_dup 1))
297 (set (match_dup 2) (match_dup 3))]
299 int rdest = REGNO (operands[0]);
300 int rsrc = REGNO (operands[1]);
303 dest[0] = gen_rtx_REG (TImode, rdest);
304 src[0] = gen_rtx_REG (TImode, rsrc);
305 dest[1] = gen_rtx_REG (DImode, rdest + 4);
306 src[1] = gen_rtx_REG (DImode, rsrc + 4);
308 neon_disambiguate_copy (operands, dest, src, 2);
312 [(set (match_operand:OI 0 "s_register_operand" "")
313 (match_operand:OI 1 "s_register_operand" ""))]
314 "TARGET_NEON && reload_completed"
315 [(set (match_dup 0) (match_dup 1))
316 (set (match_dup 2) (match_dup 3))]
318 int rdest = REGNO (operands[0]);
319 int rsrc = REGNO (operands[1]);
322 dest[0] = gen_rtx_REG (TImode, rdest);
323 src[0] = gen_rtx_REG (TImode, rsrc);
324 dest[1] = gen_rtx_REG (TImode, rdest + 4);
325 src[1] = gen_rtx_REG (TImode, rsrc + 4);
327 neon_disambiguate_copy (operands, dest, src, 2);
331 [(set (match_operand:CI 0 "s_register_operand" "")
332 (match_operand:CI 1 "s_register_operand" ""))]
333 "TARGET_NEON && reload_completed"
334 [(set (match_dup 0) (match_dup 1))
335 (set (match_dup 2) (match_dup 3))
336 (set (match_dup 4) (match_dup 5))]
338 int rdest = REGNO (operands[0]);
339 int rsrc = REGNO (operands[1]);
342 dest[0] = gen_rtx_REG (TImode, rdest);
343 src[0] = gen_rtx_REG (TImode, rsrc);
344 dest[1] = gen_rtx_REG (TImode, rdest + 4);
345 src[1] = gen_rtx_REG (TImode, rsrc + 4);
346 dest[2] = gen_rtx_REG (TImode, rdest + 8);
347 src[2] = gen_rtx_REG (TImode, rsrc + 8);
349 neon_disambiguate_copy (operands, dest, src, 3);
353 [(set (match_operand:XI 0 "s_register_operand" "")
354 (match_operand:XI 1 "s_register_operand" ""))]
355 "TARGET_NEON && reload_completed"
356 [(set (match_dup 0) (match_dup 1))
357 (set (match_dup 2) (match_dup 3))
358 (set (match_dup 4) (match_dup 5))
359 (set (match_dup 6) (match_dup 7))]
361 int rdest = REGNO (operands[0]);
362 int rsrc = REGNO (operands[1]);
365 dest[0] = gen_rtx_REG (TImode, rdest);
366 src[0] = gen_rtx_REG (TImode, rsrc);
367 dest[1] = gen_rtx_REG (TImode, rdest + 4);
368 src[1] = gen_rtx_REG (TImode, rsrc + 4);
369 dest[2] = gen_rtx_REG (TImode, rdest + 8);
370 src[2] = gen_rtx_REG (TImode, rsrc + 8);
371 dest[3] = gen_rtx_REG (TImode, rdest + 12);
372 src[3] = gen_rtx_REG (TImode, rsrc + 12);
374 neon_disambiguate_copy (operands, dest, src, 4);
377 (define_expand "movmisalign<mode>"
378 [(set (match_operand:VDQX 0 "neon_struct_or_register_operand")
379 (unspec:VDQX [(match_operand:VDQX 1 "neon_struct_or_register_operand")]
380 UNSPEC_MISALIGNED_ACCESS))]
381 "TARGET_NEON && !BYTES_BIG_ENDIAN"
383 /* This pattern is not permitted to fail during expansion: if both arguments
384 are non-registers (e.g. memory := constant, which can be created by the
385 auto-vectorizer), force operand 1 into a register. */
386 if (!s_register_operand (operands[0], <MODE>mode)
387 && !s_register_operand (operands[1], <MODE>mode))
388 operands[1] = force_reg (<MODE>mode, operands[1]);
391 (define_insn "*movmisalign<mode>_neon_store"
392 [(set (match_operand:VDX 0 "neon_struct_operand" "=Um")
393 (unspec:VDX [(match_operand:VDX 1 "s_register_operand" " w")]
394 UNSPEC_MISALIGNED_ACCESS))]
395 "TARGET_NEON && !BYTES_BIG_ENDIAN"
396 "vst1.<V_sz_elem>\t{%P1}, %A0"
397 [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")])
399 (define_insn "*movmisalign<mode>_neon_load"
400 [(set (match_operand:VDX 0 "s_register_operand" "=w")
401 (unspec:VDX [(match_operand:VDX 1 "neon_struct_operand" " Um")]
402 UNSPEC_MISALIGNED_ACCESS))]
403 "TARGET_NEON && !BYTES_BIG_ENDIAN"
404 "vld1.<V_sz_elem>\t{%P0}, %A1"
405 [(set_attr "neon_type" "neon_vld1_1_2_regs")])
407 (define_insn "*movmisalign<mode>_neon_store"
408 [(set (match_operand:VQX 0 "neon_struct_operand" "=Um")
409 (unspec:VQX [(match_operand:VQX 1 "s_register_operand" " w")]
410 UNSPEC_MISALIGNED_ACCESS))]
411 "TARGET_NEON && !BYTES_BIG_ENDIAN"
412 "vst1.<V_sz_elem>\t{%q1}, %A0"
413 [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")])
415 (define_insn "*movmisalign<mode>_neon_load"
416 [(set (match_operand:VQX 0 "s_register_operand" "=w")
417 (unspec:VQX [(match_operand:VQX 1 "neon_struct_operand" " Um")]
418 UNSPEC_MISALIGNED_ACCESS))]
419 "TARGET_NEON && !BYTES_BIG_ENDIAN"
420 "vld1.<V_sz_elem>\t{%q0}, %A1"
421 [(set_attr "neon_type" "neon_vld1_1_2_regs")])
423 (define_insn "vec_set<mode>_internal"
424 [(set (match_operand:VD 0 "s_register_operand" "=w")
427 (match_operand:<V_elem> 1 "s_register_operand" "r"))
428 (match_operand:VD 3 "s_register_operand" "0")
429 (match_operand:SI 2 "immediate_operand" "i")))]
432 int elt = ffs ((int) INTVAL (operands[2])) - 1;
433 if (BYTES_BIG_ENDIAN)
434 elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
435 operands[2] = GEN_INT (elt);
437 return "vmov%?.<V_sz_elem>\t%P0[%c2], %1";
439 [(set_attr "predicable" "yes")
440 (set_attr "neon_type" "neon_mcr")])
442 (define_insn "vec_set<mode>_internal"
443 [(set (match_operand:VQ 0 "s_register_operand" "=w")
446 (match_operand:<V_elem> 1 "s_register_operand" "r"))
447 (match_operand:VQ 3 "s_register_operand" "0")
448 (match_operand:SI 2 "immediate_operand" "i")))]
451 HOST_WIDE_INT elem = ffs ((int) INTVAL (operands[2])) - 1;
452 int half_elts = GET_MODE_NUNITS (<MODE>mode) / 2;
453 int elt = elem % half_elts;
454 int hi = (elem / half_elts) * 2;
455 int regno = REGNO (operands[0]);
457 if (BYTES_BIG_ENDIAN)
458 elt = half_elts - 1 - elt;
460 operands[0] = gen_rtx_REG (<V_HALF>mode, regno + hi);
461 operands[2] = GEN_INT (elt);
463 return "vmov%?.<V_sz_elem>\t%P0[%c2], %1";
465 [(set_attr "predicable" "yes")
466 (set_attr "neon_type" "neon_mcr")]
469 (define_insn "vec_setv2di_internal"
470 [(set (match_operand:V2DI 0 "s_register_operand" "=w")
473 (match_operand:DI 1 "s_register_operand" "r"))
474 (match_operand:V2DI 3 "s_register_operand" "0")
475 (match_operand:SI 2 "immediate_operand" "i")))]
478 HOST_WIDE_INT elem = ffs ((int) INTVAL (operands[2])) - 1;
479 int regno = REGNO (operands[0]) + 2 * elem;
481 operands[0] = gen_rtx_REG (DImode, regno);
483 return "vmov%?\t%P0, %Q1, %R1";
485 [(set_attr "predicable" "yes")
486 (set_attr "neon_type" "neon_mcr_2_mcrr")]
489 (define_expand "vec_set<mode>"
490 [(match_operand:VDQ 0 "s_register_operand" "")
491 (match_operand:<V_elem> 1 "s_register_operand" "")
492 (match_operand:SI 2 "immediate_operand" "")]
495 HOST_WIDE_INT elem = (HOST_WIDE_INT) 1 << INTVAL (operands[2]);
496 emit_insn (gen_vec_set<mode>_internal (operands[0], operands[1],
497 GEN_INT (elem), operands[0]));
501 (define_insn "vec_extract<mode>"
502 [(set (match_operand:<V_elem> 0 "s_register_operand" "=r")
504 (match_operand:VD 1 "s_register_operand" "w")
505 (parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
508 if (BYTES_BIG_ENDIAN)
510 int elt = INTVAL (operands[2]);
511 elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
512 operands[2] = GEN_INT (elt);
514 return "vmov%?.<V_uf_sclr>\t%0, %P1[%c2]";
516 [(set_attr "predicable" "yes")
517 (set_attr "neon_type" "neon_bp_simple")]
520 (define_insn "vec_extract<mode>"
521 [(set (match_operand:<V_elem> 0 "s_register_operand" "=r")
523 (match_operand:VQ 1 "s_register_operand" "w")
524 (parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
527 int half_elts = GET_MODE_NUNITS (<MODE>mode) / 2;
528 int elt = INTVAL (operands[2]) % half_elts;
529 int hi = (INTVAL (operands[2]) / half_elts) * 2;
530 int regno = REGNO (operands[1]);
532 if (BYTES_BIG_ENDIAN)
533 elt = half_elts - 1 - elt;
535 operands[1] = gen_rtx_REG (<V_HALF>mode, regno + hi);
536 operands[2] = GEN_INT (elt);
538 return "vmov%?.<V_uf_sclr>\t%0, %P1[%c2]";
540 [(set_attr "predicable" "yes")
541 (set_attr "neon_type" "neon_bp_simple")]
544 (define_insn "vec_extractv2di"
545 [(set (match_operand:DI 0 "s_register_operand" "=r")
547 (match_operand:V2DI 1 "s_register_operand" "w")
548 (parallel [(match_operand:SI 2 "immediate_operand" "i")])))]
551 int regno = REGNO (operands[1]) + 2 * INTVAL (operands[2]);
553 operands[1] = gen_rtx_REG (DImode, regno);
555 return "vmov%?\t%Q0, %R0, %P1 @ v2di";
557 [(set_attr "predicable" "yes")
558 (set_attr "neon_type" "neon_int_1")]
561 (define_expand "vec_init<mode>"
562 [(match_operand:VDQ 0 "s_register_operand" "")
563 (match_operand 1 "" "")]
566 neon_expand_vector_init (operands[0], operands[1]);
570 ;; Doubleword and quadword arithmetic.
572 ;; NOTE: some other instructions also support 64-bit integer
573 ;; element size, which we could potentially use for "long long" operations.
575 (define_insn "*add<mode>3_neon"
576 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
577 (plus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
578 (match_operand:VDQ 2 "s_register_operand" "w")))]
579 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
580 "vadd.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
581 [(set (attr "neon_type")
582 (if_then_else (match_test "<Is_float_mode>")
583 (if_then_else (match_test "<Is_d_reg>")
584 (const_string "neon_fp_vadd_ddd_vabs_dd")
585 (const_string "neon_fp_vadd_qqq_vabs_qq"))
586 (const_string "neon_int_1")))]
589 (define_insn "adddi3_neon"
590 [(set (match_operand:DI 0 "s_register_operand" "=w,?&r,?&r,?w,?&r,?&r,?&r")
591 (plus:DI (match_operand:DI 1 "s_register_operand" "%w,0,0,w,r,0,r")
592 (match_operand:DI 2 "arm_adddi_operand" "w,r,0,w,r,Dd,Dd")))
593 (clobber (reg:CC CC_REGNUM))]
596 switch (which_alternative)
598 case 0: /* fall through */
599 case 3: return "vadd.i64\t%P0, %P1, %P2";
605 default: gcc_unreachable ();
608 [(set_attr "neon_type" "neon_int_1,*,*,neon_int_1,*,*,*")
609 (set_attr "conds" "*,clob,clob,*,clob,clob,clob")
610 (set_attr "length" "*,8,8,*,8,8,8")
611 (set_attr "arch" "nota8,*,*,onlya8,*,*,*")]
614 (define_insn "*sub<mode>3_neon"
615 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
616 (minus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
617 (match_operand:VDQ 2 "s_register_operand" "w")))]
618 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
619 "vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
620 [(set (attr "neon_type")
621 (if_then_else (match_test "<Is_float_mode>")
622 (if_then_else (match_test "<Is_d_reg>")
623 (const_string "neon_fp_vadd_ddd_vabs_dd")
624 (const_string "neon_fp_vadd_qqq_vabs_qq"))
625 (const_string "neon_int_2")))]
628 (define_insn "subdi3_neon"
629 [(set (match_operand:DI 0 "s_register_operand" "=w,?&r,?&r,?&r,?w")
630 (minus:DI (match_operand:DI 1 "s_register_operand" "w,0,r,0,w")
631 (match_operand:DI 2 "s_register_operand" "w,r,0,0,w")))
632 (clobber (reg:CC CC_REGNUM))]
635 switch (which_alternative)
637 case 0: /* fall through */
638 case 4: return "vsub.i64\t%P0, %P1, %P2";
639 case 1: /* fall through */
640 case 2: /* fall through */
641 case 3: return "subs\\t%Q0, %Q1, %Q2\;sbc\\t%R0, %R1, %R2";
642 default: gcc_unreachable ();
645 [(set_attr "neon_type" "neon_int_2,*,*,*,neon_int_2")
646 (set_attr "conds" "*,clob,clob,clob,*")
647 (set_attr "length" "*,8,8,8,*")
648 (set_attr "arch" "nota8,*,*,*,onlya8")]
651 (define_insn "*mul<mode>3_neon"
652 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
653 (mult:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
654 (match_operand:VDQ 2 "s_register_operand" "w")))]
655 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
656 "vmul.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
657 [(set (attr "neon_type")
658 (if_then_else (match_test "<Is_float_mode>")
659 (if_then_else (match_test "<Is_d_reg>")
660 (const_string "neon_fp_vadd_ddd_vabs_dd")
661 (const_string "neon_fp_vadd_qqq_vabs_qq"))
662 (if_then_else (match_test "<Is_d_reg>")
664 (match_test "<Scalar_mul_8_16>")
665 (const_string "neon_mul_ddd_8_16_qdd_16_8_long_32_16_long")
666 (const_string "neon_mul_qqq_8_16_32_ddd_32"))
667 (if_then_else (match_test "<Scalar_mul_8_16>")
668 (const_string "neon_mul_qqq_8_16_32_ddd_32")
669 (const_string "neon_mul_qqq_8_16_32_ddd_32")))))]
672 (define_insn "mul<mode>3add<mode>_neon"
673 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
674 (plus:VDQ (mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w")
675 (match_operand:VDQ 3 "s_register_operand" "w"))
676 (match_operand:VDQ 1 "s_register_operand" "0")))]
677 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
678 "vmla.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
679 [(set (attr "neon_type")
680 (if_then_else (match_test "<Is_float_mode>")
681 (if_then_else (match_test "<Is_d_reg>")
682 (const_string "neon_fp_vmla_ddd")
683 (const_string "neon_fp_vmla_qqq"))
684 (if_then_else (match_test "<Is_d_reg>")
686 (match_test "<Scalar_mul_8_16>")
687 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
688 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))
689 (if_then_else (match_test "<Scalar_mul_8_16>")
690 (const_string "neon_mla_qqq_8_16")
691 (const_string "neon_mla_qqq_32_qqd_32_scalar")))))]
694 (define_insn "mul<mode>3neg<mode>add<mode>_neon"
695 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
696 (minus:VDQ (match_operand:VDQ 1 "s_register_operand" "0")
697 (mult:VDQ (match_operand:VDQ 2 "s_register_operand" "w")
698 (match_operand:VDQ 3 "s_register_operand" "w"))))]
699 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
700 "vmls.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
701 [(set (attr "neon_type")
702 (if_then_else (match_test "<Is_float_mode>")
703 (if_then_else (match_test "<Is_d_reg>")
704 (const_string "neon_fp_vmla_ddd")
705 (const_string "neon_fp_vmla_qqq"))
706 (if_then_else (match_test "<Is_d_reg>")
708 (match_test "<Scalar_mul_8_16>")
709 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
710 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))
711 (if_then_else (match_test "<Scalar_mul_8_16>")
712 (const_string "neon_mla_qqq_8_16")
713 (const_string "neon_mla_qqq_32_qqd_32_scalar")))))]
716 (define_insn "ior<mode>3"
717 [(set (match_operand:VDQ 0 "s_register_operand" "=w,w")
718 (ior:VDQ (match_operand:VDQ 1 "s_register_operand" "w,0")
719 (match_operand:VDQ 2 "neon_logic_op2" "w,Dl")))]
722 switch (which_alternative)
724 case 0: return "vorr\t%<V_reg>0, %<V_reg>1, %<V_reg>2";
725 case 1: return neon_output_logic_immediate ("vorr", &operands[2],
726 <MODE>mode, 0, VALID_NEON_QREG_MODE (<MODE>mode));
727 default: gcc_unreachable ();
730 [(set_attr "neon_type" "neon_int_1")]
733 (define_insn "iordi3_neon"
734 [(set (match_operand:DI 0 "s_register_operand" "=w,w,?&r,?&r,?w,?w")
735 (ior:DI (match_operand:DI 1 "s_register_operand" "%w,0,0,r,w,0")
736 (match_operand:DI 2 "neon_logic_op2" "w,Dl,r,r,w,Dl")))]
739 switch (which_alternative)
741 case 0: /* fall through */
742 case 4: return "vorr\t%P0, %P1, %P2";
743 case 1: /* fall through */
744 case 5: return neon_output_logic_immediate ("vorr", &operands[2],
745 DImode, 0, VALID_NEON_QREG_MODE (DImode));
748 default: gcc_unreachable ();
751 [(set_attr "neon_type" "neon_int_1,neon_int_1,*,*,neon_int_1,neon_int_1")
752 (set_attr "length" "*,*,8,8,*,*")
753 (set_attr "arch" "nota8,nota8,*,*,onlya8,onlya8")]
756 ;; The concrete forms of the Neon immediate-logic instructions are vbic and
757 ;; vorr. We support the pseudo-instruction vand instead, because that
758 ;; corresponds to the canonical form the middle-end expects to use for
759 ;; immediate bitwise-ANDs.
761 (define_insn "and<mode>3"
762 [(set (match_operand:VDQ 0 "s_register_operand" "=w,w")
763 (and:VDQ (match_operand:VDQ 1 "s_register_operand" "w,0")
764 (match_operand:VDQ 2 "neon_inv_logic_op2" "w,DL")))]
767 switch (which_alternative)
769 case 0: return "vand\t%<V_reg>0, %<V_reg>1, %<V_reg>2";
770 case 1: return neon_output_logic_immediate ("vand", &operands[2],
771 <MODE>mode, 1, VALID_NEON_QREG_MODE (<MODE>mode));
772 default: gcc_unreachable ();
775 [(set_attr "neon_type" "neon_int_1")]
778 (define_insn "anddi3_neon"
779 [(set (match_operand:DI 0 "s_register_operand" "=w,w,?&r,?&r,?w,?w")
780 (and:DI (match_operand:DI 1 "s_register_operand" "%w,0,0,r,w,0")
781 (match_operand:DI 2 "neon_inv_logic_op2" "w,DL,r,r,w,DL")))]
784 switch (which_alternative)
786 case 0: /* fall through */
787 case 4: return "vand\t%P0, %P1, %P2";
788 case 1: /* fall through */
789 case 5: return neon_output_logic_immediate ("vand", &operands[2],
790 DImode, 1, VALID_NEON_QREG_MODE (DImode));
793 default: gcc_unreachable ();
796 [(set_attr "neon_type" "neon_int_1,neon_int_1,*,*,neon_int_1,neon_int_1")
797 (set_attr "length" "*,*,8,8,*,*")
798 (set_attr "arch" "nota8,nota8,*,*,onlya8,onlya8")]
801 (define_insn "orn<mode>3_neon"
802 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
803 (ior:VDQ (not:VDQ (match_operand:VDQ 2 "s_register_operand" "w"))
804 (match_operand:VDQ 1 "s_register_operand" "w")))]
806 "vorn\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
807 [(set_attr "neon_type" "neon_int_1")]
810 ;; TODO: investigate whether we should disable
811 ;; this and bicdi3_neon for the A8 in line with the other
813 (define_insn_and_split "orndi3_neon"
814 [(set (match_operand:DI 0 "s_register_operand" "=w,?&r,?&r,?&r")
815 (ior:DI (not:DI (match_operand:DI 2 "s_register_operand" "w,0,0,r"))
816 (match_operand:DI 1 "s_register_operand" "w,r,r,0")))]
824 (TARGET_NEON && !(IS_VFP_REGNUM (REGNO (operands[0]))))"
825 [(set (match_dup 0) (ior:SI (not:SI (match_dup 2)) (match_dup 1)))
826 (set (match_dup 3) (ior:SI (not:SI (match_dup 4)) (match_dup 5)))]
831 operands[3] = gen_highpart (SImode, operands[0]);
832 operands[0] = gen_lowpart (SImode, operands[0]);
833 operands[4] = gen_highpart (SImode, operands[2]);
834 operands[2] = gen_lowpart (SImode, operands[2]);
835 operands[5] = gen_highpart (SImode, operands[1]);
836 operands[1] = gen_lowpart (SImode, operands[1]);
840 emit_insn (gen_one_cmpldi2 (operands[0], operands[2]));
841 emit_insn (gen_iordi3 (operands[0], operands[1], operands[0]));
845 [(set_attr "neon_type" "neon_int_1,*,*,*")
846 (set_attr "length" "*,16,8,8")
847 (set_attr "arch" "any,a,t2,t2")]
850 (define_insn "bic<mode>3_neon"
851 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
852 (and:VDQ (not:VDQ (match_operand:VDQ 2 "s_register_operand" "w"))
853 (match_operand:VDQ 1 "s_register_operand" "w")))]
855 "vbic\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
856 [(set_attr "neon_type" "neon_int_1")]
859 ;; Compare to *anddi_notdi_di.
860 (define_insn "bicdi3_neon"
861 [(set (match_operand:DI 0 "s_register_operand" "=w,?=&r,?&r")
862 (and:DI (not:DI (match_operand:DI 2 "s_register_operand" "w,r,0"))
863 (match_operand:DI 1 "s_register_operand" "w,0,r")))]
869 [(set_attr "neon_type" "neon_int_1,*,*")
870 (set_attr "length" "*,8,8")]
873 (define_insn "xor<mode>3"
874 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
875 (xor:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
876 (match_operand:VDQ 2 "s_register_operand" "w")))]
878 "veor\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
879 [(set_attr "neon_type" "neon_int_1")]
882 (define_insn "xordi3_neon"
883 [(set (match_operand:DI 0 "s_register_operand" "=w,?&r,?&r,?w")
884 (xor:DI (match_operand:DI 1 "s_register_operand" "%w,0,r,w")
885 (match_operand:DI 2 "s_register_operand" "w,r,r,w")))]
892 [(set_attr "neon_type" "neon_int_1,*,*,neon_int_1")
893 (set_attr "length" "*,8,8,*")
894 (set_attr "arch" "nota8,*,*,onlya8")]
897 (define_insn "one_cmpl<mode>2"
898 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
899 (not:VDQ (match_operand:VDQ 1 "s_register_operand" "w")))]
901 "vmvn\t%<V_reg>0, %<V_reg>1"
902 [(set_attr "neon_type" "neon_int_1")]
905 (define_insn "abs<mode>2"
906 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
907 (abs:VDQW (match_operand:VDQW 1 "s_register_operand" "w")))]
909 "vabs.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
910 [(set (attr "neon_type")
911 (if_then_else (match_test "<Is_float_mode>")
912 (if_then_else (match_test "<Is_d_reg>")
913 (const_string "neon_fp_vadd_ddd_vabs_dd")
914 (const_string "neon_fp_vadd_qqq_vabs_qq"))
915 (const_string "neon_int_3")))]
918 (define_insn "neg<mode>2"
919 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
920 (neg:VDQW (match_operand:VDQW 1 "s_register_operand" "w")))]
922 "vneg.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
923 [(set (attr "neon_type")
924 (if_then_else (match_test "<Is_float_mode>")
925 (if_then_else (match_test "<Is_d_reg>")
926 (const_string "neon_fp_vadd_ddd_vabs_dd")
927 (const_string "neon_fp_vadd_qqq_vabs_qq"))
928 (const_string "neon_int_3")))]
931 (define_insn "negdi2_neon"
932 [(set (match_operand:DI 0 "s_register_operand" "=&w, w,r,&r")
933 (neg:DI (match_operand:DI 1 "s_register_operand" " w, w,0, r")))
934 (clobber (match_scratch:DI 2 "= X,&w,X, X"))
935 (clobber (reg:CC CC_REGNUM))]
938 [(set_attr "length" "8")]
941 ; Split negdi2_neon for vfp registers
943 [(set (match_operand:DI 0 "s_register_operand" "")
944 (neg:DI (match_operand:DI 1 "s_register_operand" "")))
945 (clobber (match_scratch:DI 2 ""))
946 (clobber (reg:CC CC_REGNUM))]
947 "TARGET_NEON && reload_completed && IS_VFP_REGNUM (REGNO (operands[0]))"
948 [(set (match_dup 2) (const_int 0))
949 (parallel [(set (match_dup 0) (minus:DI (match_dup 2) (match_dup 1)))
950 (clobber (reg:CC CC_REGNUM))])]
952 if (!REG_P (operands[2]))
953 operands[2] = operands[0];
957 ; Split negdi2_neon for core registers
959 [(set (match_operand:DI 0 "s_register_operand" "")
960 (neg:DI (match_operand:DI 1 "s_register_operand" "")))
961 (clobber (match_scratch:DI 2 ""))
962 (clobber (reg:CC CC_REGNUM))]
963 "TARGET_32BIT && reload_completed
964 && arm_general_register_operand (operands[0], DImode)"
965 [(parallel [(set (match_dup 0) (neg:DI (match_dup 1)))
966 (clobber (reg:CC CC_REGNUM))])]
970 (define_insn "*umin<mode>3_neon"
971 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
972 (umin:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w")
973 (match_operand:VDQIW 2 "s_register_operand" "w")))]
975 "vmin.<V_u_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
976 [(set_attr "neon_type" "neon_int_5")]
979 (define_insn "*umax<mode>3_neon"
980 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
981 (umax:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w")
982 (match_operand:VDQIW 2 "s_register_operand" "w")))]
984 "vmax.<V_u_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
985 [(set_attr "neon_type" "neon_int_5")]
988 (define_insn "*smin<mode>3_neon"
989 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
990 (smin:VDQW (match_operand:VDQW 1 "s_register_operand" "w")
991 (match_operand:VDQW 2 "s_register_operand" "w")))]
993 "vmin.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
994 [(set (attr "neon_type")
995 (if_then_else (match_test "<Is_float_mode>")
996 (const_string "neon_fp_vadd_ddd_vabs_dd")
997 (const_string "neon_int_5")))]
1000 (define_insn "*smax<mode>3_neon"
1001 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
1002 (smax:VDQW (match_operand:VDQW 1 "s_register_operand" "w")
1003 (match_operand:VDQW 2 "s_register_operand" "w")))]
1005 "vmax.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1006 [(set (attr "neon_type")
1007 (if_then_else (match_test "<Is_float_mode>")
1008 (const_string "neon_fp_vadd_ddd_vabs_dd")
1009 (const_string "neon_int_5")))]
1012 ; TODO: V2DI shifts are current disabled because there are bugs in the
1013 ; generic vectorizer code. It ends up creating a V2DI constructor with
1016 (define_insn "vashl<mode>3"
1017 [(set (match_operand:VDQIW 0 "s_register_operand" "=w,w")
1018 (ashift:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w,w")
1019 (match_operand:VDQIW 2 "imm_lshift_or_reg_neon" "w,Dn")))]
1022 switch (which_alternative)
1024 case 0: return "vshl.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2";
1025 case 1: return neon_output_shift_immediate ("vshl", 'i', &operands[2],
1027 VALID_NEON_QREG_MODE (<MODE>mode),
1029 default: gcc_unreachable ();
1032 [(set (attr "neon_type")
1033 (if_then_else (match_test "<Is_d_reg>")
1034 (const_string "neon_vshl_ddd")
1035 (const_string "neon_shift_3")))]
1038 (define_insn "vashr<mode>3_imm"
1039 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
1040 (ashiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w")
1041 (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dn")))]
1044 return neon_output_shift_immediate ("vshr", 's', &operands[2],
1045 <MODE>mode, VALID_NEON_QREG_MODE (<MODE>mode),
1048 [(set (attr "neon_type")
1049 (if_then_else (match_test "<Is_d_reg>")
1050 (const_string "neon_vshl_ddd")
1051 (const_string "neon_shift_3")))]
1054 (define_insn "vlshr<mode>3_imm"
1055 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
1056 (lshiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w")
1057 (match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dn")))]
1060 return neon_output_shift_immediate ("vshr", 'u', &operands[2],
1061 <MODE>mode, VALID_NEON_QREG_MODE (<MODE>mode),
1064 [(set (attr "neon_type")
1065 (if_then_else (match_test "<Is_d_reg>")
1066 (const_string "neon_vshl_ddd")
1067 (const_string "neon_shift_3")))]
1070 ; Used for implementing logical shift-right, which is a left-shift by a negative
1071 ; amount, with signed operands. This is essentially the same as ashl<mode>3
1072 ; above, but using an unspec in case GCC tries anything tricky with negative
1075 (define_insn "ashl<mode>3_signed"
1076 [(set (match_operand:VDQI 0 "s_register_operand" "=w")
1077 (unspec:VDQI [(match_operand:VDQI 1 "s_register_operand" "w")
1078 (match_operand:VDQI 2 "s_register_operand" "w")]
1079 UNSPEC_ASHIFT_SIGNED))]
1081 "vshl.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1082 [(set (attr "neon_type")
1083 (if_then_else (match_test "<Is_d_reg>")
1084 (const_string "neon_vshl_ddd")
1085 (const_string "neon_shift_3")))]
1088 ; Used for implementing logical shift-right, which is a left-shift by a negative
1089 ; amount, with unsigned operands.
1091 (define_insn "ashl<mode>3_unsigned"
1092 [(set (match_operand:VDQI 0 "s_register_operand" "=w")
1093 (unspec:VDQI [(match_operand:VDQI 1 "s_register_operand" "w")
1094 (match_operand:VDQI 2 "s_register_operand" "w")]
1095 UNSPEC_ASHIFT_UNSIGNED))]
1097 "vshl.<V_u_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1098 [(set (attr "neon_type")
1099 (if_then_else (match_test "<Is_d_reg>")
1100 (const_string "neon_vshl_ddd")
1101 (const_string "neon_shift_3")))]
1104 (define_expand "vashr<mode>3"
1105 [(set (match_operand:VDQIW 0 "s_register_operand" "")
1106 (ashiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "")
1107 (match_operand:VDQIW 2 "imm_rshift_or_reg_neon" "")))]
1110 if (s_register_operand (operands[2], <MODE>mode))
1112 rtx neg = gen_reg_rtx (<MODE>mode);
1113 emit_insn (gen_neg<mode>2 (neg, operands[2]));
1114 emit_insn (gen_ashl<mode>3_signed (operands[0], operands[1], neg));
1117 emit_insn (gen_vashr<mode>3_imm (operands[0], operands[1], operands[2]));
1121 (define_expand "vlshr<mode>3"
1122 [(set (match_operand:VDQIW 0 "s_register_operand" "")
1123 (lshiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "")
1124 (match_operand:VDQIW 2 "imm_rshift_or_reg_neon" "")))]
1127 if (s_register_operand (operands[2], <MODE>mode))
1129 rtx neg = gen_reg_rtx (<MODE>mode);
1130 emit_insn (gen_neg<mode>2 (neg, operands[2]));
1131 emit_insn (gen_ashl<mode>3_unsigned (operands[0], operands[1], neg));
1134 emit_insn (gen_vlshr<mode>3_imm (operands[0], operands[1], operands[2]));
1138 ;; Widening operations
1140 (define_insn "widen_ssum<mode>3"
1141 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
1142 (plus:<V_widen> (sign_extend:<V_widen>
1143 (match_operand:VW 1 "s_register_operand" "%w"))
1144 (match_operand:<V_widen> 2 "s_register_operand" "w")))]
1146 "vaddw.<V_s_elem>\t%q0, %q2, %P1"
1147 [(set_attr "neon_type" "neon_int_3")]
1150 (define_insn "widen_usum<mode>3"
1151 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
1152 (plus:<V_widen> (zero_extend:<V_widen>
1153 (match_operand:VW 1 "s_register_operand" "%w"))
1154 (match_operand:<V_widen> 2 "s_register_operand" "w")))]
1156 "vaddw.<V_u_elem>\t%q0, %q2, %P1"
1157 [(set_attr "neon_type" "neon_int_3")]
1160 ;; VEXT can be used to synthesize coarse whole-vector shifts with 8-bit
1161 ;; shift-count granularity. That's good enough for the middle-end's current
1164 ;; Note that it's not safe to perform such an operation in big-endian mode,
1165 ;; due to element-ordering issues.
1167 (define_expand "vec_shr_<mode>"
1168 [(match_operand:VDQ 0 "s_register_operand" "")
1169 (match_operand:VDQ 1 "s_register_operand" "")
1170 (match_operand:SI 2 "const_multiple_of_8_operand" "")]
1171 "TARGET_NEON && !BYTES_BIG_ENDIAN"
1174 HOST_WIDE_INT num_bits = INTVAL (operands[2]);
1175 const int width = GET_MODE_BITSIZE (<MODE>mode);
1176 const enum machine_mode bvecmode = (width == 128) ? V16QImode : V8QImode;
1177 rtx (*gen_ext) (rtx, rtx, rtx, rtx) =
1178 (width == 128) ? gen_neon_vextv16qi : gen_neon_vextv8qi;
1180 if (num_bits == width)
1182 emit_move_insn (operands[0], operands[1]);
1186 zero_reg = force_reg (bvecmode, CONST0_RTX (bvecmode));
1187 operands[0] = gen_lowpart (bvecmode, operands[0]);
1188 operands[1] = gen_lowpart (bvecmode, operands[1]);
1190 emit_insn (gen_ext (operands[0], operands[1], zero_reg,
1191 GEN_INT (num_bits / BITS_PER_UNIT)));
1195 (define_expand "vec_shl_<mode>"
1196 [(match_operand:VDQ 0 "s_register_operand" "")
1197 (match_operand:VDQ 1 "s_register_operand" "")
1198 (match_operand:SI 2 "const_multiple_of_8_operand" "")]
1199 "TARGET_NEON && !BYTES_BIG_ENDIAN"
1202 HOST_WIDE_INT num_bits = INTVAL (operands[2]);
1203 const int width = GET_MODE_BITSIZE (<MODE>mode);
1204 const enum machine_mode bvecmode = (width == 128) ? V16QImode : V8QImode;
1205 rtx (*gen_ext) (rtx, rtx, rtx, rtx) =
1206 (width == 128) ? gen_neon_vextv16qi : gen_neon_vextv8qi;
1210 emit_move_insn (operands[0], CONST0_RTX (<MODE>mode));
1214 num_bits = width - num_bits;
1216 zero_reg = force_reg (bvecmode, CONST0_RTX (bvecmode));
1217 operands[0] = gen_lowpart (bvecmode, operands[0]);
1218 operands[1] = gen_lowpart (bvecmode, operands[1]);
1220 emit_insn (gen_ext (operands[0], zero_reg, operands[1],
1221 GEN_INT (num_bits / BITS_PER_UNIT)));
1225 ;; Helpers for quad-word reduction operations
1227 ; Add (or smin, smax...) the low N/2 elements of the N-element vector
1228 ; operand[1] to the high N/2 elements of same. Put the result in operand[0], an
1229 ; N/2-element vector.
1231 (define_insn "quad_halves_<code>v4si"
1232 [(set (match_operand:V2SI 0 "s_register_operand" "=w")
1234 (vec_select:V2SI (match_operand:V4SI 1 "s_register_operand" "w")
1235 (parallel [(const_int 0) (const_int 1)]))
1236 (vec_select:V2SI (match_dup 1)
1237 (parallel [(const_int 2) (const_int 3)]))))]
1239 "<VQH_mnem>.<VQH_sign>32\t%P0, %e1, %f1"
1240 [(set_attr "vqh_mnem" "<VQH_mnem>")
1241 (set (attr "neon_type")
1242 (if_then_else (eq_attr "vqh_mnem" "vadd")
1243 (const_string "neon_int_1") (const_string "neon_int_5")))]
1246 (define_insn "quad_halves_<code>v4sf"
1247 [(set (match_operand:V2SF 0 "s_register_operand" "=w")
1249 (vec_select:V2SF (match_operand:V4SF 1 "s_register_operand" "w")
1250 (parallel [(const_int 0) (const_int 1)]))
1251 (vec_select:V2SF (match_dup 1)
1252 (parallel [(const_int 2) (const_int 3)]))))]
1253 "TARGET_NEON && flag_unsafe_math_optimizations"
1254 "<VQH_mnem>.f32\t%P0, %e1, %f1"
1255 [(set_attr "vqh_mnem" "<VQH_mnem>")
1256 (set (attr "neon_type")
1257 (if_then_else (eq_attr "vqh_mnem" "vadd")
1258 (const_string "neon_int_1") (const_string "neon_int_5")))]
1261 (define_insn "quad_halves_<code>v8hi"
1262 [(set (match_operand:V4HI 0 "s_register_operand" "+w")
1264 (vec_select:V4HI (match_operand:V8HI 1 "s_register_operand" "w")
1265 (parallel [(const_int 0) (const_int 1)
1266 (const_int 2) (const_int 3)]))
1267 (vec_select:V4HI (match_dup 1)
1268 (parallel [(const_int 4) (const_int 5)
1269 (const_int 6) (const_int 7)]))))]
1271 "<VQH_mnem>.<VQH_sign>16\t%P0, %e1, %f1"
1272 [(set_attr "vqh_mnem" "<VQH_mnem>")
1273 (set (attr "neon_type")
1274 (if_then_else (eq_attr "vqh_mnem" "vadd")
1275 (const_string "neon_int_1") (const_string "neon_int_5")))]
1278 (define_insn "quad_halves_<code>v16qi"
1279 [(set (match_operand:V8QI 0 "s_register_operand" "+w")
1281 (vec_select:V8QI (match_operand:V16QI 1 "s_register_operand" "w")
1282 (parallel [(const_int 0) (const_int 1)
1283 (const_int 2) (const_int 3)
1284 (const_int 4) (const_int 5)
1285 (const_int 6) (const_int 7)]))
1286 (vec_select:V8QI (match_dup 1)
1287 (parallel [(const_int 8) (const_int 9)
1288 (const_int 10) (const_int 11)
1289 (const_int 12) (const_int 13)
1290 (const_int 14) (const_int 15)]))))]
1292 "<VQH_mnem>.<VQH_sign>8\t%P0, %e1, %f1"
1293 [(set_attr "vqh_mnem" "<VQH_mnem>")
1294 (set (attr "neon_type")
1295 (if_then_else (eq_attr "vqh_mnem" "vadd")
1296 (const_string "neon_int_1") (const_string "neon_int_5")))]
1299 (define_expand "move_hi_quad_<mode>"
1300 [(match_operand:ANY128 0 "s_register_operand" "")
1301 (match_operand:<V_HALF> 1 "s_register_operand" "")]
1304 emit_move_insn (simplify_gen_subreg (<V_HALF>mode, operands[0], <MODE>mode,
1305 GET_MODE_SIZE (<V_HALF>mode)),
1310 (define_expand "move_lo_quad_<mode>"
1311 [(match_operand:ANY128 0 "s_register_operand" "")
1312 (match_operand:<V_HALF> 1 "s_register_operand" "")]
1315 emit_move_insn (simplify_gen_subreg (<V_HALF>mode, operands[0],
1321 ;; Reduction operations
1323 (define_expand "reduc_splus_<mode>"
1324 [(match_operand:VD 0 "s_register_operand" "")
1325 (match_operand:VD 1 "s_register_operand" "")]
1326 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
1328 neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
1329 &gen_neon_vpadd_internal<mode>);
1333 (define_expand "reduc_splus_<mode>"
1334 [(match_operand:VQ 0 "s_register_operand" "")
1335 (match_operand:VQ 1 "s_register_operand" "")]
1336 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)
1337 && !BYTES_BIG_ENDIAN"
1339 rtx step1 = gen_reg_rtx (<V_HALF>mode);
1340 rtx res_d = gen_reg_rtx (<V_HALF>mode);
1342 emit_insn (gen_quad_halves_plus<mode> (step1, operands[1]));
1343 emit_insn (gen_reduc_splus_<V_half> (res_d, step1));
1344 emit_insn (gen_move_lo_quad_<mode> (operands[0], res_d));
1349 (define_insn "reduc_splus_v2di"
1350 [(set (match_operand:V2DI 0 "s_register_operand" "=w")
1351 (unspec:V2DI [(match_operand:V2DI 1 "s_register_operand" "w")]
1353 "TARGET_NEON && !BYTES_BIG_ENDIAN"
1354 "vadd.i64\t%e0, %e1, %f1"
1355 [(set_attr "neon_type" "neon_int_1")]
1358 ;; NEON does not distinguish between signed and unsigned addition except on
1359 ;; widening operations.
1360 (define_expand "reduc_uplus_<mode>"
1361 [(match_operand:VDQI 0 "s_register_operand" "")
1362 (match_operand:VDQI 1 "s_register_operand" "")]
1363 "TARGET_NEON && (<Is_d_reg> || !BYTES_BIG_ENDIAN)"
1365 emit_insn (gen_reduc_splus_<mode> (operands[0], operands[1]));
1369 (define_expand "reduc_smin_<mode>"
1370 [(match_operand:VD 0 "s_register_operand" "")
1371 (match_operand:VD 1 "s_register_operand" "")]
1372 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
1374 neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
1375 &gen_neon_vpsmin<mode>);
1379 (define_expand "reduc_smin_<mode>"
1380 [(match_operand:VQ 0 "s_register_operand" "")
1381 (match_operand:VQ 1 "s_register_operand" "")]
1382 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)
1383 && !BYTES_BIG_ENDIAN"
1385 rtx step1 = gen_reg_rtx (<V_HALF>mode);
1386 rtx res_d = gen_reg_rtx (<V_HALF>mode);
1388 emit_insn (gen_quad_halves_smin<mode> (step1, operands[1]));
1389 emit_insn (gen_reduc_smin_<V_half> (res_d, step1));
1390 emit_insn (gen_move_lo_quad_<mode> (operands[0], res_d));
1395 (define_expand "reduc_smax_<mode>"
1396 [(match_operand:VD 0 "s_register_operand" "")
1397 (match_operand:VD 1 "s_register_operand" "")]
1398 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
1400 neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
1401 &gen_neon_vpsmax<mode>);
1405 (define_expand "reduc_smax_<mode>"
1406 [(match_operand:VQ 0 "s_register_operand" "")
1407 (match_operand:VQ 1 "s_register_operand" "")]
1408 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)
1409 && !BYTES_BIG_ENDIAN"
1411 rtx step1 = gen_reg_rtx (<V_HALF>mode);
1412 rtx res_d = gen_reg_rtx (<V_HALF>mode);
1414 emit_insn (gen_quad_halves_smax<mode> (step1, operands[1]));
1415 emit_insn (gen_reduc_smax_<V_half> (res_d, step1));
1416 emit_insn (gen_move_lo_quad_<mode> (operands[0], res_d));
1421 (define_expand "reduc_umin_<mode>"
1422 [(match_operand:VDI 0 "s_register_operand" "")
1423 (match_operand:VDI 1 "s_register_operand" "")]
1426 neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
1427 &gen_neon_vpumin<mode>);
1431 (define_expand "reduc_umin_<mode>"
1432 [(match_operand:VQI 0 "s_register_operand" "")
1433 (match_operand:VQI 1 "s_register_operand" "")]
1434 "TARGET_NEON && !BYTES_BIG_ENDIAN"
1436 rtx step1 = gen_reg_rtx (<V_HALF>mode);
1437 rtx res_d = gen_reg_rtx (<V_HALF>mode);
1439 emit_insn (gen_quad_halves_umin<mode> (step1, operands[1]));
1440 emit_insn (gen_reduc_umin_<V_half> (res_d, step1));
1441 emit_insn (gen_move_lo_quad_<mode> (operands[0], res_d));
1446 (define_expand "reduc_umax_<mode>"
1447 [(match_operand:VDI 0 "s_register_operand" "")
1448 (match_operand:VDI 1 "s_register_operand" "")]
1451 neon_pairwise_reduce (operands[0], operands[1], <MODE>mode,
1452 &gen_neon_vpumax<mode>);
1456 (define_expand "reduc_umax_<mode>"
1457 [(match_operand:VQI 0 "s_register_operand" "")
1458 (match_operand:VQI 1 "s_register_operand" "")]
1459 "TARGET_NEON && !BYTES_BIG_ENDIAN"
1461 rtx step1 = gen_reg_rtx (<V_HALF>mode);
1462 rtx res_d = gen_reg_rtx (<V_HALF>mode);
1464 emit_insn (gen_quad_halves_umax<mode> (step1, operands[1]));
1465 emit_insn (gen_reduc_umax_<V_half> (res_d, step1));
1466 emit_insn (gen_move_lo_quad_<mode> (operands[0], res_d));
1471 (define_insn "neon_vpadd_internal<mode>"
1472 [(set (match_operand:VD 0 "s_register_operand" "=w")
1473 (unspec:VD [(match_operand:VD 1 "s_register_operand" "w")
1474 (match_operand:VD 2 "s_register_operand" "w")]
1477 "vpadd.<V_if_elem>\t%P0, %P1, %P2"
1478 ;; Assume this schedules like vadd.
1479 [(set (attr "neon_type")
1480 (if_then_else (match_test "<Is_float_mode>")
1481 (if_then_else (match_test "<Is_d_reg>")
1482 (const_string "neon_fp_vadd_ddd_vabs_dd")
1483 (const_string "neon_fp_vadd_qqq_vabs_qq"))
1484 (const_string "neon_int_1")))]
1487 (define_insn "neon_vpsmin<mode>"
1488 [(set (match_operand:VD 0 "s_register_operand" "=w")
1489 (unspec:VD [(match_operand:VD 1 "s_register_operand" "w")
1490 (match_operand:VD 2 "s_register_operand" "w")]
1493 "vpmin.<V_s_elem>\t%P0, %P1, %P2"
1494 ;; Assume this schedules like vmin.
1495 [(set (attr "neon_type")
1496 (if_then_else (match_test "<Is_float_mode>")
1497 (const_string "neon_fp_vadd_ddd_vabs_dd")
1498 (const_string "neon_int_5")))]
1501 (define_insn "neon_vpsmax<mode>"
1502 [(set (match_operand:VD 0 "s_register_operand" "=w")
1503 (unspec:VD [(match_operand:VD 1 "s_register_operand" "w")
1504 (match_operand:VD 2 "s_register_operand" "w")]
1507 "vpmax.<V_s_elem>\t%P0, %P1, %P2"
1508 ;; Assume this schedules like vmax.
1509 [(set (attr "neon_type")
1510 (if_then_else (match_test "<Is_float_mode>")
1511 (const_string "neon_fp_vadd_ddd_vabs_dd")
1512 (const_string "neon_int_5")))]
1515 (define_insn "neon_vpumin<mode>"
1516 [(set (match_operand:VDI 0 "s_register_operand" "=w")
1517 (unspec:VDI [(match_operand:VDI 1 "s_register_operand" "w")
1518 (match_operand:VDI 2 "s_register_operand" "w")]
1521 "vpmin.<V_u_elem>\t%P0, %P1, %P2"
1522 ;; Assume this schedules like umin.
1523 [(set_attr "neon_type" "neon_int_5")]
1526 (define_insn "neon_vpumax<mode>"
1527 [(set (match_operand:VDI 0 "s_register_operand" "=w")
1528 (unspec:VDI [(match_operand:VDI 1 "s_register_operand" "w")
1529 (match_operand:VDI 2 "s_register_operand" "w")]
1532 "vpmax.<V_u_elem>\t%P0, %P1, %P2"
1533 ;; Assume this schedules like umax.
1534 [(set_attr "neon_type" "neon_int_5")]
1537 ;; Saturating arithmetic
1539 ; NOTE: Neon supports many more saturating variants of instructions than the
1540 ; following, but these are all GCC currently understands.
1541 ; FIXME: Actually, GCC doesn't know how to create saturating add/sub by itself
1542 ; yet either, although these patterns may be used by intrinsics when they're
1545 (define_insn "*ss_add<mode>_neon"
1546 [(set (match_operand:VD 0 "s_register_operand" "=w")
1547 (ss_plus:VD (match_operand:VD 1 "s_register_operand" "w")
1548 (match_operand:VD 2 "s_register_operand" "w")))]
1550 "vqadd.<V_s_elem>\t%P0, %P1, %P2"
1551 [(set_attr "neon_type" "neon_int_4")]
1554 (define_insn "*us_add<mode>_neon"
1555 [(set (match_operand:VD 0 "s_register_operand" "=w")
1556 (us_plus:VD (match_operand:VD 1 "s_register_operand" "w")
1557 (match_operand:VD 2 "s_register_operand" "w")))]
1559 "vqadd.<V_u_elem>\t%P0, %P1, %P2"
1560 [(set_attr "neon_type" "neon_int_4")]
1563 (define_insn "*ss_sub<mode>_neon"
1564 [(set (match_operand:VD 0 "s_register_operand" "=w")
1565 (ss_minus:VD (match_operand:VD 1 "s_register_operand" "w")
1566 (match_operand:VD 2 "s_register_operand" "w")))]
1568 "vqsub.<V_s_elem>\t%P0, %P1, %P2"
1569 [(set_attr "neon_type" "neon_int_5")]
1572 (define_insn "*us_sub<mode>_neon"
1573 [(set (match_operand:VD 0 "s_register_operand" "=w")
1574 (us_minus:VD (match_operand:VD 1 "s_register_operand" "w")
1575 (match_operand:VD 2 "s_register_operand" "w")))]
1577 "vqsub.<V_u_elem>\t%P0, %P1, %P2"
1578 [(set_attr "neon_type" "neon_int_5")]
1581 ;; Conditional instructions. These are comparisons with conditional moves for
1582 ;; vectors. They perform the assignment:
1584 ;; Vop0 = (Vop4 <op3> Vop5) ? Vop1 : Vop2;
1586 ;; where op3 is <, <=, ==, !=, >= or >. Operations are performed
1589 (define_expand "vcond<mode><mode>"
1590 [(set (match_operand:VDQW 0 "s_register_operand" "")
1592 (match_operator 3 "arm_comparison_operator"
1593 [(match_operand:VDQW 4 "s_register_operand" "")
1594 (match_operand:VDQW 5 "nonmemory_operand" "")])
1595 (match_operand:VDQW 1 "s_register_operand" "")
1596 (match_operand:VDQW 2 "s_register_operand" "")))]
1597 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
1600 int inverse = 0, immediate_zero = 0;
1601 /* See the description of "magic" bits in the 'T' case of
1602 arm_print_operand. */
1603 HOST_WIDE_INT magic_word = (<MODE>mode == V2SFmode || <MODE>mode == V4SFmode)
1605 rtx magic_rtx = GEN_INT (magic_word);
1607 mask = gen_reg_rtx (<V_cmp_result>mode);
1609 if (operands[5] == CONST0_RTX (<MODE>mode))
1611 else if (!REG_P (operands[5]))
1612 operands[5] = force_reg (<MODE>mode, operands[5]);
1614 switch (GET_CODE (operands[3]))
1617 emit_insn (gen_neon_vcge<mode> (mask, operands[4], operands[5],
1622 emit_insn (gen_neon_vcgt<mode> (mask, operands[4], operands[5],
1627 emit_insn (gen_neon_vceq<mode> (mask, operands[4], operands[5],
1633 emit_insn (gen_neon_vcle<mode> (mask, operands[4], operands[5],
1636 emit_insn (gen_neon_vcge<mode> (mask, operands[5], operands[4],
1642 emit_insn (gen_neon_vclt<mode> (mask, operands[4], operands[5],
1645 emit_insn (gen_neon_vcgt<mode> (mask, operands[5], operands[4],
1650 emit_insn (gen_neon_vceq<mode> (mask, operands[4], operands[5],
1660 emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[2],
1663 emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[1],
1669 (define_expand "vcondu<mode><mode>"
1670 [(set (match_operand:VDQIW 0 "s_register_operand" "")
1672 (match_operator 3 "arm_comparison_operator"
1673 [(match_operand:VDQIW 4 "s_register_operand" "")
1674 (match_operand:VDQIW 5 "s_register_operand" "")])
1675 (match_operand:VDQIW 1 "s_register_operand" "")
1676 (match_operand:VDQIW 2 "s_register_operand" "")))]
1680 int inverse = 0, immediate_zero = 0;
1682 mask = gen_reg_rtx (<V_cmp_result>mode);
1684 if (operands[5] == CONST0_RTX (<MODE>mode))
1686 else if (!REG_P (operands[5]))
1687 operands[5] = force_reg (<MODE>mode, operands[5]);
1689 switch (GET_CODE (operands[3]))
1692 emit_insn (gen_neon_vcge<mode> (mask, operands[4], operands[5],
1697 emit_insn (gen_neon_vcgt<mode> (mask, operands[4], operands[5],
1702 emit_insn (gen_neon_vceq<mode> (mask, operands[4], operands[5],
1708 emit_insn (gen_neon_vcle<mode> (mask, operands[4], operands[5],
1711 emit_insn (gen_neon_vcge<mode> (mask, operands[5], operands[4],
1717 emit_insn (gen_neon_vclt<mode> (mask, operands[4], operands[5],
1720 emit_insn (gen_neon_vcgt<mode> (mask, operands[5], operands[4],
1725 emit_insn (gen_neon_vceq<mode> (mask, operands[4], operands[5],
1735 emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[2],
1738 emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[1],
1744 ;; Patterns for builtins.
1746 ; good for plain vadd, vaddq.
1748 (define_expand "neon_vadd<mode>"
1749 [(match_operand:VDQX 0 "s_register_operand" "=w")
1750 (match_operand:VDQX 1 "s_register_operand" "w")
1751 (match_operand:VDQX 2 "s_register_operand" "w")
1752 (match_operand:SI 3 "immediate_operand" "i")]
1755 if (!<Is_float_mode> || flag_unsafe_math_optimizations)
1756 emit_insn (gen_add<mode>3 (operands[0], operands[1], operands[2]));
1758 emit_insn (gen_neon_vadd<mode>_unspec (operands[0], operands[1],
1763 ; Note that NEON operations don't support the full IEEE 754 standard: in
1764 ; particular, denormal values are flushed to zero. This means that GCC cannot
1765 ; use those instructions for autovectorization, etc. unless
1766 ; -funsafe-math-optimizations is in effect (in which case flush-to-zero
1767 ; behaviour is permissible). Intrinsic operations (provided by the arm_neon.h
1768 ; header) must work in either case: if -funsafe-math-optimizations is given,
1769 ; intrinsics expand to "canonical" RTL where possible, otherwise intrinsics
1770 ; expand to unspecs (which may potentially limit the extent to which they might
1771 ; be optimized by generic code).
1773 ; Used for intrinsics when flag_unsafe_math_optimizations is false.
1775 (define_insn "neon_vadd<mode>_unspec"
1776 [(set (match_operand:VDQX 0 "s_register_operand" "=w")
1777 (unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" "w")
1778 (match_operand:VDQX 2 "s_register_operand" "w")]
1781 "vadd.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1782 [(set (attr "neon_type")
1783 (if_then_else (match_test "<Is_float_mode>")
1784 (if_then_else (match_test "<Is_d_reg>")
1785 (const_string "neon_fp_vadd_ddd_vabs_dd")
1786 (const_string "neon_fp_vadd_qqq_vabs_qq"))
1787 (const_string "neon_int_1")))]
1790 ; operand 3 represents in bits:
1791 ; bit 0: signed (vs unsigned).
1792 ; bit 1: rounding (vs none).
1794 (define_insn "neon_vaddl<mode>"
1795 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
1796 (unspec:<V_widen> [(match_operand:VDI 1 "s_register_operand" "w")
1797 (match_operand:VDI 2 "s_register_operand" "w")
1798 (match_operand:SI 3 "immediate_operand" "i")]
1801 "vaddl.%T3%#<V_sz_elem>\t%q0, %P1, %P2"
1802 [(set_attr "neon_type" "neon_int_3")]
1805 (define_insn "neon_vaddw<mode>"
1806 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
1807 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "w")
1808 (match_operand:VDI 2 "s_register_operand" "w")
1809 (match_operand:SI 3 "immediate_operand" "i")]
1812 "vaddw.%T3%#<V_sz_elem>\t%q0, %q1, %P2"
1813 [(set_attr "neon_type" "neon_int_2")]
1818 (define_insn "neon_vhadd<mode>"
1819 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
1820 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
1821 (match_operand:VDQIW 2 "s_register_operand" "w")
1822 (match_operand:SI 3 "immediate_operand" "i")]
1825 "v%O3hadd.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1826 [(set_attr "neon_type" "neon_int_4")]
1829 (define_insn "neon_vqadd<mode>"
1830 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
1831 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
1832 (match_operand:VDQIX 2 "s_register_operand" "w")
1833 (match_operand:SI 3 "immediate_operand" "i")]
1836 "vqadd.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1837 [(set_attr "neon_type" "neon_int_4")]
1840 (define_insn "neon_vaddhn<mode>"
1841 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
1842 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
1843 (match_operand:VN 2 "s_register_operand" "w")
1844 (match_operand:SI 3 "immediate_operand" "i")]
1847 "v%O3addhn.<V_if_elem>\t%P0, %q1, %q2"
1848 [(set_attr "neon_type" "neon_int_4")]
1851 ;; We cannot replace this unspec with mul<mode>3 because of the odd
1852 ;; polynomial multiplication case that can specified by operand 3.
1853 (define_insn "neon_vmul<mode>"
1854 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
1855 (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "w")
1856 (match_operand:VDQW 2 "s_register_operand" "w")
1857 (match_operand:SI 3 "immediate_operand" "i")]
1860 "vmul.%F3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1861 [(set (attr "neon_type")
1862 (if_then_else (match_test "<Is_float_mode>")
1863 (if_then_else (match_test "<Is_d_reg>")
1864 (const_string "neon_fp_vadd_ddd_vabs_dd")
1865 (const_string "neon_fp_vadd_qqq_vabs_qq"))
1866 (if_then_else (match_test "<Is_d_reg>")
1868 (match_test "<Scalar_mul_8_16>")
1869 (const_string "neon_mul_ddd_8_16_qdd_16_8_long_32_16_long")
1870 (const_string "neon_mul_qqq_8_16_32_ddd_32"))
1871 (if_then_else (match_test "<Scalar_mul_8_16>")
1872 (const_string "neon_mul_qqq_8_16_32_ddd_32")
1873 (const_string "neon_mul_qqq_8_16_32_ddd_32")))))]
1876 (define_expand "neon_vmla<mode>"
1877 [(match_operand:VDQW 0 "s_register_operand" "=w")
1878 (match_operand:VDQW 1 "s_register_operand" "0")
1879 (match_operand:VDQW 2 "s_register_operand" "w")
1880 (match_operand:VDQW 3 "s_register_operand" "w")
1881 (match_operand:SI 4 "immediate_operand" "i")]
1884 if (!<Is_float_mode> || flag_unsafe_math_optimizations)
1885 emit_insn (gen_mul<mode>3add<mode>_neon (operands[0], operands[1],
1886 operands[2], operands[3]));
1888 emit_insn (gen_neon_vmla<mode>_unspec (operands[0], operands[1],
1889 operands[2], operands[3]));
1893 ; Used for intrinsics when flag_unsafe_math_optimizations is false.
1895 (define_insn "neon_vmla<mode>_unspec"
1896 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
1897 (unspec:VDQ [(match_operand:VDQ 1 "s_register_operand" "0")
1898 (match_operand:VDQ 2 "s_register_operand" "w")
1899 (match_operand:VDQ 3 "s_register_operand" "w")]
1902 "vmla.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
1903 [(set (attr "neon_type")
1904 (if_then_else (match_test "<Is_float_mode>")
1905 (if_then_else (match_test "<Is_d_reg>")
1906 (const_string "neon_fp_vmla_ddd")
1907 (const_string "neon_fp_vmla_qqq"))
1908 (if_then_else (match_test "<Is_d_reg>")
1910 (match_test "<Scalar_mul_8_16>")
1911 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
1912 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))
1913 (if_then_else (match_test "<Scalar_mul_8_16>")
1914 (const_string "neon_mla_qqq_8_16")
1915 (const_string "neon_mla_qqq_32_qqd_32_scalar")))))]
1918 (define_insn "neon_vmlal<mode>"
1919 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
1920 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
1921 (match_operand:VW 2 "s_register_operand" "w")
1922 (match_operand:VW 3 "s_register_operand" "w")
1923 (match_operand:SI 4 "immediate_operand" "i")]
1926 "vmlal.%T4%#<V_sz_elem>\t%q0, %P2, %P3"
1927 [(set (attr "neon_type")
1928 (if_then_else (match_test "<Scalar_mul_8_16>")
1929 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
1930 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
1933 (define_expand "neon_vmls<mode>"
1934 [(match_operand:VDQW 0 "s_register_operand" "=w")
1935 (match_operand:VDQW 1 "s_register_operand" "0")
1936 (match_operand:VDQW 2 "s_register_operand" "w")
1937 (match_operand:VDQW 3 "s_register_operand" "w")
1938 (match_operand:SI 4 "immediate_operand" "i")]
1941 if (!<Is_float_mode> || flag_unsafe_math_optimizations)
1942 emit_insn (gen_mul<mode>3neg<mode>add<mode>_neon (operands[0],
1943 operands[1], operands[2], operands[3]));
1945 emit_insn (gen_neon_vmls<mode>_unspec (operands[0], operands[1],
1946 operands[2], operands[3]));
1950 ; Used for intrinsics when flag_unsafe_math_optimizations is false.
1952 (define_insn "neon_vmls<mode>_unspec"
1953 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
1954 (unspec:VDQ [(match_operand:VDQ 1 "s_register_operand" "0")
1955 (match_operand:VDQ 2 "s_register_operand" "w")
1956 (match_operand:VDQ 3 "s_register_operand" "w")]
1959 "vmls.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
1960 [(set (attr "neon_type")
1961 (if_then_else (match_test "<Is_float_mode>")
1962 (if_then_else (match_test "<Is_d_reg>")
1963 (const_string "neon_fp_vmla_ddd")
1964 (const_string "neon_fp_vmla_qqq"))
1965 (if_then_else (match_test "<Is_d_reg>")
1967 (match_test "<Scalar_mul_8_16>")
1968 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
1969 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))
1971 (match_test "<Scalar_mul_8_16>")
1972 (const_string "neon_mla_qqq_8_16")
1973 (const_string "neon_mla_qqq_32_qqd_32_scalar")))))]
1976 (define_insn "neon_vmlsl<mode>"
1977 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
1978 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
1979 (match_operand:VW 2 "s_register_operand" "w")
1980 (match_operand:VW 3 "s_register_operand" "w")
1981 (match_operand:SI 4 "immediate_operand" "i")]
1984 "vmlsl.%T4%#<V_sz_elem>\t%q0, %P2, %P3"
1985 [(set (attr "neon_type")
1986 (if_then_else (match_test "<Scalar_mul_8_16>")
1987 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
1988 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
1991 (define_insn "neon_vqdmulh<mode>"
1992 [(set (match_operand:VMDQI 0 "s_register_operand" "=w")
1993 (unspec:VMDQI [(match_operand:VMDQI 1 "s_register_operand" "w")
1994 (match_operand:VMDQI 2 "s_register_operand" "w")
1995 (match_operand:SI 3 "immediate_operand" "i")]
1998 "vq%O3dmulh.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
1999 [(set (attr "neon_type")
2000 (if_then_else (match_test "<Is_d_reg>")
2001 (if_then_else (match_test "<Scalar_mul_8_16>")
2002 (const_string "neon_mul_ddd_8_16_qdd_16_8_long_32_16_long")
2003 (const_string "neon_mul_qqq_8_16_32_ddd_32"))
2004 (if_then_else (match_test "<Scalar_mul_8_16>")
2005 (const_string "neon_mul_qqq_8_16_32_ddd_32")
2006 (const_string "neon_mul_qqq_8_16_32_ddd_32"))))]
2009 (define_insn "neon_vqdmlal<mode>"
2010 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2011 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
2012 (match_operand:VMDI 2 "s_register_operand" "w")
2013 (match_operand:VMDI 3 "s_register_operand" "w")
2014 (match_operand:SI 4 "immediate_operand" "i")]
2017 "vqdmlal.<V_s_elem>\t%q0, %P2, %P3"
2018 [(set (attr "neon_type")
2019 (if_then_else (match_test "<Scalar_mul_8_16>")
2020 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
2021 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
2024 (define_insn "neon_vqdmlsl<mode>"
2025 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2026 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
2027 (match_operand:VMDI 2 "s_register_operand" "w")
2028 (match_operand:VMDI 3 "s_register_operand" "w")
2029 (match_operand:SI 4 "immediate_operand" "i")]
2032 "vqdmlsl.<V_s_elem>\t%q0, %P2, %P3"
2033 [(set (attr "neon_type")
2034 (if_then_else (match_test "<Scalar_mul_8_16>")
2035 (const_string "neon_mla_ddd_8_16_qdd_16_8_long_32_16_long")
2036 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
2039 (define_insn "neon_vmull<mode>"
2040 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2041 (unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w")
2042 (match_operand:VW 2 "s_register_operand" "w")
2043 (match_operand:SI 3 "immediate_operand" "i")]
2046 "vmull.%T3%#<V_sz_elem>\t%q0, %P1, %P2"
2047 [(set (attr "neon_type")
2048 (if_then_else (match_test "<Scalar_mul_8_16>")
2049 (const_string "neon_mul_ddd_8_16_qdd_16_8_long_32_16_long")
2050 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar")))]
2053 (define_insn "neon_vqdmull<mode>"
2054 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2055 (unspec:<V_widen> [(match_operand:VMDI 1 "s_register_operand" "w")
2056 (match_operand:VMDI 2 "s_register_operand" "w")
2057 (match_operand:SI 3 "immediate_operand" "i")]
2060 "vqdmull.<V_s_elem>\t%q0, %P1, %P2"
2061 [(set (attr "neon_type")
2062 (if_then_else (match_test "<Scalar_mul_8_16>")
2063 (const_string "neon_mul_ddd_8_16_qdd_16_8_long_32_16_long")
2064 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar")))]
2067 (define_expand "neon_vsub<mode>"
2068 [(match_operand:VDQX 0 "s_register_operand" "=w")
2069 (match_operand:VDQX 1 "s_register_operand" "w")
2070 (match_operand:VDQX 2 "s_register_operand" "w")
2071 (match_operand:SI 3 "immediate_operand" "i")]
2074 if (!<Is_float_mode> || flag_unsafe_math_optimizations)
2075 emit_insn (gen_sub<mode>3 (operands[0], operands[1], operands[2]));
2077 emit_insn (gen_neon_vsub<mode>_unspec (operands[0], operands[1],
2082 ; Used for intrinsics when flag_unsafe_math_optimizations is false.
2084 (define_insn "neon_vsub<mode>_unspec"
2085 [(set (match_operand:VDQX 0 "s_register_operand" "=w")
2086 (unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" "w")
2087 (match_operand:VDQX 2 "s_register_operand" "w")]
2090 "vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2091 [(set (attr "neon_type")
2092 (if_then_else (match_test "<Is_float_mode>")
2093 (if_then_else (match_test "<Is_d_reg>")
2094 (const_string "neon_fp_vadd_ddd_vabs_dd")
2095 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2096 (const_string "neon_int_2")))]
2099 (define_insn "neon_vsubl<mode>"
2100 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2101 (unspec:<V_widen> [(match_operand:VDI 1 "s_register_operand" "w")
2102 (match_operand:VDI 2 "s_register_operand" "w")
2103 (match_operand:SI 3 "immediate_operand" "i")]
2106 "vsubl.%T3%#<V_sz_elem>\t%q0, %P1, %P2"
2107 [(set_attr "neon_type" "neon_int_2")]
2110 (define_insn "neon_vsubw<mode>"
2111 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2112 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "w")
2113 (match_operand:VDI 2 "s_register_operand" "w")
2114 (match_operand:SI 3 "immediate_operand" "i")]
2117 "vsubw.%T3%#<V_sz_elem>\t%q0, %q1, %P2"
2118 [(set_attr "neon_type" "neon_int_2")]
2121 (define_insn "neon_vqsub<mode>"
2122 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
2123 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
2124 (match_operand:VDQIX 2 "s_register_operand" "w")
2125 (match_operand:SI 3 "immediate_operand" "i")]
2128 "vqsub.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2129 [(set_attr "neon_type" "neon_int_5")]
2132 (define_insn "neon_vhsub<mode>"
2133 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
2134 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
2135 (match_operand:VDQIW 2 "s_register_operand" "w")
2136 (match_operand:SI 3 "immediate_operand" "i")]
2139 "vhsub.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2140 [(set_attr "neon_type" "neon_int_5")]
2143 (define_insn "neon_vsubhn<mode>"
2144 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
2145 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
2146 (match_operand:VN 2 "s_register_operand" "w")
2147 (match_operand:SI 3 "immediate_operand" "i")]
2150 "v%O3subhn.<V_if_elem>\t%P0, %q1, %q2"
2151 [(set_attr "neon_type" "neon_int_4")]
2154 (define_insn "neon_vceq<mode>"
2155 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w")
2156 (unspec:<V_cmp_result>
2157 [(match_operand:VDQW 1 "s_register_operand" "w,w")
2158 (match_operand:VDQW 2 "reg_or_zero_operand" "w,Dz")
2159 (match_operand:SI 3 "immediate_operand" "i,i")]
2163 vceq.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2
2164 vceq.<V_if_elem>\t%<V_reg>0, %<V_reg>1, #0"
2165 [(set (attr "neon_type")
2166 (if_then_else (match_test "<Is_float_mode>")
2167 (if_then_else (match_test "<Is_d_reg>")
2168 (const_string "neon_fp_vadd_ddd_vabs_dd")
2169 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2170 (const_string "neon_int_5")))]
2173 (define_insn "neon_vcge<mode>"
2174 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w")
2175 (unspec:<V_cmp_result>
2176 [(match_operand:VDQW 1 "s_register_operand" "w,w")
2177 (match_operand:VDQW 2 "reg_or_zero_operand" "w,Dz")
2178 (match_operand:SI 3 "immediate_operand" "i,i")]
2182 vcge.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2
2183 vcge.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, #0"
2184 [(set (attr "neon_type")
2185 (if_then_else (match_test "<Is_float_mode>")
2186 (if_then_else (match_test "<Is_d_reg>")
2187 (const_string "neon_fp_vadd_ddd_vabs_dd")
2188 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2189 (const_string "neon_int_5")))]
2192 (define_insn "neon_vcgeu<mode>"
2193 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w")
2194 (unspec:<V_cmp_result>
2195 [(match_operand:VDQIW 1 "s_register_operand" "w")
2196 (match_operand:VDQIW 2 "s_register_operand" "w")
2197 (match_operand:SI 3 "immediate_operand" "i")]
2200 "vcge.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2201 [(set_attr "neon_type" "neon_int_5")]
2204 (define_insn "neon_vcgt<mode>"
2205 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w")
2206 (unspec:<V_cmp_result>
2207 [(match_operand:VDQW 1 "s_register_operand" "w,w")
2208 (match_operand:VDQW 2 "reg_or_zero_operand" "w,Dz")
2209 (match_operand:SI 3 "immediate_operand" "i,i")]
2213 vcgt.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2
2214 vcgt.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, #0"
2215 [(set (attr "neon_type")
2216 (if_then_else (match_test "<Is_float_mode>")
2217 (if_then_else (match_test "<Is_d_reg>")
2218 (const_string "neon_fp_vadd_ddd_vabs_dd")
2219 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2220 (const_string "neon_int_5")))]
2223 (define_insn "neon_vcgtu<mode>"
2224 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w")
2225 (unspec:<V_cmp_result>
2226 [(match_operand:VDQIW 1 "s_register_operand" "w")
2227 (match_operand:VDQIW 2 "s_register_operand" "w")
2228 (match_operand:SI 3 "immediate_operand" "i")]
2231 "vcgt.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2232 [(set_attr "neon_type" "neon_int_5")]
2235 ;; VCLE and VCLT only support comparisons with immediate zero (register
2236 ;; variants are VCGE and VCGT with operands reversed).
2238 (define_insn "neon_vcle<mode>"
2239 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w")
2240 (unspec:<V_cmp_result>
2241 [(match_operand:VDQW 1 "s_register_operand" "w")
2242 (match_operand:VDQW 2 "zero_operand" "Dz")
2243 (match_operand:SI 3 "immediate_operand" "i")]
2246 "vcle.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, #0"
2247 [(set (attr "neon_type")
2248 (if_then_else (match_test "<Is_float_mode>")
2249 (if_then_else (match_test "<Is_d_reg>")
2250 (const_string "neon_fp_vadd_ddd_vabs_dd")
2251 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2252 (const_string "neon_int_5")))]
2255 (define_insn "neon_vclt<mode>"
2256 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w")
2257 (unspec:<V_cmp_result>
2258 [(match_operand:VDQW 1 "s_register_operand" "w")
2259 (match_operand:VDQW 2 "zero_operand" "Dz")
2260 (match_operand:SI 3 "immediate_operand" "i")]
2263 "vclt.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, #0"
2264 [(set (attr "neon_type")
2265 (if_then_else (match_test "<Is_float_mode>")
2266 (if_then_else (match_test "<Is_d_reg>")
2267 (const_string "neon_fp_vadd_ddd_vabs_dd")
2268 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2269 (const_string "neon_int_5")))]
2272 (define_insn "neon_vcage<mode>"
2273 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w")
2274 (unspec:<V_cmp_result> [(match_operand:VCVTF 1 "s_register_operand" "w")
2275 (match_operand:VCVTF 2 "s_register_operand" "w")
2276 (match_operand:SI 3 "immediate_operand" "i")]
2279 "vacge.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2280 [(set (attr "neon_type")
2281 (if_then_else (match_test "<Is_d_reg>")
2282 (const_string "neon_fp_vadd_ddd_vabs_dd")
2283 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
2286 (define_insn "neon_vcagt<mode>"
2287 [(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w")
2288 (unspec:<V_cmp_result> [(match_operand:VCVTF 1 "s_register_operand" "w")
2289 (match_operand:VCVTF 2 "s_register_operand" "w")
2290 (match_operand:SI 3 "immediate_operand" "i")]
2293 "vacgt.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2294 [(set (attr "neon_type")
2295 (if_then_else (match_test "<Is_d_reg>")
2296 (const_string "neon_fp_vadd_ddd_vabs_dd")
2297 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
2300 (define_insn "neon_vtst<mode>"
2301 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
2302 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
2303 (match_operand:VDQIW 2 "s_register_operand" "w")
2304 (match_operand:SI 3 "immediate_operand" "i")]
2307 "vtst.<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2308 [(set_attr "neon_type" "neon_int_4")]
2311 (define_insn "neon_vabd<mode>"
2312 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
2313 (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "w")
2314 (match_operand:VDQW 2 "s_register_operand" "w")
2315 (match_operand:SI 3 "immediate_operand" "i")]
2318 "vabd.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2319 [(set (attr "neon_type")
2320 (if_then_else (match_test "<Is_float_mode>")
2321 (if_then_else (match_test "<Is_d_reg>")
2322 (const_string "neon_fp_vadd_ddd_vabs_dd")
2323 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2324 (const_string "neon_int_5")))]
2327 (define_insn "neon_vabdl<mode>"
2328 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2329 (unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w")
2330 (match_operand:VW 2 "s_register_operand" "w")
2331 (match_operand:SI 3 "immediate_operand" "i")]
2334 "vabdl.%T3%#<V_sz_elem>\t%q0, %P1, %P2"
2335 [(set_attr "neon_type" "neon_int_5")]
2338 (define_insn "neon_vaba<mode>"
2339 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
2340 (plus:VDQIW (match_operand:VDQIW 1 "s_register_operand" "0")
2341 (unspec:VDQIW [(match_operand:VDQIW 2 "s_register_operand" "w")
2342 (match_operand:VDQIW 3 "s_register_operand" "w")
2343 (match_operand:SI 4 "immediate_operand" "i")]
2346 "vaba.%T4%#<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
2347 [(set (attr "neon_type")
2348 (if_then_else (match_test "<Is_d_reg>")
2349 (const_string "neon_vaba") (const_string "neon_vaba_qqq")))]
2352 (define_insn "neon_vabal<mode>"
2353 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
2354 (plus:<V_widen> (match_operand:<V_widen> 1 "s_register_operand" "0")
2355 (unspec:<V_widen> [(match_operand:VW 2 "s_register_operand" "w")
2356 (match_operand:VW 3 "s_register_operand" "w")
2357 (match_operand:SI 4 "immediate_operand" "i")]
2360 "vabal.%T4%#<V_sz_elem>\t%q0, %P2, %P3"
2361 [(set_attr "neon_type" "neon_vaba")]
2364 (define_insn "neon_vmax<mode>"
2365 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
2366 (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "w")
2367 (match_operand:VDQW 2 "s_register_operand" "w")
2368 (match_operand:SI 3 "immediate_operand" "i")]
2371 "vmax.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2372 [(set (attr "neon_type")
2373 (if_then_else (match_test "<Is_float_mode>")
2374 (if_then_else (match_test "<Is_d_reg>")
2375 (const_string "neon_fp_vadd_ddd_vabs_dd")
2376 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2377 (const_string "neon_int_5")))]
2380 (define_insn "neon_vmin<mode>"
2381 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
2382 (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "w")
2383 (match_operand:VDQW 2 "s_register_operand" "w")
2384 (match_operand:SI 3 "immediate_operand" "i")]
2387 "vmin.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2388 [(set (attr "neon_type")
2389 (if_then_else (match_test "<Is_float_mode>")
2390 (if_then_else (match_test "<Is_d_reg>")
2391 (const_string "neon_fp_vadd_ddd_vabs_dd")
2392 (const_string "neon_fp_vadd_qqq_vabs_qq"))
2393 (const_string "neon_int_5")))]
2396 (define_expand "neon_vpadd<mode>"
2397 [(match_operand:VD 0 "s_register_operand" "=w")
2398 (match_operand:VD 1 "s_register_operand" "w")
2399 (match_operand:VD 2 "s_register_operand" "w")
2400 (match_operand:SI 3 "immediate_operand" "i")]
2403 emit_insn (gen_neon_vpadd_internal<mode> (operands[0], operands[1],
2408 (define_insn "neon_vpaddl<mode>"
2409 [(set (match_operand:<V_double_width> 0 "s_register_operand" "=w")
2410 (unspec:<V_double_width> [(match_operand:VDQIW 1 "s_register_operand" "w")
2411 (match_operand:SI 2 "immediate_operand" "i")]
2414 "vpaddl.%T2%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1"
2415 ;; Assume this schedules like vaddl.
2416 [(set_attr "neon_type" "neon_int_3")]
2419 (define_insn "neon_vpadal<mode>"
2420 [(set (match_operand:<V_double_width> 0 "s_register_operand" "=w")
2421 (unspec:<V_double_width> [(match_operand:<V_double_width> 1 "s_register_operand" "0")
2422 (match_operand:VDQIW 2 "s_register_operand" "w")
2423 (match_operand:SI 3 "immediate_operand" "i")]
2426 "vpadal.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>2"
2427 ;; Assume this schedules like vpadd.
2428 [(set_attr "neon_type" "neon_int_1")]
2431 (define_insn "neon_vpmax<mode>"
2432 [(set (match_operand:VD 0 "s_register_operand" "=w")
2433 (unspec:VD [(match_operand:VD 1 "s_register_operand" "w")
2434 (match_operand:VD 2 "s_register_operand" "w")
2435 (match_operand:SI 3 "immediate_operand" "i")]
2438 "vpmax.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2439 ;; Assume this schedules like vmax.
2440 [(set (attr "neon_type")
2441 (if_then_else (match_test "<Is_float_mode>")
2442 (const_string "neon_fp_vadd_ddd_vabs_dd")
2443 (const_string "neon_int_5")))]
2446 (define_insn "neon_vpmin<mode>"
2447 [(set (match_operand:VD 0 "s_register_operand" "=w")
2448 (unspec:VD [(match_operand:VD 1 "s_register_operand" "w")
2449 (match_operand:VD 2 "s_register_operand" "w")
2450 (match_operand:SI 3 "immediate_operand" "i")]
2453 "vpmin.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2454 ;; Assume this schedules like vmin.
2455 [(set (attr "neon_type")
2456 (if_then_else (match_test "<Is_float_mode>")
2457 (const_string "neon_fp_vadd_ddd_vabs_dd")
2458 (const_string "neon_int_5")))]
2461 (define_insn "neon_vrecps<mode>"
2462 [(set (match_operand:VCVTF 0 "s_register_operand" "=w")
2463 (unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w")
2464 (match_operand:VCVTF 2 "s_register_operand" "w")
2465 (match_operand:SI 3 "immediate_operand" "i")]
2468 "vrecps.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2469 [(set (attr "neon_type")
2470 (if_then_else (match_test "<Is_d_reg>")
2471 (const_string "neon_fp_vrecps_vrsqrts_ddd")
2472 (const_string "neon_fp_vrecps_vrsqrts_qqq")))]
2475 (define_insn "neon_vrsqrts<mode>"
2476 [(set (match_operand:VCVTF 0 "s_register_operand" "=w")
2477 (unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w")
2478 (match_operand:VCVTF 2 "s_register_operand" "w")
2479 (match_operand:SI 3 "immediate_operand" "i")]
2482 "vrsqrts.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
2483 [(set (attr "neon_type")
2484 (if_then_else (match_test "<Is_d_reg>")
2485 (const_string "neon_fp_vrecps_vrsqrts_ddd")
2486 (const_string "neon_fp_vrecps_vrsqrts_qqq")))]
2489 (define_expand "neon_vabs<mode>"
2490 [(match_operand:VDQW 0 "s_register_operand" "")
2491 (match_operand:VDQW 1 "s_register_operand" "")
2492 (match_operand:SI 2 "immediate_operand" "")]
2495 emit_insn (gen_abs<mode>2 (operands[0], operands[1]));
2499 (define_insn "neon_vqabs<mode>"
2500 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
2501 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
2502 (match_operand:SI 2 "immediate_operand" "i")]
2505 "vqabs.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
2506 [(set_attr "neon_type" "neon_vqneg_vqabs")]
2509 (define_expand "neon_vneg<mode>"
2510 [(match_operand:VDQW 0 "s_register_operand" "")
2511 (match_operand:VDQW 1 "s_register_operand" "")
2512 (match_operand:SI 2 "immediate_operand" "")]
2515 emit_insn (gen_neg<mode>2 (operands[0], operands[1]));
2519 (define_insn "neon_vqneg<mode>"
2520 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
2521 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
2522 (match_operand:SI 2 "immediate_operand" "i")]
2525 "vqneg.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
2526 [(set_attr "neon_type" "neon_vqneg_vqabs")]
2529 (define_insn "neon_vcls<mode>"
2530 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
2531 (unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")
2532 (match_operand:SI 2 "immediate_operand" "i")]
2535 "vcls.<V_s_elem>\t%<V_reg>0, %<V_reg>1"
2536 [(set_attr "neon_type" "neon_int_1")]
2539 (define_insn "clz<mode>2"
2540 [(set (match_operand:VDQIW 0 "s_register_operand" "=w")
2541 (clz:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w")))]
2543 "vclz.<V_if_elem>\t%<V_reg>0, %<V_reg>1"
2544 [(set_attr "neon_type" "neon_int_1")]
2547 (define_expand "neon_vclz<mode>"
2548 [(match_operand:VDQIW 0 "s_register_operand" "")
2549 (match_operand:VDQIW 1 "s_register_operand" "")
2550 (match_operand:SI 2 "immediate_operand" "")]
2553 emit_insn (gen_clz<mode>2 (operands[0], operands[1]));
2557 (define_insn "popcount<mode>2"
2558 [(set (match_operand:VE 0 "s_register_operand" "=w")
2559 (popcount:VE (match_operand:VE 1 "s_register_operand" "w")))]
2561 "vcnt.<V_sz_elem>\t%<V_reg>0, %<V_reg>1"
2562 [(set_attr "neon_type" "neon_int_1")]
2565 (define_expand "neon_vcnt<mode>"
2566 [(match_operand:VE 0 "s_register_operand" "=w")
2567 (match_operand:VE 1 "s_register_operand" "w")
2568 (match_operand:SI 2 "immediate_operand" "i")]
2571 emit_insn (gen_popcount<mode>2 (operands[0], operands[1]));
2575 (define_insn "neon_vrecpe<mode>"
2576 [(set (match_operand:V32 0 "s_register_operand" "=w")
2577 (unspec:V32 [(match_operand:V32 1 "s_register_operand" "w")
2578 (match_operand:SI 2 "immediate_operand" "i")]
2581 "vrecpe.<V_u_elem>\t%<V_reg>0, %<V_reg>1"
2582 [(set (attr "neon_type")
2583 (if_then_else (match_test "<Is_d_reg>")
2584 (const_string "neon_fp_vadd_ddd_vabs_dd")
2585 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
2588 (define_insn "neon_vrsqrte<mode>"
2589 [(set (match_operand:V32 0 "s_register_operand" "=w")
2590 (unspec:V32 [(match_operand:V32 1 "s_register_operand" "w")
2591 (match_operand:SI 2 "immediate_operand" "i")]
2594 "vrsqrte.<V_u_elem>\t%<V_reg>0, %<V_reg>1"
2595 [(set (attr "neon_type")
2596 (if_then_else (match_test "<Is_d_reg>")
2597 (const_string "neon_fp_vadd_ddd_vabs_dd")
2598 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
2601 (define_expand "neon_vmvn<mode>"
2602 [(match_operand:VDQIW 0 "s_register_operand" "")
2603 (match_operand:VDQIW 1 "s_register_operand" "")
2604 (match_operand:SI 2 "immediate_operand" "")]
2607 emit_insn (gen_one_cmpl<mode>2 (operands[0], operands[1]));
2611 (define_insn "neon_vget_lane<mode>_sext_internal"
2612 [(set (match_operand:SI 0 "s_register_operand" "=r")
2614 (vec_select:<V_elem>
2615 (match_operand:VD 1 "s_register_operand" "w")
2616 (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))]
2619 if (BYTES_BIG_ENDIAN)
2621 int elt = INTVAL (operands[2]);
2622 elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
2623 operands[2] = GEN_INT (elt);
2625 return "vmov%?.s<V_sz_elem>\t%0, %P1[%c2]";
2627 [(set_attr "predicable" "yes")
2628 (set_attr "neon_type" "neon_bp_simple")]
2631 (define_insn "neon_vget_lane<mode>_zext_internal"
2632 [(set (match_operand:SI 0 "s_register_operand" "=r")
2634 (vec_select:<V_elem>
2635 (match_operand:VD 1 "s_register_operand" "w")
2636 (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))]
2639 if (BYTES_BIG_ENDIAN)
2641 int elt = INTVAL (operands[2]);
2642 elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt;
2643 operands[2] = GEN_INT (elt);
2645 return "vmov%?.u<V_sz_elem>\t%0, %P1[%c2]";
2647 [(set_attr "predicable" "yes")
2648 (set_attr "neon_type" "neon_bp_simple")]
2651 (define_insn "neon_vget_lane<mode>_sext_internal"
2652 [(set (match_operand:SI 0 "s_register_operand" "=r")
2654 (vec_select:<V_elem>
2655 (match_operand:VQ 1 "s_register_operand" "w")
2656 (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))]
2660 int regno = REGNO (operands[1]);
2661 unsigned int halfelts = GET_MODE_NUNITS (<MODE>mode) / 2;
2662 unsigned int elt = INTVAL (operands[2]);
2663 unsigned int elt_adj = elt % halfelts;
2665 if (BYTES_BIG_ENDIAN)
2666 elt_adj = halfelts - 1 - elt_adj;
2668 ops[0] = operands[0];
2669 ops[1] = gen_rtx_REG (<V_HALF>mode, regno + 2 * (elt / halfelts));
2670 ops[2] = GEN_INT (elt_adj);
2671 output_asm_insn ("vmov%?.s<V_sz_elem>\t%0, %P1[%c2]", ops);
2675 [(set_attr "predicable" "yes")
2676 (set_attr "neon_type" "neon_bp_simple")]
2679 (define_insn "neon_vget_lane<mode>_zext_internal"
2680 [(set (match_operand:SI 0 "s_register_operand" "=r")
2682 (vec_select:<V_elem>
2683 (match_operand:VQ 1 "s_register_operand" "w")
2684 (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))]
2688 int regno = REGNO (operands[1]);
2689 unsigned int halfelts = GET_MODE_NUNITS (<MODE>mode) / 2;
2690 unsigned int elt = INTVAL (operands[2]);
2691 unsigned int elt_adj = elt % halfelts;
2693 if (BYTES_BIG_ENDIAN)
2694 elt_adj = halfelts - 1 - elt_adj;
2696 ops[0] = operands[0];
2697 ops[1] = gen_rtx_REG (<V_HALF>mode, regno + 2 * (elt / halfelts));
2698 ops[2] = GEN_INT (elt_adj);
2699 output_asm_insn ("vmov%?.u<V_sz_elem>\t%0, %P1[%c2]", ops);
2703 [(set_attr "predicable" "yes")
2704 (set_attr "neon_type" "neon_bp_simple")]
2707 (define_expand "neon_vget_lane<mode>"
2708 [(match_operand:<V_ext> 0 "s_register_operand" "")
2709 (match_operand:VDQW 1 "s_register_operand" "")
2710 (match_operand:SI 2 "immediate_operand" "")
2711 (match_operand:SI 3 "immediate_operand" "")]
2714 HOST_WIDE_INT magic = INTVAL (operands[3]);
2717 neon_lane_bounds (operands[2], 0, GET_MODE_NUNITS (<MODE>mode));
2719 if (BYTES_BIG_ENDIAN)
2721 /* The intrinsics are defined in terms of a model where the
2722 element ordering in memory is vldm order, whereas the generic
2723 RTL is defined in terms of a model where the element ordering
2724 in memory is array order. Convert the lane number to conform
2726 unsigned int elt = INTVAL (operands[2]);
2727 unsigned int reg_nelts
2728 = 64 / GET_MODE_BITSIZE (GET_MODE_INNER (<MODE>mode));
2729 elt ^= reg_nelts - 1;
2730 operands[2] = GEN_INT (elt);
2733 if ((magic & 3) == 3 || GET_MODE_BITSIZE (GET_MODE_INNER (<MODE>mode)) == 32)
2734 insn = gen_vec_extract<mode> (operands[0], operands[1], operands[2]);
2737 if ((magic & 1) != 0)
2738 insn = gen_neon_vget_lane<mode>_sext_internal (operands[0], operands[1],
2741 insn = gen_neon_vget_lane<mode>_zext_internal (operands[0], operands[1],
2748 ; Operand 3 (info word) is ignored because it does nothing useful with 64-bit
2751 (define_expand "neon_vget_lanedi"
2752 [(match_operand:DI 0 "s_register_operand" "=r")
2753 (match_operand:DI 1 "s_register_operand" "w")
2754 (match_operand:SI 2 "immediate_operand" "i")
2755 (match_operand:SI 3 "immediate_operand" "i")]
2758 neon_lane_bounds (operands[2], 0, 1);
2759 emit_move_insn (operands[0], operands[1]);
2763 (define_expand "neon_vget_lanev2di"
2764 [(match_operand:DI 0 "s_register_operand" "")
2765 (match_operand:V2DI 1 "s_register_operand" "")
2766 (match_operand:SI 2 "immediate_operand" "")
2767 (match_operand:SI 3 "immediate_operand" "")]
2770 switch (INTVAL (operands[2]))
2773 emit_move_insn (operands[0], gen_lowpart (DImode, operands[1]));
2776 emit_move_insn (operands[0], gen_highpart (DImode, operands[1]));
2779 neon_lane_bounds (operands[2], 0, 1);
2785 (define_expand "neon_vset_lane<mode>"
2786 [(match_operand:VDQ 0 "s_register_operand" "=w")
2787 (match_operand:<V_elem> 1 "s_register_operand" "r")
2788 (match_operand:VDQ 2 "s_register_operand" "0")
2789 (match_operand:SI 3 "immediate_operand" "i")]
2792 unsigned int elt = INTVAL (operands[3]);
2793 neon_lane_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode));
2795 if (BYTES_BIG_ENDIAN)
2797 unsigned int reg_nelts
2798 = 64 / GET_MODE_BITSIZE (GET_MODE_INNER (<MODE>mode));
2799 elt ^= reg_nelts - 1;
2802 emit_insn (gen_vec_set<mode>_internal (operands[0], operands[1],
2803 GEN_INT (1 << elt), operands[2]));
2807 ; See neon_vget_lanedi comment for reasons operands 2 & 3 are ignored.
2809 (define_expand "neon_vset_lanedi"
2810 [(match_operand:DI 0 "s_register_operand" "=w")
2811 (match_operand:DI 1 "s_register_operand" "r")
2812 (match_operand:DI 2 "s_register_operand" "0")
2813 (match_operand:SI 3 "immediate_operand" "i")]
2816 neon_lane_bounds (operands[3], 0, 1);
2817 emit_move_insn (operands[0], operands[1]);
2821 (define_expand "neon_vcreate<mode>"
2822 [(match_operand:VDX 0 "s_register_operand" "")
2823 (match_operand:DI 1 "general_operand" "")]
2826 rtx src = gen_lowpart (<MODE>mode, operands[1]);
2827 emit_move_insn (operands[0], src);
2831 (define_insn "neon_vdup_n<mode>"
2832 [(set (match_operand:VX 0 "s_register_operand" "=w")
2833 (vec_duplicate:VX (match_operand:<V_elem> 1 "s_register_operand" "r")))]
2835 "vdup%?.<V_sz_elem>\t%<V_reg>0, %1"
2836 ;; Assume this schedules like vmov.
2837 [(set_attr "predicable" "yes")
2838 (set_attr "neon_type" "neon_bp_simple")]
2841 (define_insn "neon_vdup_n<mode>"
2842 [(set (match_operand:V32 0 "s_register_operand" "=w,w")
2843 (vec_duplicate:V32 (match_operand:<V_elem> 1 "s_register_operand" "r,t")))]
2846 vdup%?.<V_sz_elem>\t%<V_reg>0, %1
2847 vdup%?.<V_sz_elem>\t%<V_reg>0, %y1"
2848 ;; Assume this schedules like vmov.
2849 [(set_attr "predicable" "yes")
2850 (set_attr "neon_type" "neon_bp_simple")]
2853 (define_expand "neon_vdup_ndi"
2854 [(match_operand:DI 0 "s_register_operand" "=w")
2855 (match_operand:DI 1 "s_register_operand" "r")]
2858 emit_move_insn (operands[0], operands[1]);
2863 (define_insn "neon_vdup_nv2di"
2864 [(set (match_operand:V2DI 0 "s_register_operand" "=w,w")
2865 (vec_duplicate:V2DI (match_operand:DI 1 "s_register_operand" "r,w")))]
2868 vmov%?\t%e0, %Q1, %R1\;vmov%?\t%f0, %Q1, %R1
2869 vmov%?\t%e0, %P1\;vmov%?\t%f0, %P1"
2870 [(set_attr "predicable" "yes")
2871 (set_attr "length" "8")
2872 (set_attr "neon_type" "neon_bp_simple")]
2875 (define_insn "neon_vdup_lane<mode>_internal"
2876 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
2878 (vec_select:<V_elem>
2879 (match_operand:<V_double_vector_mode> 1 "s_register_operand" "w")
2880 (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))]
2883 if (BYTES_BIG_ENDIAN)
2885 int elt = INTVAL (operands[2]);
2886 elt = GET_MODE_NUNITS (<V_double_vector_mode>mode) - 1 - elt;
2887 operands[2] = GEN_INT (elt);
2890 return "vdup.<V_sz_elem>\t%P0, %P1[%c2]";
2892 return "vdup.<V_sz_elem>\t%q0, %P1[%c2]";
2894 ;; Assume this schedules like vmov.
2895 [(set_attr "neon_type" "neon_bp_simple")]
2898 (define_expand "neon_vdup_lane<mode>"
2899 [(match_operand:VDQW 0 "s_register_operand" "=w")
2900 (match_operand:<V_double_vector_mode> 1 "s_register_operand" "w")
2901 (match_operand:SI 2 "immediate_operand" "i")]
2904 neon_lane_bounds (operands[2], 0, GET_MODE_NUNITS (<V_double_vector_mode>mode));
2905 if (BYTES_BIG_ENDIAN)
2907 unsigned int elt = INTVAL (operands[2]);
2908 unsigned int reg_nelts
2909 = 64 / GET_MODE_BITSIZE (GET_MODE_INNER (<V_double_vector_mode>mode));
2910 elt ^= reg_nelts - 1;
2911 operands[2] = GEN_INT (elt);
2913 emit_insn (gen_neon_vdup_lane<mode>_internal (operands[0], operands[1],
2918 ; Scalar index is ignored, since only zero is valid here.
2919 (define_expand "neon_vdup_lanedi"
2920 [(match_operand:DI 0 "s_register_operand" "=w")
2921 (match_operand:DI 1 "s_register_operand" "w")
2922 (match_operand:SI 2 "immediate_operand" "i")]
2925 neon_lane_bounds (operands[2], 0, 1);
2926 emit_move_insn (operands[0], operands[1]);
2930 ; Likewise for v2di, as the DImode second operand has only a single element.
2931 (define_expand "neon_vdup_lanev2di"
2932 [(match_operand:V2DI 0 "s_register_operand" "=w")
2933 (match_operand:DI 1 "s_register_operand" "w")
2934 (match_operand:SI 2 "immediate_operand" "i")]
2937 neon_lane_bounds (operands[2], 0, 1);
2938 emit_insn (gen_neon_vdup_nv2di (operands[0], operands[1]));
2942 ; Disabled before reload because we don't want combine doing something silly,
2943 ; but used by the post-reload expansion of neon_vcombine.
2944 (define_insn "*neon_vswp<mode>"
2945 [(set (match_operand:VDQX 0 "s_register_operand" "+w")
2946 (match_operand:VDQX 1 "s_register_operand" "+w"))
2947 (set (match_dup 1) (match_dup 0))]
2948 "TARGET_NEON && reload_completed"
2949 "vswp\t%<V_reg>0, %<V_reg>1"
2950 [(set (attr "neon_type")
2951 (if_then_else (match_test "<Is_d_reg>")
2952 (const_string "neon_bp_simple")
2953 (const_string "neon_bp_2cycle")))]
2956 ;; In this insn, operand 1 should be low, and operand 2 the high part of the
2958 ;; FIXME: A different implementation of this builtin could make it much
2959 ;; more likely that we wouldn't actually need to output anything (we could make
2960 ;; it so that the reg allocator puts things in the right places magically
2961 ;; instead). Lack of subregs for vectors makes that tricky though, I think.
2963 (define_insn_and_split "neon_vcombine<mode>"
2964 [(set (match_operand:<V_DOUBLE> 0 "s_register_operand" "=w")
2965 (vec_concat:<V_DOUBLE>
2966 (match_operand:VDX 1 "s_register_operand" "w")
2967 (match_operand:VDX 2 "s_register_operand" "w")))]
2970 "&& reload_completed"
2973 neon_split_vcombine (operands);
2977 (define_expand "neon_vget_high<mode>"
2978 [(match_operand:<V_HALF> 0 "s_register_operand")
2979 (match_operand:VQX 1 "s_register_operand")]
2982 emit_move_insn (operands[0],
2983 simplify_gen_subreg (<V_HALF>mode, operands[1], <MODE>mode,
2984 GET_MODE_SIZE (<V_HALF>mode)));
2988 (define_expand "neon_vget_low<mode>"
2989 [(match_operand:<V_HALF> 0 "s_register_operand")
2990 (match_operand:VQX 1 "s_register_operand")]
2993 emit_move_insn (operands[0],
2994 simplify_gen_subreg (<V_HALF>mode, operands[1],
2999 (define_insn "float<mode><V_cvtto>2"
3000 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3001 (float:<V_CVTTO> (match_operand:VCVTI 1 "s_register_operand" "w")))]
3002 "TARGET_NEON && !flag_rounding_math"
3003 "vcvt.f32.s32\t%<V_reg>0, %<V_reg>1"
3004 [(set (attr "neon_type")
3005 (if_then_else (match_test "<Is_d_reg>")
3006 (const_string "neon_fp_vadd_ddd_vabs_dd")
3007 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3010 (define_insn "floatuns<mode><V_cvtto>2"
3011 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3012 (unsigned_float:<V_CVTTO> (match_operand:VCVTI 1 "s_register_operand" "w")))]
3013 "TARGET_NEON && !flag_rounding_math"
3014 "vcvt.f32.u32\t%<V_reg>0, %<V_reg>1"
3015 [(set (attr "neon_type")
3016 (if_then_else (match_test "<Is_d_reg>")
3017 (const_string "neon_fp_vadd_ddd_vabs_dd")
3018 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3021 (define_insn "fix_trunc<mode><V_cvtto>2"
3022 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3023 (fix:<V_CVTTO> (match_operand:VCVTF 1 "s_register_operand" "w")))]
3025 "vcvt.s32.f32\t%<V_reg>0, %<V_reg>1"
3026 [(set (attr "neon_type")
3027 (if_then_else (match_test "<Is_d_reg>")
3028 (const_string "neon_fp_vadd_ddd_vabs_dd")
3029 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3032 (define_insn "fixuns_trunc<mode><V_cvtto>2"
3033 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3034 (unsigned_fix:<V_CVTTO> (match_operand:VCVTF 1 "s_register_operand" "w")))]
3036 "vcvt.u32.f32\t%<V_reg>0, %<V_reg>1"
3037 [(set (attr "neon_type")
3038 (if_then_else (match_test "<Is_d_reg>")
3039 (const_string "neon_fp_vadd_ddd_vabs_dd")
3040 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3043 (define_insn "neon_vcvt<mode>"
3044 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3045 (unspec:<V_CVTTO> [(match_operand:VCVTF 1 "s_register_operand" "w")
3046 (match_operand:SI 2 "immediate_operand" "i")]
3049 "vcvt.%T2%#32.f32\t%<V_reg>0, %<V_reg>1"
3050 [(set (attr "neon_type")
3051 (if_then_else (match_test "<Is_d_reg>")
3052 (const_string "neon_fp_vadd_ddd_vabs_dd")
3053 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3056 (define_insn "neon_vcvt<mode>"
3057 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3058 (unspec:<V_CVTTO> [(match_operand:VCVTI 1 "s_register_operand" "w")
3059 (match_operand:SI 2 "immediate_operand" "i")]
3062 "vcvt.f32.%T2%#32\t%<V_reg>0, %<V_reg>1"
3063 [(set (attr "neon_type")
3064 (if_then_else (match_test "<Is_d_reg>")
3065 (const_string "neon_fp_vadd_ddd_vabs_dd")
3066 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3069 (define_insn "neon_vcvt_n<mode>"
3070 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3071 (unspec:<V_CVTTO> [(match_operand:VCVTF 1 "s_register_operand" "w")
3072 (match_operand:SI 2 "immediate_operand" "i")
3073 (match_operand:SI 3 "immediate_operand" "i")]
3077 neon_const_bounds (operands[2], 1, 33);
3078 return "vcvt.%T3%#32.f32\t%<V_reg>0, %<V_reg>1, %2";
3080 [(set (attr "neon_type")
3081 (if_then_else (match_test "<Is_d_reg>")
3082 (const_string "neon_fp_vadd_ddd_vabs_dd")
3083 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3086 (define_insn "neon_vcvt_n<mode>"
3087 [(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w")
3088 (unspec:<V_CVTTO> [(match_operand:VCVTI 1 "s_register_operand" "w")
3089 (match_operand:SI 2 "immediate_operand" "i")
3090 (match_operand:SI 3 "immediate_operand" "i")]
3094 neon_const_bounds (operands[2], 1, 33);
3095 return "vcvt.f32.%T3%#32\t%<V_reg>0, %<V_reg>1, %2";
3097 [(set (attr "neon_type")
3098 (if_then_else (match_test "<Is_d_reg>")
3099 (const_string "neon_fp_vadd_ddd_vabs_dd")
3100 (const_string "neon_fp_vadd_qqq_vabs_qq")))]
3103 (define_insn "neon_vmovn<mode>"
3104 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
3105 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
3106 (match_operand:SI 2 "immediate_operand" "i")]
3109 "vmovn.<V_if_elem>\t%P0, %q1"
3110 [(set_attr "neon_type" "neon_bp_simple")]
3113 (define_insn "neon_vqmovn<mode>"
3114 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
3115 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
3116 (match_operand:SI 2 "immediate_operand" "i")]
3119 "vqmovn.%T2%#<V_sz_elem>\t%P0, %q1"
3120 [(set_attr "neon_type" "neon_shift_2")]
3123 (define_insn "neon_vqmovun<mode>"
3124 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
3125 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
3126 (match_operand:SI 2 "immediate_operand" "i")]
3129 "vqmovun.<V_s_elem>\t%P0, %q1"
3130 [(set_attr "neon_type" "neon_shift_2")]
3133 (define_insn "neon_vmovl<mode>"
3134 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3135 (unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w")
3136 (match_operand:SI 2 "immediate_operand" "i")]
3139 "vmovl.%T2%#<V_sz_elem>\t%q0, %P1"
3140 [(set_attr "neon_type" "neon_shift_1")]
3143 (define_insn "neon_vmul_lane<mode>"
3144 [(set (match_operand:VMD 0 "s_register_operand" "=w")
3145 (unspec:VMD [(match_operand:VMD 1 "s_register_operand" "w")
3146 (match_operand:VMD 2 "s_register_operand"
3147 "<scalar_mul_constraint>")
3148 (match_operand:SI 3 "immediate_operand" "i")
3149 (match_operand:SI 4 "immediate_operand" "i")]
3153 neon_lane_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode));
3154 return "vmul.<V_if_elem>\t%P0, %P1, %P2[%c3]";
3156 [(set (attr "neon_type")
3157 (if_then_else (match_test "<Is_float_mode>")
3158 (const_string "neon_fp_vmul_ddd")
3159 (if_then_else (match_test "<Scalar_mul_8_16>")
3160 (const_string "neon_mul_ddd_16_scalar_32_16_long_scalar")
3161 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar"))))]
3164 (define_insn "neon_vmul_lane<mode>"
3165 [(set (match_operand:VMQ 0 "s_register_operand" "=w")
3166 (unspec:VMQ [(match_operand:VMQ 1 "s_register_operand" "w")
3167 (match_operand:<V_HALF> 2 "s_register_operand"
3168 "<scalar_mul_constraint>")
3169 (match_operand:SI 3 "immediate_operand" "i")
3170 (match_operand:SI 4 "immediate_operand" "i")]
3174 neon_lane_bounds (operands[3], 0, GET_MODE_NUNITS (<V_HALF>mode));
3175 return "vmul.<V_if_elem>\t%q0, %q1, %P2[%c3]";
3177 [(set (attr "neon_type")
3178 (if_then_else (match_test "<Is_float_mode>")
3179 (const_string "neon_fp_vmul_qqd")
3180 (if_then_else (match_test "<Scalar_mul_8_16>")
3181 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar")
3182 (const_string "neon_mul_qqd_32_scalar"))))]
3185 (define_insn "neon_vmull_lane<mode>"
3186 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3187 (unspec:<V_widen> [(match_operand:VMDI 1 "s_register_operand" "w")
3188 (match_operand:VMDI 2 "s_register_operand"
3189 "<scalar_mul_constraint>")
3190 (match_operand:SI 3 "immediate_operand" "i")
3191 (match_operand:SI 4 "immediate_operand" "i")]
3192 UNSPEC_VMULL_LANE))]
3195 neon_lane_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode));
3196 return "vmull.%T4%#<V_sz_elem>\t%q0, %P1, %P2[%c3]";
3198 [(set (attr "neon_type")
3199 (if_then_else (match_test "<Scalar_mul_8_16>")
3200 (const_string "neon_mul_ddd_16_scalar_32_16_long_scalar")
3201 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar")))]
3204 (define_insn "neon_vqdmull_lane<mode>"
3205 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3206 (unspec:<V_widen> [(match_operand:VMDI 1 "s_register_operand" "w")
3207 (match_operand:VMDI 2 "s_register_operand"
3208 "<scalar_mul_constraint>")
3209 (match_operand:SI 3 "immediate_operand" "i")
3210 (match_operand:SI 4 "immediate_operand" "i")]
3211 UNSPEC_VQDMULL_LANE))]
3214 neon_lane_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode));
3215 return "vqdmull.<V_s_elem>\t%q0, %P1, %P2[%c3]";
3217 [(set (attr "neon_type")
3218 (if_then_else (match_test "<Scalar_mul_8_16>")
3219 (const_string "neon_mul_ddd_16_scalar_32_16_long_scalar")
3220 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar")))]
3223 (define_insn "neon_vqdmulh_lane<mode>"
3224 [(set (match_operand:VMQI 0 "s_register_operand" "=w")
3225 (unspec:VMQI [(match_operand:VMQI 1 "s_register_operand" "w")
3226 (match_operand:<V_HALF> 2 "s_register_operand"
3227 "<scalar_mul_constraint>")
3228 (match_operand:SI 3 "immediate_operand" "i")
3229 (match_operand:SI 4 "immediate_operand" "i")]
3230 UNSPEC_VQDMULH_LANE))]
3233 neon_lane_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode));
3234 return "vq%O4dmulh.%T4%#<V_sz_elem>\t%q0, %q1, %P2[%c3]";
3236 [(set (attr "neon_type")
3237 (if_then_else (match_test "<Scalar_mul_8_16>")
3238 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar")
3239 (const_string "neon_mul_qqd_32_scalar")))]
3242 (define_insn "neon_vqdmulh_lane<mode>"
3243 [(set (match_operand:VMDI 0 "s_register_operand" "=w")
3244 (unspec:VMDI [(match_operand:VMDI 1 "s_register_operand" "w")
3245 (match_operand:VMDI 2 "s_register_operand"
3246 "<scalar_mul_constraint>")
3247 (match_operand:SI 3 "immediate_operand" "i")
3248 (match_operand:SI 4 "immediate_operand" "i")]
3249 UNSPEC_VQDMULH_LANE))]
3252 neon_lane_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode));
3253 return "vq%O4dmulh.%T4%#<V_sz_elem>\t%P0, %P1, %P2[%c3]";
3255 [(set (attr "neon_type")
3256 (if_then_else (match_test "<Scalar_mul_8_16>")
3257 (const_string "neon_mul_ddd_16_scalar_32_16_long_scalar")
3258 (const_string "neon_mul_qdd_64_32_long_qqd_16_ddd_32_scalar_64_32_long_scalar")))]
3261 (define_insn "neon_vmla_lane<mode>"
3262 [(set (match_operand:VMD 0 "s_register_operand" "=w")
3263 (unspec:VMD [(match_operand:VMD 1 "s_register_operand" "0")
3264 (match_operand:VMD 2 "s_register_operand" "w")
3265 (match_operand:VMD 3 "s_register_operand"
3266 "<scalar_mul_constraint>")
3267 (match_operand:SI 4 "immediate_operand" "i")
3268 (match_operand:SI 5 "immediate_operand" "i")]
3272 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3273 return "vmla.<V_if_elem>\t%P0, %P2, %P3[%c4]";
3275 [(set (attr "neon_type")
3276 (if_then_else (match_test "<Is_float_mode>")
3277 (const_string "neon_fp_vmla_ddd_scalar")
3278 (if_then_else (match_test "<Scalar_mul_8_16>")
3279 (const_string "neon_mla_ddd_16_scalar_qdd_32_16_long_scalar")
3280 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))))]
3283 (define_insn "neon_vmla_lane<mode>"
3284 [(set (match_operand:VMQ 0 "s_register_operand" "=w")
3285 (unspec:VMQ [(match_operand:VMQ 1 "s_register_operand" "0")
3286 (match_operand:VMQ 2 "s_register_operand" "w")
3287 (match_operand:<V_HALF> 3 "s_register_operand"
3288 "<scalar_mul_constraint>")
3289 (match_operand:SI 4 "immediate_operand" "i")
3290 (match_operand:SI 5 "immediate_operand" "i")]
3294 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3295 return "vmla.<V_if_elem>\t%q0, %q2, %P3[%c4]";
3297 [(set (attr "neon_type")
3298 (if_then_else (match_test "<Is_float_mode>")
3299 (const_string "neon_fp_vmla_qqq_scalar")
3300 (if_then_else (match_test "<Scalar_mul_8_16>")
3301 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")
3302 (const_string "neon_mla_qqq_32_qqd_32_scalar"))))]
3305 (define_insn "neon_vmlal_lane<mode>"
3306 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3307 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
3308 (match_operand:VMDI 2 "s_register_operand" "w")
3309 (match_operand:VMDI 3 "s_register_operand"
3310 "<scalar_mul_constraint>")
3311 (match_operand:SI 4 "immediate_operand" "i")
3312 (match_operand:SI 5 "immediate_operand" "i")]
3313 UNSPEC_VMLAL_LANE))]
3316 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3317 return "vmlal.%T5%#<V_sz_elem>\t%q0, %P2, %P3[%c4]";
3319 [(set (attr "neon_type")
3320 (if_then_else (match_test "<Scalar_mul_8_16>")
3321 (const_string "neon_mla_ddd_16_scalar_qdd_32_16_long_scalar")
3322 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
3325 (define_insn "neon_vqdmlal_lane<mode>"
3326 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3327 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
3328 (match_operand:VMDI 2 "s_register_operand" "w")
3329 (match_operand:VMDI 3 "s_register_operand"
3330 "<scalar_mul_constraint>")
3331 (match_operand:SI 4 "immediate_operand" "i")
3332 (match_operand:SI 5 "immediate_operand" "i")]
3333 UNSPEC_VQDMLAL_LANE))]
3336 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3337 return "vqdmlal.<V_s_elem>\t%q0, %P2, %P3[%c4]";
3339 [(set (attr "neon_type")
3340 (if_then_else (match_test "<Scalar_mul_8_16>")
3341 (const_string "neon_mla_ddd_16_scalar_qdd_32_16_long_scalar")
3342 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
3345 (define_insn "neon_vmls_lane<mode>"
3346 [(set (match_operand:VMD 0 "s_register_operand" "=w")
3347 (unspec:VMD [(match_operand:VMD 1 "s_register_operand" "0")
3348 (match_operand:VMD 2 "s_register_operand" "w")
3349 (match_operand:VMD 3 "s_register_operand"
3350 "<scalar_mul_constraint>")
3351 (match_operand:SI 4 "immediate_operand" "i")
3352 (match_operand:SI 5 "immediate_operand" "i")]
3356 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3357 return "vmls.<V_if_elem>\t%P0, %P2, %P3[%c4]";
3359 [(set (attr "neon_type")
3360 (if_then_else (match_test "<Is_float_mode>")
3361 (const_string "neon_fp_vmla_ddd_scalar")
3362 (if_then_else (match_test "<Scalar_mul_8_16>")
3363 (const_string "neon_mla_ddd_16_scalar_qdd_32_16_long_scalar")
3364 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long"))))]
3367 (define_insn "neon_vmls_lane<mode>"
3368 [(set (match_operand:VMQ 0 "s_register_operand" "=w")
3369 (unspec:VMQ [(match_operand:VMQ 1 "s_register_operand" "0")
3370 (match_operand:VMQ 2 "s_register_operand" "w")
3371 (match_operand:<V_HALF> 3 "s_register_operand"
3372 "<scalar_mul_constraint>")
3373 (match_operand:SI 4 "immediate_operand" "i")
3374 (match_operand:SI 5 "immediate_operand" "i")]
3378 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3379 return "vmls.<V_if_elem>\t%q0, %q2, %P3[%c4]";
3381 [(set (attr "neon_type")
3382 (if_then_else (match_test "<Is_float_mode>")
3383 (const_string "neon_fp_vmla_qqq_scalar")
3384 (if_then_else (match_test "<Scalar_mul_8_16>")
3385 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")
3386 (const_string "neon_mla_qqq_32_qqd_32_scalar"))))]
3389 (define_insn "neon_vmlsl_lane<mode>"
3390 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3391 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
3392 (match_operand:VMDI 2 "s_register_operand" "w")
3393 (match_operand:VMDI 3 "s_register_operand"
3394 "<scalar_mul_constraint>")
3395 (match_operand:SI 4 "immediate_operand" "i")
3396 (match_operand:SI 5 "immediate_operand" "i")]
3397 UNSPEC_VMLSL_LANE))]
3400 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3401 return "vmlsl.%T5%#<V_sz_elem>\t%q0, %P2, %P3[%c4]";
3403 [(set (attr "neon_type")
3404 (if_then_else (match_test "<Scalar_mul_8_16>")
3405 (const_string "neon_mla_ddd_16_scalar_qdd_32_16_long_scalar")
3406 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
3409 (define_insn "neon_vqdmlsl_lane<mode>"
3410 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3411 (unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0")
3412 (match_operand:VMDI 2 "s_register_operand" "w")
3413 (match_operand:VMDI 3 "s_register_operand"
3414 "<scalar_mul_constraint>")
3415 (match_operand:SI 4 "immediate_operand" "i")
3416 (match_operand:SI 5 "immediate_operand" "i")]
3417 UNSPEC_VQDMLSL_LANE))]
3420 neon_lane_bounds (operands[4], 0, GET_MODE_NUNITS (<MODE>mode));
3421 return "vqdmlsl.<V_s_elem>\t%q0, %P2, %P3[%c4]";
3423 [(set (attr "neon_type")
3424 (if_then_else (match_test "<Scalar_mul_8_16>")
3425 (const_string "neon_mla_ddd_16_scalar_qdd_32_16_long_scalar")
3426 (const_string "neon_mla_ddd_32_qqd_16_ddd_32_scalar_qdd_64_32_long_scalar_qdd_64_32_long")))]
3429 ; FIXME: For the "_n" multiply/multiply-accumulate insns, we copy a value in a
3430 ; core register into a temp register, then use a scalar taken from that. This
3431 ; isn't an optimal solution if e.g. the scalar has just been read from memory
3432 ; or extracted from another vector. The latter case it's currently better to
3433 ; use the "_lane" variant, and the former case can probably be implemented
3434 ; using vld1_lane, but that hasn't been done yet.
3436 (define_expand "neon_vmul_n<mode>"
3437 [(match_operand:VMD 0 "s_register_operand" "")
3438 (match_operand:VMD 1 "s_register_operand" "")
3439 (match_operand:<V_elem> 2 "s_register_operand" "")
3440 (match_operand:SI 3 "immediate_operand" "")]
3443 rtx tmp = gen_reg_rtx (<MODE>mode);
3444 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx));
3445 emit_insn (gen_neon_vmul_lane<mode> (operands[0], operands[1], tmp,
3446 const0_rtx, const0_rtx));
3450 (define_expand "neon_vmul_n<mode>"
3451 [(match_operand:VMQ 0 "s_register_operand" "")
3452 (match_operand:VMQ 1 "s_register_operand" "")
3453 (match_operand:<V_elem> 2 "s_register_operand" "")
3454 (match_operand:SI 3 "immediate_operand" "")]
3457 rtx tmp = gen_reg_rtx (<V_HALF>mode);
3458 emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[2], tmp, const0_rtx));
3459 emit_insn (gen_neon_vmul_lane<mode> (operands[0], operands[1], tmp,
3460 const0_rtx, const0_rtx));
3464 (define_expand "neon_vmull_n<mode>"
3465 [(match_operand:<V_widen> 0 "s_register_operand" "")
3466 (match_operand:VMDI 1 "s_register_operand" "")
3467 (match_operand:<V_elem> 2 "s_register_operand" "")
3468 (match_operand:SI 3 "immediate_operand" "")]
3471 rtx tmp = gen_reg_rtx (<MODE>mode);
3472 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx));
3473 emit_insn (gen_neon_vmull_lane<mode> (operands[0], operands[1], tmp,
3474 const0_rtx, operands[3]));
3478 (define_expand "neon_vqdmull_n<mode>"
3479 [(match_operand:<V_widen> 0 "s_register_operand" "")
3480 (match_operand:VMDI 1 "s_register_operand" "")
3481 (match_operand:<V_elem> 2 "s_register_operand" "")
3482 (match_operand:SI 3 "immediate_operand" "")]
3485 rtx tmp = gen_reg_rtx (<MODE>mode);
3486 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx));
3487 emit_insn (gen_neon_vqdmull_lane<mode> (operands[0], operands[1], tmp,
3488 const0_rtx, const0_rtx));
3492 (define_expand "neon_vqdmulh_n<mode>"
3493 [(match_operand:VMDI 0 "s_register_operand" "")
3494 (match_operand:VMDI 1 "s_register_operand" "")
3495 (match_operand:<V_elem> 2 "s_register_operand" "")
3496 (match_operand:SI 3 "immediate_operand" "")]
3499 rtx tmp = gen_reg_rtx (<MODE>mode);
3500 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx));
3501 emit_insn (gen_neon_vqdmulh_lane<mode> (operands[0], operands[1], tmp,
3502 const0_rtx, operands[3]));
3506 (define_expand "neon_vqdmulh_n<mode>"
3507 [(match_operand:VMQI 0 "s_register_operand" "")
3508 (match_operand:VMQI 1 "s_register_operand" "")
3509 (match_operand:<V_elem> 2 "s_register_operand" "")
3510 (match_operand:SI 3 "immediate_operand" "")]
3513 rtx tmp = gen_reg_rtx (<V_HALF>mode);
3514 emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[2], tmp, const0_rtx));
3515 emit_insn (gen_neon_vqdmulh_lane<mode> (operands[0], operands[1], tmp,
3516 const0_rtx, operands[3]));
3520 (define_expand "neon_vmla_n<mode>"
3521 [(match_operand:VMD 0 "s_register_operand" "")
3522 (match_operand:VMD 1 "s_register_operand" "")
3523 (match_operand:VMD 2 "s_register_operand" "")
3524 (match_operand:<V_elem> 3 "s_register_operand" "")
3525 (match_operand:SI 4 "immediate_operand" "")]
3528 rtx tmp = gen_reg_rtx (<MODE>mode);
3529 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx));
3530 emit_insn (gen_neon_vmla_lane<mode> (operands[0], operands[1], operands[2],
3531 tmp, const0_rtx, operands[4]));
3535 (define_expand "neon_vmla_n<mode>"
3536 [(match_operand:VMQ 0 "s_register_operand" "")
3537 (match_operand:VMQ 1 "s_register_operand" "")
3538 (match_operand:VMQ 2 "s_register_operand" "")
3539 (match_operand:<V_elem> 3 "s_register_operand" "")
3540 (match_operand:SI 4 "immediate_operand" "")]
3543 rtx tmp = gen_reg_rtx (<V_HALF>mode);
3544 emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[3], tmp, const0_rtx));
3545 emit_insn (gen_neon_vmla_lane<mode> (operands[0], operands[1], operands[2],
3546 tmp, const0_rtx, operands[4]));
3550 (define_expand "neon_vmlal_n<mode>"
3551 [(match_operand:<V_widen> 0 "s_register_operand" "")
3552 (match_operand:<V_widen> 1 "s_register_operand" "")
3553 (match_operand:VMDI 2 "s_register_operand" "")
3554 (match_operand:<V_elem> 3 "s_register_operand" "")
3555 (match_operand:SI 4 "immediate_operand" "")]
3558 rtx tmp = gen_reg_rtx (<MODE>mode);
3559 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx));
3560 emit_insn (gen_neon_vmlal_lane<mode> (operands[0], operands[1], operands[2],
3561 tmp, const0_rtx, operands[4]));
3565 (define_expand "neon_vqdmlal_n<mode>"
3566 [(match_operand:<V_widen> 0 "s_register_operand" "")
3567 (match_operand:<V_widen> 1 "s_register_operand" "")
3568 (match_operand:VMDI 2 "s_register_operand" "")
3569 (match_operand:<V_elem> 3 "s_register_operand" "")
3570 (match_operand:SI 4 "immediate_operand" "")]
3573 rtx tmp = gen_reg_rtx (<MODE>mode);
3574 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx));
3575 emit_insn (gen_neon_vqdmlal_lane<mode> (operands[0], operands[1], operands[2],
3576 tmp, const0_rtx, operands[4]));
3580 (define_expand "neon_vmls_n<mode>"
3581 [(match_operand:VMD 0 "s_register_operand" "")
3582 (match_operand:VMD 1 "s_register_operand" "")
3583 (match_operand:VMD 2 "s_register_operand" "")
3584 (match_operand:<V_elem> 3 "s_register_operand" "")
3585 (match_operand:SI 4 "immediate_operand" "")]
3588 rtx tmp = gen_reg_rtx (<MODE>mode);
3589 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx));
3590 emit_insn (gen_neon_vmls_lane<mode> (operands[0], operands[1], operands[2],
3591 tmp, const0_rtx, operands[4]));
3595 (define_expand "neon_vmls_n<mode>"
3596 [(match_operand:VMQ 0 "s_register_operand" "")
3597 (match_operand:VMQ 1 "s_register_operand" "")
3598 (match_operand:VMQ 2 "s_register_operand" "")
3599 (match_operand:<V_elem> 3 "s_register_operand" "")
3600 (match_operand:SI 4 "immediate_operand" "")]
3603 rtx tmp = gen_reg_rtx (<V_HALF>mode);
3604 emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[3], tmp, const0_rtx));
3605 emit_insn (gen_neon_vmls_lane<mode> (operands[0], operands[1], operands[2],
3606 tmp, const0_rtx, operands[4]));
3610 (define_expand "neon_vmlsl_n<mode>"
3611 [(match_operand:<V_widen> 0 "s_register_operand" "")
3612 (match_operand:<V_widen> 1 "s_register_operand" "")
3613 (match_operand:VMDI 2 "s_register_operand" "")
3614 (match_operand:<V_elem> 3 "s_register_operand" "")
3615 (match_operand:SI 4 "immediate_operand" "")]
3618 rtx tmp = gen_reg_rtx (<MODE>mode);
3619 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx));
3620 emit_insn (gen_neon_vmlsl_lane<mode> (operands[0], operands[1], operands[2],
3621 tmp, const0_rtx, operands[4]));
3625 (define_expand "neon_vqdmlsl_n<mode>"
3626 [(match_operand:<V_widen> 0 "s_register_operand" "")
3627 (match_operand:<V_widen> 1 "s_register_operand" "")
3628 (match_operand:VMDI 2 "s_register_operand" "")
3629 (match_operand:<V_elem> 3 "s_register_operand" "")
3630 (match_operand:SI 4 "immediate_operand" "")]
3633 rtx tmp = gen_reg_rtx (<MODE>mode);
3634 emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx));
3635 emit_insn (gen_neon_vqdmlsl_lane<mode> (operands[0], operands[1], operands[2],
3636 tmp, const0_rtx, operands[4]));
3640 (define_insn "neon_vext<mode>"
3641 [(set (match_operand:VDQX 0 "s_register_operand" "=w")
3642 (unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" "w")
3643 (match_operand:VDQX 2 "s_register_operand" "w")
3644 (match_operand:SI 3 "immediate_operand" "i")]
3648 neon_const_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode));
3649 return "vext.<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2, %3";
3651 [(set (attr "neon_type")
3652 (if_then_else (match_test "<Is_d_reg>")
3653 (const_string "neon_bp_simple")
3654 (const_string "neon_bp_2cycle")))]
3657 (define_insn "neon_vrev64<mode>"
3658 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
3659 (unspec:VDQ [(match_operand:VDQ 1 "s_register_operand" "w")
3660 (match_operand:SI 2 "immediate_operand" "i")]
3663 "vrev64.<V_sz_elem>\t%<V_reg>0, %<V_reg>1"
3664 [(set_attr "neon_type" "neon_bp_simple")]
3667 (define_insn "neon_vrev32<mode>"
3668 [(set (match_operand:VX 0 "s_register_operand" "=w")
3669 (unspec:VX [(match_operand:VX 1 "s_register_operand" "w")
3670 (match_operand:SI 2 "immediate_operand" "i")]
3673 "vrev32.<V_sz_elem>\t%<V_reg>0, %<V_reg>1"
3674 [(set_attr "neon_type" "neon_bp_simple")]
3677 (define_insn "neon_vrev16<mode>"
3678 [(set (match_operand:VE 0 "s_register_operand" "=w")
3679 (unspec:VE [(match_operand:VE 1 "s_register_operand" "w")
3680 (match_operand:SI 2 "immediate_operand" "i")]
3683 "vrev16.<V_sz_elem>\t%<V_reg>0, %<V_reg>1"
3684 [(set_attr "neon_type" "neon_bp_simple")]
3687 ; vbsl_* intrinsics may compile to any of vbsl/vbif/vbit depending on register
3688 ; allocation. For an intrinsic of form:
3689 ; rD = vbsl_* (rS, rN, rM)
3690 ; We can use any of:
3691 ; vbsl rS, rN, rM (if D = S)
3692 ; vbit rD, rN, rS (if D = M, so 1-bits in rS choose bits from rN, else rM)
3693 ; vbif rD, rM, rS (if D = N, so 0-bits in rS choose bits from rM, else rN)
3695 (define_insn "neon_vbsl<mode>_internal"
3696 [(set (match_operand:VDQX 0 "s_register_operand" "=w,w,w")
3697 (unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" " 0,w,w")
3698 (match_operand:VDQX 2 "s_register_operand" " w,w,0")
3699 (match_operand:VDQX 3 "s_register_operand" " w,0,w")]
3703 vbsl\t%<V_reg>0, %<V_reg>2, %<V_reg>3
3704 vbit\t%<V_reg>0, %<V_reg>2, %<V_reg>1
3705 vbif\t%<V_reg>0, %<V_reg>3, %<V_reg>1"
3706 [(set_attr "neon_type" "neon_int_1")]
3709 (define_expand "neon_vbsl<mode>"
3710 [(set (match_operand:VDQX 0 "s_register_operand" "")
3711 (unspec:VDQX [(match_operand:<V_cmp_result> 1 "s_register_operand" "")
3712 (match_operand:VDQX 2 "s_register_operand" "")
3713 (match_operand:VDQX 3 "s_register_operand" "")]
3717 /* We can't alias operands together if they have different modes. */
3718 operands[1] = gen_lowpart (<MODE>mode, operands[1]);
3721 (define_insn "neon_vshl<mode>"
3722 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3723 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
3724 (match_operand:VDQIX 2 "s_register_operand" "w")
3725 (match_operand:SI 3 "immediate_operand" "i")]
3728 "v%O3shl.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
3729 [(set (attr "neon_type")
3730 (if_then_else (match_test "<Is_d_reg>")
3731 (const_string "neon_vshl_ddd")
3732 (const_string "neon_shift_3")))]
3735 (define_insn "neon_vqshl<mode>"
3736 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3737 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
3738 (match_operand:VDQIX 2 "s_register_operand" "w")
3739 (match_operand:SI 3 "immediate_operand" "i")]
3742 "vq%O3shl.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
3743 [(set (attr "neon_type")
3744 (if_then_else (match_test "<Is_d_reg>")
3745 (const_string "neon_shift_2")
3746 (const_string "neon_vqshl_vrshl_vqrshl_qqq")))]
3749 (define_insn "neon_vshr_n<mode>"
3750 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3751 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
3752 (match_operand:SI 2 "immediate_operand" "i")
3753 (match_operand:SI 3 "immediate_operand" "i")]
3757 neon_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) + 1);
3758 return "v%O3shr.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %2";
3760 [(set_attr "neon_type" "neon_shift_1")]
3763 (define_insn "neon_vshrn_n<mode>"
3764 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
3765 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
3766 (match_operand:SI 2 "immediate_operand" "i")
3767 (match_operand:SI 3 "immediate_operand" "i")]
3771 neon_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) / 2 + 1);
3772 return "v%O3shrn.<V_if_elem>\t%P0, %q1, %2";
3774 [(set_attr "neon_type" "neon_shift_1")]
3777 (define_insn "neon_vqshrn_n<mode>"
3778 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
3779 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
3780 (match_operand:SI 2 "immediate_operand" "i")
3781 (match_operand:SI 3 "immediate_operand" "i")]
3785 neon_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) / 2 + 1);
3786 return "vq%O3shrn.%T3%#<V_sz_elem>\t%P0, %q1, %2";
3788 [(set_attr "neon_type" "neon_shift_2")]
3791 (define_insn "neon_vqshrun_n<mode>"
3792 [(set (match_operand:<V_narrow> 0 "s_register_operand" "=w")
3793 (unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")
3794 (match_operand:SI 2 "immediate_operand" "i")
3795 (match_operand:SI 3 "immediate_operand" "i")]
3799 neon_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) / 2 + 1);
3800 return "vq%O3shrun.%T3%#<V_sz_elem>\t%P0, %q1, %2";
3802 [(set_attr "neon_type" "neon_shift_2")]
3805 (define_insn "neon_vshl_n<mode>"
3806 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3807 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
3808 (match_operand:SI 2 "immediate_operand" "i")
3809 (match_operand:SI 3 "immediate_operand" "i")]
3813 neon_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode));
3814 return "vshl.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %2";
3816 [(set_attr "neon_type" "neon_shift_1")]
3819 (define_insn "neon_vqshl_n<mode>"
3820 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3821 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
3822 (match_operand:SI 2 "immediate_operand" "i")
3823 (match_operand:SI 3 "immediate_operand" "i")]
3827 neon_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode));
3828 return "vqshl.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %2";
3830 [(set_attr "neon_type" "neon_shift_2")]
3833 (define_insn "neon_vqshlu_n<mode>"
3834 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3835 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w")
3836 (match_operand:SI 2 "immediate_operand" "i")
3837 (match_operand:SI 3 "immediate_operand" "i")]
3841 neon_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode));
3842 return "vqshlu.%T3%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %2";
3844 [(set_attr "neon_type" "neon_shift_2")]
3847 (define_insn "neon_vshll_n<mode>"
3848 [(set (match_operand:<V_widen> 0 "s_register_operand" "=w")
3849 (unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w")
3850 (match_operand:SI 2 "immediate_operand" "i")
3851 (match_operand:SI 3 "immediate_operand" "i")]
3855 /* The boundaries are: 0 < imm <= size. */
3856 neon_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode) + 1);
3857 return "vshll.%T3%#<V_sz_elem>\t%q0, %P1, %2";
3859 [(set_attr "neon_type" "neon_shift_1")]
3862 (define_insn "neon_vsra_n<mode>"
3863 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3864 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "0")
3865 (match_operand:VDQIX 2 "s_register_operand" "w")
3866 (match_operand:SI 3 "immediate_operand" "i")
3867 (match_operand:SI 4 "immediate_operand" "i")]
3871 neon_const_bounds (operands[3], 1, neon_element_bits (<MODE>mode) + 1);
3872 return "v%O4sra.%T4%#<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %3";
3874 [(set_attr "neon_type" "neon_vsra_vrsra")]
3877 (define_insn "neon_vsri_n<mode>"
3878 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3879 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "0")
3880 (match_operand:VDQIX 2 "s_register_operand" "w")
3881 (match_operand:SI 3 "immediate_operand" "i")]
3885 neon_const_bounds (operands[3], 1, neon_element_bits (<MODE>mode) + 1);
3886 return "vsri.<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %3";
3888 [(set (attr "neon_type")
3889 (if_then_else (match_test "<Is_d_reg>")
3890 (const_string "neon_shift_1")
3891 (const_string "neon_shift_3")))]
3894 (define_insn "neon_vsli_n<mode>"
3895 [(set (match_operand:VDQIX 0 "s_register_operand" "=w")
3896 (unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "0")
3897 (match_operand:VDQIX 2 "s_register_operand" "w")
3898 (match_operand:SI 3 "immediate_operand" "i")]
3902 neon_const_bounds (operands[3], 0, neon_element_bits (<MODE>mode));
3903 return "vsli.<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %3";
3905 [(set (attr "neon_type")
3906 (if_then_else (match_test "<Is_d_reg>")
3907 (const_string "neon_shift_1")
3908 (const_string "neon_shift_3")))]
3911 (define_insn "neon_vtbl1v8qi"
3912 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
3913 (unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "w")
3914 (match_operand:V8QI 2 "s_register_operand" "w")]
3917 "vtbl.8\t%P0, {%P1}, %P2"
3918 [(set_attr "neon_type" "neon_bp_2cycle")]
3921 (define_insn "neon_vtbl2v8qi"
3922 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
3923 (unspec:V8QI [(match_operand:TI 1 "s_register_operand" "w")
3924 (match_operand:V8QI 2 "s_register_operand" "w")]
3929 int tabbase = REGNO (operands[1]);
3931 ops[0] = operands[0];
3932 ops[1] = gen_rtx_REG (V8QImode, tabbase);
3933 ops[2] = gen_rtx_REG (V8QImode, tabbase + 2);
3934 ops[3] = operands[2];
3935 output_asm_insn ("vtbl.8\t%P0, {%P1, %P2}, %P3", ops);
3939 [(set_attr "neon_type" "neon_bp_2cycle")]
3942 (define_insn "neon_vtbl3v8qi"
3943 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
3944 (unspec:V8QI [(match_operand:EI 1 "s_register_operand" "w")
3945 (match_operand:V8QI 2 "s_register_operand" "w")]
3950 int tabbase = REGNO (operands[1]);
3952 ops[0] = operands[0];
3953 ops[1] = gen_rtx_REG (V8QImode, tabbase);
3954 ops[2] = gen_rtx_REG (V8QImode, tabbase + 2);
3955 ops[3] = gen_rtx_REG (V8QImode, tabbase + 4);
3956 ops[4] = operands[2];
3957 output_asm_insn ("vtbl.8\t%P0, {%P1, %P2, %P3}, %P4", ops);
3961 [(set_attr "neon_type" "neon_bp_3cycle")]
3964 (define_insn "neon_vtbl4v8qi"
3965 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
3966 (unspec:V8QI [(match_operand:OI 1 "s_register_operand" "w")
3967 (match_operand:V8QI 2 "s_register_operand" "w")]
3972 int tabbase = REGNO (operands[1]);
3974 ops[0] = operands[0];
3975 ops[1] = gen_rtx_REG (V8QImode, tabbase);
3976 ops[2] = gen_rtx_REG (V8QImode, tabbase + 2);
3977 ops[3] = gen_rtx_REG (V8QImode, tabbase + 4);
3978 ops[4] = gen_rtx_REG (V8QImode, tabbase + 6);
3979 ops[5] = operands[2];
3980 output_asm_insn ("vtbl.8\t%P0, {%P1, %P2, %P3, %P4}, %P5", ops);
3984 [(set_attr "neon_type" "neon_bp_3cycle")]
3987 ;; These three are used by the vec_perm infrastructure for V16QImode.
3988 (define_insn_and_split "neon_vtbl1v16qi"
3989 [(set (match_operand:V16QI 0 "s_register_operand" "=&w")
3990 (unspec:V16QI [(match_operand:V16QI 1 "s_register_operand" "w")
3991 (match_operand:V16QI 2 "s_register_operand" "w")]
3995 "&& reload_completed"
3998 rtx op0, op1, op2, part0, part2;
4002 op1 = gen_lowpart (TImode, operands[1]);
4005 ofs = subreg_lowpart_offset (V8QImode, V16QImode);
4006 part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs);
4007 part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs);
4008 emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2));
4010 ofs = subreg_highpart_offset (V8QImode, V16QImode);
4011 part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs);
4012 part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs);
4013 emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2));
4017 (define_insn_and_split "neon_vtbl2v16qi"
4018 [(set (match_operand:V16QI 0 "s_register_operand" "=&w")
4019 (unspec:V16QI [(match_operand:OI 1 "s_register_operand" "w")
4020 (match_operand:V16QI 2 "s_register_operand" "w")]
4024 "&& reload_completed"
4027 rtx op0, op1, op2, part0, part2;
4034 ofs = subreg_lowpart_offset (V8QImode, V16QImode);
4035 part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs);
4036 part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs);
4037 emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2));
4039 ofs = subreg_highpart_offset (V8QImode, V16QImode);
4040 part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs);
4041 part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs);
4042 emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2));
4046 ;; ??? Logically we should extend the regular neon_vcombine pattern to
4047 ;; handle quad-word input modes, producing octa-word output modes. But
4048 ;; that requires us to add support for octa-word vector modes in moves.
4049 ;; That seems overkill for this one use in vec_perm.
4050 (define_insn_and_split "neon_vcombinev16qi"
4051 [(set (match_operand:OI 0 "s_register_operand" "=w")
4052 (unspec:OI [(match_operand:V16QI 1 "s_register_operand" "w")
4053 (match_operand:V16QI 2 "s_register_operand" "w")]
4057 "&& reload_completed"
4060 neon_split_vcombine (operands);
4064 (define_insn "neon_vtbx1v8qi"
4065 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
4066 (unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0")
4067 (match_operand:V8QI 2 "s_register_operand" "w")
4068 (match_operand:V8QI 3 "s_register_operand" "w")]
4071 "vtbx.8\t%P0, {%P2}, %P3"
4072 [(set_attr "neon_type" "neon_bp_2cycle")]
4075 (define_insn "neon_vtbx2v8qi"
4076 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
4077 (unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0")
4078 (match_operand:TI 2 "s_register_operand" "w")
4079 (match_operand:V8QI 3 "s_register_operand" "w")]
4084 int tabbase = REGNO (operands[2]);
4086 ops[0] = operands[0];
4087 ops[1] = gen_rtx_REG (V8QImode, tabbase);
4088 ops[2] = gen_rtx_REG (V8QImode, tabbase + 2);
4089 ops[3] = operands[3];
4090 output_asm_insn ("vtbx.8\t%P0, {%P1, %P2}, %P3", ops);
4094 [(set_attr "neon_type" "neon_bp_2cycle")]
4097 (define_insn "neon_vtbx3v8qi"
4098 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
4099 (unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0")
4100 (match_operand:EI 2 "s_register_operand" "w")
4101 (match_operand:V8QI 3 "s_register_operand" "w")]
4106 int tabbase = REGNO (operands[2]);
4108 ops[0] = operands[0];
4109 ops[1] = gen_rtx_REG (V8QImode, tabbase);
4110 ops[2] = gen_rtx_REG (V8QImode, tabbase + 2);
4111 ops[3] = gen_rtx_REG (V8QImode, tabbase + 4);
4112 ops[4] = operands[3];
4113 output_asm_insn ("vtbx.8\t%P0, {%P1, %P2, %P3}, %P4", ops);
4117 [(set_attr "neon_type" "neon_bp_3cycle")]
4120 (define_insn "neon_vtbx4v8qi"
4121 [(set (match_operand:V8QI 0 "s_register_operand" "=w")
4122 (unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0")
4123 (match_operand:OI 2 "s_register_operand" "w")
4124 (match_operand:V8QI 3 "s_register_operand" "w")]
4129 int tabbase = REGNO (operands[2]);
4131 ops[0] = operands[0];
4132 ops[1] = gen_rtx_REG (V8QImode, tabbase);
4133 ops[2] = gen_rtx_REG (V8QImode, tabbase + 2);
4134 ops[3] = gen_rtx_REG (V8QImode, tabbase + 4);
4135 ops[4] = gen_rtx_REG (V8QImode, tabbase + 6);
4136 ops[5] = operands[3];
4137 output_asm_insn ("vtbx.8\t%P0, {%P1, %P2, %P3, %P4}, %P5", ops);
4141 [(set_attr "neon_type" "neon_bp_3cycle")]
4144 (define_insn "neon_vtrn<mode>_internal"
4145 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
4146 (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")
4147 (match_operand:VDQW 2 "s_register_operand" "w")]
4149 (set (match_operand:VDQW 3 "s_register_operand" "=2")
4150 (unspec:VDQW [(match_dup 1) (match_dup 2)]
4153 "vtrn.<V_sz_elem>\t%<V_reg>0, %<V_reg>3"
4154 [(set (attr "neon_type")
4155 (if_then_else (match_test "<Is_d_reg>")
4156 (const_string "neon_bp_simple")
4157 (const_string "neon_bp_3cycle")))]
4160 (define_expand "neon_vtrn<mode>"
4161 [(match_operand:SI 0 "s_register_operand" "r")
4162 (match_operand:VDQW 1 "s_register_operand" "w")
4163 (match_operand:VDQW 2 "s_register_operand" "w")]
4166 neon_emit_pair_result_insn (<MODE>mode, gen_neon_vtrn<mode>_internal,
4167 operands[0], operands[1], operands[2]);
4171 (define_insn "neon_vzip<mode>_internal"
4172 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
4173 (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")
4174 (match_operand:VDQW 2 "s_register_operand" "w")]
4176 (set (match_operand:VDQW 3 "s_register_operand" "=2")
4177 (unspec:VDQW [(match_dup 1) (match_dup 2)]
4180 "vzip.<V_sz_elem>\t%<V_reg>0, %<V_reg>3"
4181 [(set (attr "neon_type")
4182 (if_then_else (match_test "<Is_d_reg>")
4183 (const_string "neon_bp_simple")
4184 (const_string "neon_bp_3cycle")))]
4187 (define_expand "neon_vzip<mode>"
4188 [(match_operand:SI 0 "s_register_operand" "r")
4189 (match_operand:VDQW 1 "s_register_operand" "w")
4190 (match_operand:VDQW 2 "s_register_operand" "w")]
4193 neon_emit_pair_result_insn (<MODE>mode, gen_neon_vzip<mode>_internal,
4194 operands[0], operands[1], operands[2]);
4198 (define_insn "neon_vuzp<mode>_internal"
4199 [(set (match_operand:VDQW 0 "s_register_operand" "=w")
4200 (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")
4201 (match_operand:VDQW 2 "s_register_operand" "w")]
4203 (set (match_operand:VDQW 3 "s_register_operand" "=2")
4204 (unspec:VDQW [(match_dup 1) (match_dup 2)]
4207 "vuzp.<V_sz_elem>\t%<V_reg>0, %<V_reg>3"
4208 [(set (attr "neon_type")
4209 (if_then_else (match_test "<Is_d_reg>")
4210 (const_string "neon_bp_simple")
4211 (const_string "neon_bp_3cycle")))]
4214 (define_expand "neon_vuzp<mode>"
4215 [(match_operand:SI 0 "s_register_operand" "r")
4216 (match_operand:VDQW 1 "s_register_operand" "w")
4217 (match_operand:VDQW 2 "s_register_operand" "w")]
4220 neon_emit_pair_result_insn (<MODE>mode, gen_neon_vuzp<mode>_internal,
4221 operands[0], operands[1], operands[2]);
4225 (define_expand "neon_vreinterpretv8qi<mode>"
4226 [(match_operand:V8QI 0 "s_register_operand" "")
4227 (match_operand:VDX 1 "s_register_operand" "")]
4230 neon_reinterpret (operands[0], operands[1]);
4234 (define_expand "neon_vreinterpretv4hi<mode>"
4235 [(match_operand:V4HI 0 "s_register_operand" "")
4236 (match_operand:VDX 1 "s_register_operand" "")]
4239 neon_reinterpret (operands[0], operands[1]);
4243 (define_expand "neon_vreinterpretv2si<mode>"
4244 [(match_operand:V2SI 0 "s_register_operand" "")
4245 (match_operand:VDX 1 "s_register_operand" "")]
4248 neon_reinterpret (operands[0], operands[1]);
4252 (define_expand "neon_vreinterpretv2sf<mode>"
4253 [(match_operand:V2SF 0 "s_register_operand" "")
4254 (match_operand:VDX 1 "s_register_operand" "")]
4257 neon_reinterpret (operands[0], operands[1]);
4261 (define_expand "neon_vreinterpretdi<mode>"
4262 [(match_operand:DI 0 "s_register_operand" "")
4263 (match_operand:VDX 1 "s_register_operand" "")]
4266 neon_reinterpret (operands[0], operands[1]);
4270 (define_expand "neon_vreinterpretv16qi<mode>"
4271 [(match_operand:V16QI 0 "s_register_operand" "")
4272 (match_operand:VQX 1 "s_register_operand" "")]
4275 neon_reinterpret (operands[0], operands[1]);
4279 (define_expand "neon_vreinterpretv8hi<mode>"
4280 [(match_operand:V8HI 0 "s_register_operand" "")
4281 (match_operand:VQX 1 "s_register_operand" "")]
4284 neon_reinterpret (operands[0], operands[1]);
4288 (define_expand "neon_vreinterpretv4si<mode>"
4289 [(match_operand:V4SI 0 "s_register_operand" "")
4290 (match_operand:VQX 1 "s_register_operand" "")]
4293 neon_reinterpret (operands[0], operands[1]);
4297 (define_expand "neon_vreinterpretv4sf<mode>"
4298 [(match_operand:V4SF 0 "s_register_operand" "")
4299 (match_operand:VQX 1 "s_register_operand" "")]
4302 neon_reinterpret (operands[0], operands[1]);
4306 (define_expand "neon_vreinterpretv2di<mode>"
4307 [(match_operand:V2DI 0 "s_register_operand" "")
4308 (match_operand:VQX 1 "s_register_operand" "")]
4311 neon_reinterpret (operands[0], operands[1]);
4315 (define_expand "vec_load_lanes<mode><mode>"
4316 [(set (match_operand:VDQX 0 "s_register_operand")
4317 (unspec:VDQX [(match_operand:VDQX 1 "neon_struct_operand")]
4321 (define_insn "neon_vld1<mode>"
4322 [(set (match_operand:VDQX 0 "s_register_operand" "=w")
4323 (unspec:VDQX [(match_operand:VDQX 1 "neon_struct_operand" "Um")]
4326 "vld1.<V_sz_elem>\t%h0, %A1"
4327 [(set_attr "neon_type" "neon_vld1_1_2_regs")]
4330 (define_insn "neon_vld1_lane<mode>"
4331 [(set (match_operand:VDX 0 "s_register_operand" "=w")
4332 (unspec:VDX [(match_operand:<V_elem> 1 "neon_struct_operand" "Um")
4333 (match_operand:VDX 2 "s_register_operand" "0")
4334 (match_operand:SI 3 "immediate_operand" "i")]
4338 HOST_WIDE_INT lane = INTVAL (operands[3]);
4339 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4340 if (lane < 0 || lane >= max)
4341 error ("lane out of range");
4343 return "vld1.<V_sz_elem>\t%P0, %A1";
4345 return "vld1.<V_sz_elem>\t{%P0[%c3]}, %A1";
4347 [(set (attr "neon_type")
4348 (if_then_else (eq (const_string "<V_mode_nunits>") (const_int 2))
4349 (const_string "neon_vld1_1_2_regs")
4350 (const_string "neon_vld1_vld2_lane")))]
4353 (define_insn "neon_vld1_lane<mode>"
4354 [(set (match_operand:VQX 0 "s_register_operand" "=w")
4355 (unspec:VQX [(match_operand:<V_elem> 1 "neon_struct_operand" "Um")
4356 (match_operand:VQX 2 "s_register_operand" "0")
4357 (match_operand:SI 3 "immediate_operand" "i")]
4361 HOST_WIDE_INT lane = INTVAL (operands[3]);
4362 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4363 int regno = REGNO (operands[0]);
4364 if (lane < 0 || lane >= max)
4365 error ("lane out of range");
4366 else if (lane >= max / 2)
4370 operands[3] = GEN_INT (lane);
4372 operands[0] = gen_rtx_REG (<V_HALF>mode, regno);
4374 return "vld1.<V_sz_elem>\t%P0, %A1";
4376 return "vld1.<V_sz_elem>\t{%P0[%c3]}, %A1";
4378 [(set (attr "neon_type")
4379 (if_then_else (eq (const_string "<V_mode_nunits>") (const_int 2))
4380 (const_string "neon_vld1_1_2_regs")
4381 (const_string "neon_vld1_vld2_lane")))]
4384 (define_insn "neon_vld1_dup<mode>"
4385 [(set (match_operand:VDX 0 "s_register_operand" "=w")
4386 (vec_duplicate:VDX (match_operand:<V_elem> 1 "neon_struct_operand" "Um")))]
4389 if (GET_MODE_NUNITS (<MODE>mode) > 1)
4390 return "vld1.<V_sz_elem>\t{%P0[]}, %A1";
4392 return "vld1.<V_sz_elem>\t%h0, %A1";
4394 [(set (attr "neon_type")
4395 (if_then_else (gt (const_string "<V_mode_nunits>") (const_string "1"))
4396 (const_string "neon_vld2_2_regs_vld1_vld2_all_lanes")
4397 (const_string "neon_vld1_1_2_regs")))]
4400 (define_insn "neon_vld1_dup<mode>"
4401 [(set (match_operand:VQ 0 "s_register_operand" "=w")
4402 (vec_duplicate:VQ (match_operand:<V_elem> 1 "neon_struct_operand" "Um")))]
4405 return "vld1.<V_sz_elem>\t{%e0[], %f0[]}, %A1";
4407 [(set_attr "neon_type" "neon_vld2_2_regs_vld1_vld2_all_lanes")]
4410 (define_insn_and_split "neon_vld1_dupv2di"
4411 [(set (match_operand:V2DI 0 "s_register_operand" "=w")
4412 (vec_duplicate:V2DI (match_operand:DI 1 "neon_struct_operand" "Um")))]
4415 "&& reload_completed"
4418 rtx tmprtx = gen_lowpart (DImode, operands[0]);
4419 emit_insn (gen_neon_vld1_dupdi (tmprtx, operands[1]));
4420 emit_move_insn (gen_highpart (DImode, operands[0]), tmprtx );
4423 [(set_attr "length" "8")
4424 (set_attr "neon_type" "neon_vld2_2_regs_vld1_vld2_all_lanes")]
4427 (define_expand "vec_store_lanes<mode><mode>"
4428 [(set (match_operand:VDQX 0 "neon_struct_operand")
4429 (unspec:VDQX [(match_operand:VDQX 1 "s_register_operand")]
4433 (define_insn "neon_vst1<mode>"
4434 [(set (match_operand:VDQX 0 "neon_struct_operand" "=Um")
4435 (unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" "w")]
4438 "vst1.<V_sz_elem>\t%h1, %A0"
4439 [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")])
4441 (define_insn "neon_vst1_lane<mode>"
4442 [(set (match_operand:<V_elem> 0 "neon_struct_operand" "=Um")
4443 (vec_select:<V_elem>
4444 (match_operand:VDX 1 "s_register_operand" "w")
4445 (parallel [(match_operand:SI 2 "neon_lane_number" "i")])))]
4448 HOST_WIDE_INT lane = INTVAL (operands[2]);
4449 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4450 if (lane < 0 || lane >= max)
4451 error ("lane out of range");
4453 return "vst1.<V_sz_elem>\t{%P1}, %A0";
4455 return "vst1.<V_sz_elem>\t{%P1[%c2]}, %A0";
4457 [(set (attr "neon_type")
4458 (if_then_else (eq (const_string "<V_mode_nunits>") (const_int 1))
4459 (const_string "neon_vst1_1_2_regs_vst2_2_regs")
4460 (const_string "neon_vst1_vst2_lane")))])
4462 (define_insn "neon_vst1_lane<mode>"
4463 [(set (match_operand:<V_elem> 0 "neon_struct_operand" "=Um")
4464 (vec_select:<V_elem>
4465 (match_operand:VQX 1 "s_register_operand" "w")
4466 (parallel [(match_operand:SI 2 "neon_lane_number" "i")])))]
4469 HOST_WIDE_INT lane = INTVAL (operands[2]);
4470 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4471 int regno = REGNO (operands[1]);
4472 if (lane < 0 || lane >= max)
4473 error ("lane out of range");
4474 else if (lane >= max / 2)
4478 operands[2] = GEN_INT (lane);
4480 operands[1] = gen_rtx_REG (<V_HALF>mode, regno);
4482 return "vst1.<V_sz_elem>\t{%P1}, %A0";
4484 return "vst1.<V_sz_elem>\t{%P1[%c2]}, %A0";
4486 [(set_attr "neon_type" "neon_vst1_vst2_lane")]
4489 (define_expand "vec_load_lanesti<mode>"
4490 [(set (match_operand:TI 0 "s_register_operand")
4491 (unspec:TI [(match_operand:TI 1 "neon_struct_operand")
4492 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4496 (define_insn "neon_vld2<mode>"
4497 [(set (match_operand:TI 0 "s_register_operand" "=w")
4498 (unspec:TI [(match_operand:TI 1 "neon_struct_operand" "Um")
4499 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4503 if (<V_sz_elem> == 64)
4504 return "vld1.64\t%h0, %A1";
4506 return "vld2.<V_sz_elem>\t%h0, %A1";
4508 [(set (attr "neon_type")
4509 (if_then_else (eq (const_string "<V_sz_elem>") (const_string "64"))
4510 (const_string "neon_vld1_1_2_regs")
4511 (const_string "neon_vld2_2_regs_vld1_vld2_all_lanes")))]
4514 (define_expand "vec_load_lanesoi<mode>"
4515 [(set (match_operand:OI 0 "s_register_operand")
4516 (unspec:OI [(match_operand:OI 1 "neon_struct_operand")
4517 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4521 (define_insn "neon_vld2<mode>"
4522 [(set (match_operand:OI 0 "s_register_operand" "=w")
4523 (unspec:OI [(match_operand:OI 1 "neon_struct_operand" "Um")
4524 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4527 "vld2.<V_sz_elem>\t%h0, %A1"
4528 [(set_attr "neon_type" "neon_vld2_2_regs_vld1_vld2_all_lanes")])
4530 (define_insn "neon_vld2_lane<mode>"
4531 [(set (match_operand:TI 0 "s_register_operand" "=w")
4532 (unspec:TI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um")
4533 (match_operand:TI 2 "s_register_operand" "0")
4534 (match_operand:SI 3 "immediate_operand" "i")
4535 (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4539 HOST_WIDE_INT lane = INTVAL (operands[3]);
4540 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4541 int regno = REGNO (operands[0]);
4543 if (lane < 0 || lane >= max)
4544 error ("lane out of range");
4545 ops[0] = gen_rtx_REG (DImode, regno);
4546 ops[1] = gen_rtx_REG (DImode, regno + 2);
4547 ops[2] = operands[1];
4548 ops[3] = operands[3];
4549 output_asm_insn ("vld2.<V_sz_elem>\t{%P0[%c3], %P1[%c3]}, %A2", ops);
4552 [(set_attr "neon_type" "neon_vld1_vld2_lane")]
4555 (define_insn "neon_vld2_lane<mode>"
4556 [(set (match_operand:OI 0 "s_register_operand" "=w")
4557 (unspec:OI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um")
4558 (match_operand:OI 2 "s_register_operand" "0")
4559 (match_operand:SI 3 "immediate_operand" "i")
4560 (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4564 HOST_WIDE_INT lane = INTVAL (operands[3]);
4565 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4566 int regno = REGNO (operands[0]);
4568 if (lane < 0 || lane >= max)
4569 error ("lane out of range");
4570 else if (lane >= max / 2)
4575 ops[0] = gen_rtx_REG (DImode, regno);
4576 ops[1] = gen_rtx_REG (DImode, regno + 4);
4577 ops[2] = operands[1];
4578 ops[3] = GEN_INT (lane);
4579 output_asm_insn ("vld2.<V_sz_elem>\t{%P0[%c3], %P1[%c3]}, %A2", ops);
4582 [(set_attr "neon_type" "neon_vld1_vld2_lane")]
4585 (define_insn "neon_vld2_dup<mode>"
4586 [(set (match_operand:TI 0 "s_register_operand" "=w")
4587 (unspec:TI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um")
4588 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4592 if (GET_MODE_NUNITS (<MODE>mode) > 1)
4593 return "vld2.<V_sz_elem>\t{%e0[], %f0[]}, %A1";
4595 return "vld1.<V_sz_elem>\t%h0, %A1";
4597 [(set (attr "neon_type")
4598 (if_then_else (gt (const_string "<V_mode_nunits>") (const_string "1"))
4599 (const_string "neon_vld2_2_regs_vld1_vld2_all_lanes")
4600 (const_string "neon_vld1_1_2_regs")))]
4603 (define_expand "vec_store_lanesti<mode>"
4604 [(set (match_operand:TI 0 "neon_struct_operand")
4605 (unspec:TI [(match_operand:TI 1 "s_register_operand")
4606 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4610 (define_insn "neon_vst2<mode>"
4611 [(set (match_operand:TI 0 "neon_struct_operand" "=Um")
4612 (unspec:TI [(match_operand:TI 1 "s_register_operand" "w")
4613 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4617 if (<V_sz_elem> == 64)
4618 return "vst1.64\t%h1, %A0";
4620 return "vst2.<V_sz_elem>\t%h1, %A0";
4622 [(set (attr "neon_type")
4623 (if_then_else (eq (const_string "<V_sz_elem>") (const_string "64"))
4624 (const_string "neon_vst1_1_2_regs_vst2_2_regs")
4625 (const_string "neon_vst1_1_2_regs_vst2_2_regs")))]
4628 (define_expand "vec_store_lanesoi<mode>"
4629 [(set (match_operand:OI 0 "neon_struct_operand")
4630 (unspec:OI [(match_operand:OI 1 "s_register_operand")
4631 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4635 (define_insn "neon_vst2<mode>"
4636 [(set (match_operand:OI 0 "neon_struct_operand" "=Um")
4637 (unspec:OI [(match_operand:OI 1 "s_register_operand" "w")
4638 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4641 "vst2.<V_sz_elem>\t%h1, %A0"
4642 [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")]
4645 (define_insn "neon_vst2_lane<mode>"
4646 [(set (match_operand:<V_two_elem> 0 "neon_struct_operand" "=Um")
4647 (unspec:<V_two_elem>
4648 [(match_operand:TI 1 "s_register_operand" "w")
4649 (match_operand:SI 2 "immediate_operand" "i")
4650 (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4654 HOST_WIDE_INT lane = INTVAL (operands[2]);
4655 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4656 int regno = REGNO (operands[1]);
4658 if (lane < 0 || lane >= max)
4659 error ("lane out of range");
4660 ops[0] = operands[0];
4661 ops[1] = gen_rtx_REG (DImode, regno);
4662 ops[2] = gen_rtx_REG (DImode, regno + 2);
4663 ops[3] = operands[2];
4664 output_asm_insn ("vst2.<V_sz_elem>\t{%P1[%c3], %P2[%c3]}, %A0", ops);
4667 [(set_attr "neon_type" "neon_vst1_vst2_lane")]
4670 (define_insn "neon_vst2_lane<mode>"
4671 [(set (match_operand:<V_two_elem> 0 "neon_struct_operand" "=Um")
4672 (unspec:<V_two_elem>
4673 [(match_operand:OI 1 "s_register_operand" "w")
4674 (match_operand:SI 2 "immediate_operand" "i")
4675 (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4679 HOST_WIDE_INT lane = INTVAL (operands[2]);
4680 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4681 int regno = REGNO (operands[1]);
4683 if (lane < 0 || lane >= max)
4684 error ("lane out of range");
4685 else if (lane >= max / 2)
4690 ops[0] = operands[0];
4691 ops[1] = gen_rtx_REG (DImode, regno);
4692 ops[2] = gen_rtx_REG (DImode, regno + 4);
4693 ops[3] = GEN_INT (lane);
4694 output_asm_insn ("vst2.<V_sz_elem>\t{%P1[%c3], %P2[%c3]}, %A0", ops);
4697 [(set_attr "neon_type" "neon_vst1_vst2_lane")]
4700 (define_expand "vec_load_lanesei<mode>"
4701 [(set (match_operand:EI 0 "s_register_operand")
4702 (unspec:EI [(match_operand:EI 1 "neon_struct_operand")
4703 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4707 (define_insn "neon_vld3<mode>"
4708 [(set (match_operand:EI 0 "s_register_operand" "=w")
4709 (unspec:EI [(match_operand:EI 1 "neon_struct_operand" "Um")
4710 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4714 if (<V_sz_elem> == 64)
4715 return "vld1.64\t%h0, %A1";
4717 return "vld3.<V_sz_elem>\t%h0, %A1";
4719 [(set (attr "neon_type")
4720 (if_then_else (eq (const_string "<V_sz_elem>") (const_string "64"))
4721 (const_string "neon_vld1_1_2_regs")
4722 (const_string "neon_vld3_vld4")))]
4725 (define_expand "vec_load_lanesci<mode>"
4726 [(match_operand:CI 0 "s_register_operand")
4727 (match_operand:CI 1 "neon_struct_operand")
4728 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4731 emit_insn (gen_neon_vld3<mode> (operands[0], operands[1]));
4735 (define_expand "neon_vld3<mode>"
4736 [(match_operand:CI 0 "s_register_operand")
4737 (match_operand:CI 1 "neon_struct_operand")
4738 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4743 mem = adjust_address (operands[1], EImode, 0);
4744 emit_insn (gen_neon_vld3qa<mode> (operands[0], mem));
4745 mem = adjust_address (mem, EImode, GET_MODE_SIZE (EImode));
4746 emit_insn (gen_neon_vld3qb<mode> (operands[0], mem, operands[0]));
4750 (define_insn "neon_vld3qa<mode>"
4751 [(set (match_operand:CI 0 "s_register_operand" "=w")
4752 (unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um")
4753 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4757 int regno = REGNO (operands[0]);
4759 ops[0] = gen_rtx_REG (DImode, regno);
4760 ops[1] = gen_rtx_REG (DImode, regno + 4);
4761 ops[2] = gen_rtx_REG (DImode, regno + 8);
4762 ops[3] = operands[1];
4763 output_asm_insn ("vld3.<V_sz_elem>\t{%P0, %P1, %P2}, %A3", ops);
4766 [(set_attr "neon_type" "neon_vld3_vld4")]
4769 (define_insn "neon_vld3qb<mode>"
4770 [(set (match_operand:CI 0 "s_register_operand" "=w")
4771 (unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um")
4772 (match_operand:CI 2 "s_register_operand" "0")
4773 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4777 int regno = REGNO (operands[0]);
4779 ops[0] = gen_rtx_REG (DImode, regno + 2);
4780 ops[1] = gen_rtx_REG (DImode, regno + 6);
4781 ops[2] = gen_rtx_REG (DImode, regno + 10);
4782 ops[3] = operands[1];
4783 output_asm_insn ("vld3.<V_sz_elem>\t{%P0, %P1, %P2}, %A3", ops);
4786 [(set_attr "neon_type" "neon_vld3_vld4")]
4789 (define_insn "neon_vld3_lane<mode>"
4790 [(set (match_operand:EI 0 "s_register_operand" "=w")
4791 (unspec:EI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um")
4792 (match_operand:EI 2 "s_register_operand" "0")
4793 (match_operand:SI 3 "immediate_operand" "i")
4794 (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4798 HOST_WIDE_INT lane = INTVAL (operands[3]);
4799 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4800 int regno = REGNO (operands[0]);
4802 if (lane < 0 || lane >= max)
4803 error ("lane out of range");
4804 ops[0] = gen_rtx_REG (DImode, regno);
4805 ops[1] = gen_rtx_REG (DImode, regno + 2);
4806 ops[2] = gen_rtx_REG (DImode, regno + 4);
4807 ops[3] = operands[1];
4808 ops[4] = operands[3];
4809 output_asm_insn ("vld3.<V_sz_elem>\t{%P0[%c4], %P1[%c4], %P2[%c4]}, %3",
4813 [(set_attr "neon_type" "neon_vld3_vld4_lane")]
4816 (define_insn "neon_vld3_lane<mode>"
4817 [(set (match_operand:CI 0 "s_register_operand" "=w")
4818 (unspec:CI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um")
4819 (match_operand:CI 2 "s_register_operand" "0")
4820 (match_operand:SI 3 "immediate_operand" "i")
4821 (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4825 HOST_WIDE_INT lane = INTVAL (operands[3]);
4826 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4827 int regno = REGNO (operands[0]);
4829 if (lane < 0 || lane >= max)
4830 error ("lane out of range");
4831 else if (lane >= max / 2)
4836 ops[0] = gen_rtx_REG (DImode, regno);
4837 ops[1] = gen_rtx_REG (DImode, regno + 4);
4838 ops[2] = gen_rtx_REG (DImode, regno + 8);
4839 ops[3] = operands[1];
4840 ops[4] = GEN_INT (lane);
4841 output_asm_insn ("vld3.<V_sz_elem>\t{%P0[%c4], %P1[%c4], %P2[%c4]}, %3",
4845 [(set_attr "neon_type" "neon_vld3_vld4_lane")]
4848 (define_insn "neon_vld3_dup<mode>"
4849 [(set (match_operand:EI 0 "s_register_operand" "=w")
4850 (unspec:EI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um")
4851 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4855 if (GET_MODE_NUNITS (<MODE>mode) > 1)
4857 int regno = REGNO (operands[0]);
4859 ops[0] = gen_rtx_REG (DImode, regno);
4860 ops[1] = gen_rtx_REG (DImode, regno + 2);
4861 ops[2] = gen_rtx_REG (DImode, regno + 4);
4862 ops[3] = operands[1];
4863 output_asm_insn ("vld3.<V_sz_elem>\t{%P0[], %P1[], %P2[]}, %3", ops);
4867 return "vld1.<V_sz_elem>\t%h0, %A1";
4869 [(set (attr "neon_type")
4870 (if_then_else (gt (const_string "<V_mode_nunits>") (const_string "1"))
4871 (const_string "neon_vld3_vld4_all_lanes")
4872 (const_string "neon_vld1_1_2_regs")))])
4874 (define_expand "vec_store_lanesei<mode>"
4875 [(set (match_operand:EI 0 "neon_struct_operand")
4876 (unspec:EI [(match_operand:EI 1 "s_register_operand")
4877 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4881 (define_insn "neon_vst3<mode>"
4882 [(set (match_operand:EI 0 "neon_struct_operand" "=Um")
4883 (unspec:EI [(match_operand:EI 1 "s_register_operand" "w")
4884 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4888 if (<V_sz_elem> == 64)
4889 return "vst1.64\t%h1, %A0";
4891 return "vst3.<V_sz_elem>\t%h1, %A0";
4893 [(set (attr "neon_type")
4894 (if_then_else (eq (const_string "<V_sz_elem>") (const_string "64"))
4895 (const_string "neon_vst1_1_2_regs_vst2_2_regs")
4896 (const_string "neon_vst2_4_regs_vst3_vst4")))])
4898 (define_expand "vec_store_lanesci<mode>"
4899 [(match_operand:CI 0 "neon_struct_operand")
4900 (match_operand:CI 1 "s_register_operand")
4901 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4904 emit_insn (gen_neon_vst3<mode> (operands[0], operands[1]));
4908 (define_expand "neon_vst3<mode>"
4909 [(match_operand:CI 0 "neon_struct_operand")
4910 (match_operand:CI 1 "s_register_operand")
4911 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4916 mem = adjust_address (operands[0], EImode, 0);
4917 emit_insn (gen_neon_vst3qa<mode> (mem, operands[1]));
4918 mem = adjust_address (mem, EImode, GET_MODE_SIZE (EImode));
4919 emit_insn (gen_neon_vst3qb<mode> (mem, operands[1]));
4923 (define_insn "neon_vst3qa<mode>"
4924 [(set (match_operand:EI 0 "neon_struct_operand" "=Um")
4925 (unspec:EI [(match_operand:CI 1 "s_register_operand" "w")
4926 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4930 int regno = REGNO (operands[1]);
4932 ops[0] = operands[0];
4933 ops[1] = gen_rtx_REG (DImode, regno);
4934 ops[2] = gen_rtx_REG (DImode, regno + 4);
4935 ops[3] = gen_rtx_REG (DImode, regno + 8);
4936 output_asm_insn ("vst3.<V_sz_elem>\t{%P1, %P2, %P3}, %A0", ops);
4939 [(set_attr "neon_type" "neon_vst2_4_regs_vst3_vst4")]
4942 (define_insn "neon_vst3qb<mode>"
4943 [(set (match_operand:EI 0 "neon_struct_operand" "=Um")
4944 (unspec:EI [(match_operand:CI 1 "s_register_operand" "w")
4945 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4949 int regno = REGNO (operands[1]);
4951 ops[0] = operands[0];
4952 ops[1] = gen_rtx_REG (DImode, regno + 2);
4953 ops[2] = gen_rtx_REG (DImode, regno + 6);
4954 ops[3] = gen_rtx_REG (DImode, regno + 10);
4955 output_asm_insn ("vst3.<V_sz_elem>\t{%P1, %P2, %P3}, %A0", ops);
4958 [(set_attr "neon_type" "neon_vst2_4_regs_vst3_vst4")]
4961 (define_insn "neon_vst3_lane<mode>"
4962 [(set (match_operand:<V_three_elem> 0 "neon_struct_operand" "=Um")
4963 (unspec:<V_three_elem>
4964 [(match_operand:EI 1 "s_register_operand" "w")
4965 (match_operand:SI 2 "immediate_operand" "i")
4966 (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4970 HOST_WIDE_INT lane = INTVAL (operands[2]);
4971 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4972 int regno = REGNO (operands[1]);
4974 if (lane < 0 || lane >= max)
4975 error ("lane out of range");
4976 ops[0] = operands[0];
4977 ops[1] = gen_rtx_REG (DImode, regno);
4978 ops[2] = gen_rtx_REG (DImode, regno + 2);
4979 ops[3] = gen_rtx_REG (DImode, regno + 4);
4980 ops[4] = operands[2];
4981 output_asm_insn ("vst3.<V_sz_elem>\t{%P1[%c4], %P2[%c4], %P3[%c4]}, %0",
4985 [(set_attr "neon_type" "neon_vst3_vst4_lane")]
4988 (define_insn "neon_vst3_lane<mode>"
4989 [(set (match_operand:<V_three_elem> 0 "neon_struct_operand" "=Um")
4990 (unspec:<V_three_elem>
4991 [(match_operand:CI 1 "s_register_operand" "w")
4992 (match_operand:SI 2 "immediate_operand" "i")
4993 (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
4997 HOST_WIDE_INT lane = INTVAL (operands[2]);
4998 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
4999 int regno = REGNO (operands[1]);
5001 if (lane < 0 || lane >= max)
5002 error ("lane out of range");
5003 else if (lane >= max / 2)
5008 ops[0] = operands[0];
5009 ops[1] = gen_rtx_REG (DImode, regno);
5010 ops[2] = gen_rtx_REG (DImode, regno + 4);
5011 ops[3] = gen_rtx_REG (DImode, regno + 8);
5012 ops[4] = GEN_INT (lane);
5013 output_asm_insn ("vst3.<V_sz_elem>\t{%P1[%c4], %P2[%c4], %P3[%c4]}, %0",
5017 [(set_attr "neon_type" "neon_vst3_vst4_lane")])
5019 (define_expand "vec_load_lanesoi<mode>"
5020 [(set (match_operand:OI 0 "s_register_operand")
5021 (unspec:OI [(match_operand:OI 1 "neon_struct_operand")
5022 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5026 (define_insn "neon_vld4<mode>"
5027 [(set (match_operand:OI 0 "s_register_operand" "=w")
5028 (unspec:OI [(match_operand:OI 1 "neon_struct_operand" "Um")
5029 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5033 if (<V_sz_elem> == 64)
5034 return "vld1.64\t%h0, %A1";
5036 return "vld4.<V_sz_elem>\t%h0, %A1";
5038 [(set (attr "neon_type")
5039 (if_then_else (eq (const_string "<V_sz_elem>") (const_string "64"))
5040 (const_string "neon_vld1_1_2_regs")
5041 (const_string "neon_vld3_vld4")))]
5044 (define_expand "vec_load_lanesxi<mode>"
5045 [(match_operand:XI 0 "s_register_operand")
5046 (match_operand:XI 1 "neon_struct_operand")
5047 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5050 emit_insn (gen_neon_vld4<mode> (operands[0], operands[1]));
5054 (define_expand "neon_vld4<mode>"
5055 [(match_operand:XI 0 "s_register_operand")
5056 (match_operand:XI 1 "neon_struct_operand")
5057 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5062 mem = adjust_address (operands[1], OImode, 0);
5063 emit_insn (gen_neon_vld4qa<mode> (operands[0], mem));
5064 mem = adjust_address (mem, OImode, GET_MODE_SIZE (OImode));
5065 emit_insn (gen_neon_vld4qb<mode> (operands[0], mem, operands[0]));
5069 (define_insn "neon_vld4qa<mode>"
5070 [(set (match_operand:XI 0 "s_register_operand" "=w")
5071 (unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um")
5072 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5076 int regno = REGNO (operands[0]);
5078 ops[0] = gen_rtx_REG (DImode, regno);
5079 ops[1] = gen_rtx_REG (DImode, regno + 4);
5080 ops[2] = gen_rtx_REG (DImode, regno + 8);
5081 ops[3] = gen_rtx_REG (DImode, regno + 12);
5082 ops[4] = operands[1];
5083 output_asm_insn ("vld4.<V_sz_elem>\t{%P0, %P1, %P2, %P3}, %A4", ops);
5086 [(set_attr "neon_type" "neon_vld3_vld4")]
5089 (define_insn "neon_vld4qb<mode>"
5090 [(set (match_operand:XI 0 "s_register_operand" "=w")
5091 (unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um")
5092 (match_operand:XI 2 "s_register_operand" "0")
5093 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5097 int regno = REGNO (operands[0]);
5099 ops[0] = gen_rtx_REG (DImode, regno + 2);
5100 ops[1] = gen_rtx_REG (DImode, regno + 6);
5101 ops[2] = gen_rtx_REG (DImode, regno + 10);
5102 ops[3] = gen_rtx_REG (DImode, regno + 14);
5103 ops[4] = operands[1];
5104 output_asm_insn ("vld4.<V_sz_elem>\t{%P0, %P1, %P2, %P3}, %A4", ops);
5107 [(set_attr "neon_type" "neon_vld3_vld4")]
5110 (define_insn "neon_vld4_lane<mode>"
5111 [(set (match_operand:OI 0 "s_register_operand" "=w")
5112 (unspec:OI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um")
5113 (match_operand:OI 2 "s_register_operand" "0")
5114 (match_operand:SI 3 "immediate_operand" "i")
5115 (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5119 HOST_WIDE_INT lane = INTVAL (operands[3]);
5120 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
5121 int regno = REGNO (operands[0]);
5123 if (lane < 0 || lane >= max)
5124 error ("lane out of range");
5125 ops[0] = gen_rtx_REG (DImode, regno);
5126 ops[1] = gen_rtx_REG (DImode, regno + 2);
5127 ops[2] = gen_rtx_REG (DImode, regno + 4);
5128 ops[3] = gen_rtx_REG (DImode, regno + 6);
5129 ops[4] = operands[1];
5130 ops[5] = operands[3];
5131 output_asm_insn ("vld4.<V_sz_elem>\t{%P0[%c5], %P1[%c5], %P2[%c5], %P3[%c5]}, %A4",
5135 [(set_attr "neon_type" "neon_vld3_vld4_lane")]
5138 (define_insn "neon_vld4_lane<mode>"
5139 [(set (match_operand:XI 0 "s_register_operand" "=w")
5140 (unspec:XI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um")
5141 (match_operand:XI 2 "s_register_operand" "0")
5142 (match_operand:SI 3 "immediate_operand" "i")
5143 (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5147 HOST_WIDE_INT lane = INTVAL (operands[3]);
5148 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
5149 int regno = REGNO (operands[0]);
5151 if (lane < 0 || lane >= max)
5152 error ("lane out of range");
5153 else if (lane >= max / 2)
5158 ops[0] = gen_rtx_REG (DImode, regno);
5159 ops[1] = gen_rtx_REG (DImode, regno + 4);
5160 ops[2] = gen_rtx_REG (DImode, regno + 8);
5161 ops[3] = gen_rtx_REG (DImode, regno + 12);
5162 ops[4] = operands[1];
5163 ops[5] = GEN_INT (lane);
5164 output_asm_insn ("vld4.<V_sz_elem>\t{%P0[%c5], %P1[%c5], %P2[%c5], %P3[%c5]}, %A4",
5168 [(set_attr "neon_type" "neon_vld3_vld4_lane")]
5171 (define_insn "neon_vld4_dup<mode>"
5172 [(set (match_operand:OI 0 "s_register_operand" "=w")
5173 (unspec:OI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um")
5174 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5178 if (GET_MODE_NUNITS (<MODE>mode) > 1)
5180 int regno = REGNO (operands[0]);
5182 ops[0] = gen_rtx_REG (DImode, regno);
5183 ops[1] = gen_rtx_REG (DImode, regno + 2);
5184 ops[2] = gen_rtx_REG (DImode, regno + 4);
5185 ops[3] = gen_rtx_REG (DImode, regno + 6);
5186 ops[4] = operands[1];
5187 output_asm_insn ("vld4.<V_sz_elem>\t{%P0[], %P1[], %P2[], %P3[]}, %A4",
5192 return "vld1.<V_sz_elem>\t%h0, %A1";
5194 [(set (attr "neon_type")
5195 (if_then_else (gt (const_string "<V_mode_nunits>") (const_string "1"))
5196 (const_string "neon_vld3_vld4_all_lanes")
5197 (const_string "neon_vld1_1_2_regs")))]
5200 (define_expand "vec_store_lanesoi<mode>"
5201 [(set (match_operand:OI 0 "neon_struct_operand")
5202 (unspec:OI [(match_operand:OI 1 "s_register_operand")
5203 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5207 (define_insn "neon_vst4<mode>"
5208 [(set (match_operand:OI 0 "neon_struct_operand" "=Um")
5209 (unspec:OI [(match_operand:OI 1 "s_register_operand" "w")
5210 (unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5214 if (<V_sz_elem> == 64)
5215 return "vst1.64\t%h1, %A0";
5217 return "vst4.<V_sz_elem>\t%h1, %A0";
5219 [(set (attr "neon_type")
5220 (if_then_else (eq (const_string "<V_sz_elem>") (const_string "64"))
5221 (const_string "neon_vst1_1_2_regs_vst2_2_regs")
5222 (const_string "neon_vst2_4_regs_vst3_vst4")))]
5225 (define_expand "vec_store_lanesxi<mode>"
5226 [(match_operand:XI 0 "neon_struct_operand")
5227 (match_operand:XI 1 "s_register_operand")
5228 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5231 emit_insn (gen_neon_vst4<mode> (operands[0], operands[1]));
5235 (define_expand "neon_vst4<mode>"
5236 [(match_operand:XI 0 "neon_struct_operand")
5237 (match_operand:XI 1 "s_register_operand")
5238 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5243 mem = adjust_address (operands[0], OImode, 0);
5244 emit_insn (gen_neon_vst4qa<mode> (mem, operands[1]));
5245 mem = adjust_address (mem, OImode, GET_MODE_SIZE (OImode));
5246 emit_insn (gen_neon_vst4qb<mode> (mem, operands[1]));
5250 (define_insn "neon_vst4qa<mode>"
5251 [(set (match_operand:OI 0 "neon_struct_operand" "=Um")
5252 (unspec:OI [(match_operand:XI 1 "s_register_operand" "w")
5253 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5257 int regno = REGNO (operands[1]);
5259 ops[0] = operands[0];
5260 ops[1] = gen_rtx_REG (DImode, regno);
5261 ops[2] = gen_rtx_REG (DImode, regno + 4);
5262 ops[3] = gen_rtx_REG (DImode, regno + 8);
5263 ops[4] = gen_rtx_REG (DImode, regno + 12);
5264 output_asm_insn ("vst4.<V_sz_elem>\t{%P1, %P2, %P3, %P4}, %A0", ops);
5267 [(set_attr "neon_type" "neon_vst2_4_regs_vst3_vst4")]
5270 (define_insn "neon_vst4qb<mode>"
5271 [(set (match_operand:OI 0 "neon_struct_operand" "=Um")
5272 (unspec:OI [(match_operand:XI 1 "s_register_operand" "w")
5273 (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5277 int regno = REGNO (operands[1]);
5279 ops[0] = operands[0];
5280 ops[1] = gen_rtx_REG (DImode, regno + 2);
5281 ops[2] = gen_rtx_REG (DImode, regno + 6);
5282 ops[3] = gen_rtx_REG (DImode, regno + 10);
5283 ops[4] = gen_rtx_REG (DImode, regno + 14);
5284 output_asm_insn ("vst4.<V_sz_elem>\t{%P1, %P2, %P3, %P4}, %A0", ops);
5287 [(set_attr "neon_type" "neon_vst2_4_regs_vst3_vst4")]
5290 (define_insn "neon_vst4_lane<mode>"
5291 [(set (match_operand:<V_four_elem> 0 "neon_struct_operand" "=Um")
5292 (unspec:<V_four_elem>
5293 [(match_operand:OI 1 "s_register_operand" "w")
5294 (match_operand:SI 2 "immediate_operand" "i")
5295 (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5299 HOST_WIDE_INT lane = INTVAL (operands[2]);
5300 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
5301 int regno = REGNO (operands[1]);
5303 if (lane < 0 || lane >= max)
5304 error ("lane out of range");
5305 ops[0] = operands[0];
5306 ops[1] = gen_rtx_REG (DImode, regno);
5307 ops[2] = gen_rtx_REG (DImode, regno + 2);
5308 ops[3] = gen_rtx_REG (DImode, regno + 4);
5309 ops[4] = gen_rtx_REG (DImode, regno + 6);
5310 ops[5] = operands[2];
5311 output_asm_insn ("vst4.<V_sz_elem>\t{%P1[%c5], %P2[%c5], %P3[%c5], %P4[%c5]}, %A0",
5315 [(set_attr "neon_type" "neon_vst3_vst4_lane")]
5318 (define_insn "neon_vst4_lane<mode>"
5319 [(set (match_operand:<V_four_elem> 0 "neon_struct_operand" "=Um")
5320 (unspec:<V_four_elem>
5321 [(match_operand:XI 1 "s_register_operand" "w")
5322 (match_operand:SI 2 "immediate_operand" "i")
5323 (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)]
5327 HOST_WIDE_INT lane = INTVAL (operands[2]);
5328 HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
5329 int regno = REGNO (operands[1]);
5331 if (lane < 0 || lane >= max)
5332 error ("lane out of range");
5333 else if (lane >= max / 2)
5338 ops[0] = operands[0];
5339 ops[1] = gen_rtx_REG (DImode, regno);
5340 ops[2] = gen_rtx_REG (DImode, regno + 4);
5341 ops[3] = gen_rtx_REG (DImode, regno + 8);
5342 ops[4] = gen_rtx_REG (DImode, regno + 12);
5343 ops[5] = GEN_INT (lane);
5344 output_asm_insn ("vst4.<V_sz_elem>\t{%P1[%c5], %P2[%c5], %P3[%c5], %P4[%c5]}, %A0",
5348 [(set_attr "neon_type" "neon_vst3_vst4_lane")]
5351 (define_expand "neon_vand<mode>"
5352 [(match_operand:VDQX 0 "s_register_operand" "")
5353 (match_operand:VDQX 1 "s_register_operand" "")
5354 (match_operand:VDQX 2 "neon_inv_logic_op2" "")
5355 (match_operand:SI 3 "immediate_operand" "")]
5358 emit_insn (gen_and<mode>3<V_suf64> (operands[0], operands[1], operands[2]));
5362 (define_expand "neon_vorr<mode>"
5363 [(match_operand:VDQX 0 "s_register_operand" "")
5364 (match_operand:VDQX 1 "s_register_operand" "")
5365 (match_operand:VDQX 2 "neon_logic_op2" "")
5366 (match_operand:SI 3 "immediate_operand" "")]
5369 emit_insn (gen_ior<mode>3<V_suf64> (operands[0], operands[1], operands[2]));
5373 (define_expand "neon_veor<mode>"
5374 [(match_operand:VDQX 0 "s_register_operand" "")
5375 (match_operand:VDQX 1 "s_register_operand" "")
5376 (match_operand:VDQX 2 "s_register_operand" "")
5377 (match_operand:SI 3 "immediate_operand" "")]
5380 emit_insn (gen_xor<mode>3<V_suf64> (operands[0], operands[1], operands[2]));
5384 (define_expand "neon_vbic<mode>"
5385 [(match_operand:VDQX 0 "s_register_operand" "")
5386 (match_operand:VDQX 1 "s_register_operand" "")
5387 (match_operand:VDQX 2 "neon_logic_op2" "")
5388 (match_operand:SI 3 "immediate_operand" "")]
5391 emit_insn (gen_bic<mode>3_neon (operands[0], operands[1], operands[2]));
5395 (define_expand "neon_vorn<mode>"
5396 [(match_operand:VDQX 0 "s_register_operand" "")
5397 (match_operand:VDQX 1 "s_register_operand" "")
5398 (match_operand:VDQX 2 "neon_inv_logic_op2" "")
5399 (match_operand:SI 3 "immediate_operand" "")]
5402 emit_insn (gen_orn<mode>3_neon (operands[0], operands[1], operands[2]));
5406 (define_insn "neon_vec_unpack<US>_lo_<mode>"
5407 [(set (match_operand:<V_unpack> 0 "register_operand" "=w")
5408 (SE:<V_unpack> (vec_select:<V_HALF>
5409 (match_operand:VU 1 "register_operand" "w")
5410 (match_operand:VU 2 "vect_par_constant_low" ""))))]
5411 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5412 "vmovl.<US><V_sz_elem> %q0, %e1"
5413 [(set_attr "neon_type" "neon_shift_1")]
5416 (define_insn "neon_vec_unpack<US>_hi_<mode>"
5417 [(set (match_operand:<V_unpack> 0 "register_operand" "=w")
5418 (SE:<V_unpack> (vec_select:<V_HALF>
5419 (match_operand:VU 1 "register_operand" "w")
5420 (match_operand:VU 2 "vect_par_constant_high" ""))))]
5421 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5422 "vmovl.<US><V_sz_elem> %q0, %f1"
5423 [(set_attr "neon_type" "neon_shift_1")]
5426 (define_expand "vec_unpack<US>_hi_<mode>"
5427 [(match_operand:<V_unpack> 0 "register_operand" "")
5428 (SE:<V_unpack> (match_operand:VU 1 "register_operand"))]
5429 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5431 rtvec v = rtvec_alloc (<V_mode_nunits>/2) ;
5434 for (i = 0; i < (<V_mode_nunits>/2); i++)
5435 RTVEC_ELT (v, i) = GEN_INT ((<V_mode_nunits>/2) + i);
5437 t1 = gen_rtx_PARALLEL (<MODE>mode, v);
5438 emit_insn (gen_neon_vec_unpack<US>_hi_<mode> (operands[0],
5445 (define_expand "vec_unpack<US>_lo_<mode>"
5446 [(match_operand:<V_unpack> 0 "register_operand" "")
5447 (SE:<V_unpack> (match_operand:VU 1 "register_operand" ""))]
5448 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5450 rtvec v = rtvec_alloc (<V_mode_nunits>/2) ;
5453 for (i = 0; i < (<V_mode_nunits>/2) ; i++)
5454 RTVEC_ELT (v, i) = GEN_INT (i);
5455 t1 = gen_rtx_PARALLEL (<MODE>mode, v);
5456 emit_insn (gen_neon_vec_unpack<US>_lo_<mode> (operands[0],
5463 (define_insn "neon_vec_<US>mult_lo_<mode>"
5464 [(set (match_operand:<V_unpack> 0 "register_operand" "=w")
5465 (mult:<V_unpack> (SE:<V_unpack> (vec_select:<V_HALF>
5466 (match_operand:VU 1 "register_operand" "w")
5467 (match_operand:VU 2 "vect_par_constant_low" "")))
5468 (SE:<V_unpack> (vec_select:<V_HALF>
5469 (match_operand:VU 3 "register_operand" "w")
5471 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5472 "vmull.<US><V_sz_elem> %q0, %e1, %e3"
5473 [(set_attr "neon_type" "neon_shift_1")]
5476 (define_expand "vec_widen_<US>mult_lo_<mode>"
5477 [(match_operand:<V_unpack> 0 "register_operand" "")
5478 (SE:<V_unpack> (match_operand:VU 1 "register_operand" ""))
5479 (SE:<V_unpack> (match_operand:VU 2 "register_operand" ""))]
5480 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5482 rtvec v = rtvec_alloc (<V_mode_nunits>/2) ;
5485 for (i = 0; i < (<V_mode_nunits>/2) ; i++)
5486 RTVEC_ELT (v, i) = GEN_INT (i);
5487 t1 = gen_rtx_PARALLEL (<MODE>mode, v);
5489 emit_insn (gen_neon_vec_<US>mult_lo_<mode> (operands[0],
5497 (define_insn "neon_vec_<US>mult_hi_<mode>"
5498 [(set (match_operand:<V_unpack> 0 "register_operand" "=w")
5499 (mult:<V_unpack> (SE:<V_unpack> (vec_select:<V_HALF>
5500 (match_operand:VU 1 "register_operand" "w")
5501 (match_operand:VU 2 "vect_par_constant_high" "")))
5502 (SE:<V_unpack> (vec_select:<V_HALF>
5503 (match_operand:VU 3 "register_operand" "w")
5505 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5506 "vmull.<US><V_sz_elem> %q0, %f1, %f3"
5507 [(set_attr "neon_type" "neon_shift_1")]
5510 (define_expand "vec_widen_<US>mult_hi_<mode>"
5511 [(match_operand:<V_unpack> 0 "register_operand" "")
5512 (SE:<V_unpack> (match_operand:VU 1 "register_operand" ""))
5513 (SE:<V_unpack> (match_operand:VU 2 "register_operand" ""))]
5514 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5516 rtvec v = rtvec_alloc (<V_mode_nunits>/2) ;
5519 for (i = 0; i < (<V_mode_nunits>/2) ; i++)
5520 RTVEC_ELT (v, i) = GEN_INT (<V_mode_nunits>/2 + i);
5521 t1 = gen_rtx_PARALLEL (<MODE>mode, v);
5523 emit_insn (gen_neon_vec_<US>mult_hi_<mode> (operands[0],
5532 (define_insn "neon_vec_<US>shiftl_<mode>"
5533 [(set (match_operand:<V_widen> 0 "register_operand" "=w")
5534 (SE:<V_widen> (ashift:VW (match_operand:VW 1 "register_operand" "w")
5535 (match_operand:<V_innermode> 2 "const_neon_scalar_shift_amount_operand" ""))))]
5538 return "vshll.<US><V_sz_elem> %q0, %P1, %2";
5540 [(set_attr "neon_type" "neon_shift_1")]
5543 (define_expand "vec_widen_<US>shiftl_lo_<mode>"
5544 [(match_operand:<V_unpack> 0 "register_operand" "")
5545 (SE:<V_unpack> (match_operand:VU 1 "register_operand" ""))
5546 (match_operand:SI 2 "immediate_operand" "i")]
5547 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5549 emit_insn (gen_neon_vec_<US>shiftl_<V_half> (operands[0],
5550 simplify_gen_subreg (<V_HALF>mode, operands[1], <MODE>mode, 0),
5556 (define_expand "vec_widen_<US>shiftl_hi_<mode>"
5557 [(match_operand:<V_unpack> 0 "register_operand" "")
5558 (SE:<V_unpack> (match_operand:VU 1 "register_operand" ""))
5559 (match_operand:SI 2 "immediate_operand" "i")]
5560 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5562 emit_insn (gen_neon_vec_<US>shiftl_<V_half> (operands[0],
5563 simplify_gen_subreg (<V_HALF>mode, operands[1], <MODE>mode,
5564 GET_MODE_SIZE (<V_HALF>mode)),
5570 ;; Vectorize for non-neon-quad case
5571 (define_insn "neon_unpack<US>_<mode>"
5572 [(set (match_operand:<V_widen> 0 "register_operand" "=w")
5573 (SE:<V_widen> (match_operand:VDI 1 "register_operand" "w")))]
5575 "vmovl.<US><V_sz_elem> %q0, %P1"
5576 [(set_attr "neon_type" "neon_shift_1")]
5579 (define_expand "vec_unpack<US>_lo_<mode>"
5580 [(match_operand:<V_double_width> 0 "register_operand" "")
5581 (SE:<V_double_width>(match_operand:VDI 1 "register_operand"))]
5584 rtx tmpreg = gen_reg_rtx (<V_widen>mode);
5585 emit_insn (gen_neon_unpack<US>_<mode> (tmpreg, operands[1]));
5586 emit_insn (gen_neon_vget_low<V_widen_l> (operands[0], tmpreg));
5592 (define_expand "vec_unpack<US>_hi_<mode>"
5593 [(match_operand:<V_double_width> 0 "register_operand" "")
5594 (SE:<V_double_width>(match_operand:VDI 1 "register_operand"))]
5597 rtx tmpreg = gen_reg_rtx (<V_widen>mode);
5598 emit_insn (gen_neon_unpack<US>_<mode> (tmpreg, operands[1]));
5599 emit_insn (gen_neon_vget_high<V_widen_l> (operands[0], tmpreg));
5605 (define_insn "neon_vec_<US>mult_<mode>"
5606 [(set (match_operand:<V_widen> 0 "register_operand" "=w")
5607 (mult:<V_widen> (SE:<V_widen>
5608 (match_operand:VDI 1 "register_operand" "w"))
5610 (match_operand:VDI 2 "register_operand" "w"))))]
5612 "vmull.<US><V_sz_elem> %q0, %P1, %P2"
5613 [(set_attr "neon_type" "neon_shift_1")]
5616 (define_expand "vec_widen_<US>mult_hi_<mode>"
5617 [(match_operand:<V_double_width> 0 "register_operand" "")
5618 (SE:<V_double_width> (match_operand:VDI 1 "register_operand" ""))
5619 (SE:<V_double_width> (match_operand:VDI 2 "register_operand" ""))]
5622 rtx tmpreg = gen_reg_rtx (<V_widen>mode);
5623 emit_insn (gen_neon_vec_<US>mult_<mode> (tmpreg, operands[1], operands[2]));
5624 emit_insn (gen_neon_vget_high<V_widen_l> (operands[0], tmpreg));
5631 (define_expand "vec_widen_<US>mult_lo_<mode>"
5632 [(match_operand:<V_double_width> 0 "register_operand" "")
5633 (SE:<V_double_width> (match_operand:VDI 1 "register_operand" ""))
5634 (SE:<V_double_width> (match_operand:VDI 2 "register_operand" ""))]
5637 rtx tmpreg = gen_reg_rtx (<V_widen>mode);
5638 emit_insn (gen_neon_vec_<US>mult_<mode> (tmpreg, operands[1], operands[2]));
5639 emit_insn (gen_neon_vget_low<V_widen_l> (operands[0], tmpreg));
5646 (define_expand "vec_widen_<US>shiftl_hi_<mode>"
5647 [(match_operand:<V_double_width> 0 "register_operand" "")
5648 (SE:<V_double_width> (match_operand:VDI 1 "register_operand" ""))
5649 (match_operand:SI 2 "immediate_operand" "i")]
5652 rtx tmpreg = gen_reg_rtx (<V_widen>mode);
5653 emit_insn (gen_neon_vec_<US>shiftl_<mode> (tmpreg, operands[1], operands[2]));
5654 emit_insn (gen_neon_vget_high<V_widen_l> (operands[0], tmpreg));
5660 (define_expand "vec_widen_<US>shiftl_lo_<mode>"
5661 [(match_operand:<V_double_width> 0 "register_operand" "")
5662 (SE:<V_double_width> (match_operand:VDI 1 "register_operand" ""))
5663 (match_operand:SI 2 "immediate_operand" "i")]
5666 rtx tmpreg = gen_reg_rtx (<V_widen>mode);
5667 emit_insn (gen_neon_vec_<US>shiftl_<mode> (tmpreg, operands[1], operands[2]));
5668 emit_insn (gen_neon_vget_low<V_widen_l> (operands[0], tmpreg));
5674 ; FIXME: These instruction patterns can't be used safely in big-endian mode
5675 ; because the ordering of vector elements in Q registers is different from what
5676 ; the semantics of the instructions require.
5678 (define_insn "vec_pack_trunc_<mode>"
5679 [(set (match_operand:<V_narrow_pack> 0 "register_operand" "=&w")
5680 (vec_concat:<V_narrow_pack>
5681 (truncate:<V_narrow>
5682 (match_operand:VN 1 "register_operand" "w"))
5683 (truncate:<V_narrow>
5684 (match_operand:VN 2 "register_operand" "w"))))]
5685 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5686 "vmovn.i<V_sz_elem>\t%e0, %q1\;vmovn.i<V_sz_elem>\t%f0, %q2"
5687 [(set_attr "neon_type" "neon_shift_1")
5688 (set_attr "length" "8")]
5691 ;; For the non-quad case.
5692 (define_insn "neon_vec_pack_trunc_<mode>"
5693 [(set (match_operand:<V_narrow> 0 "register_operand" "=w")
5694 (truncate:<V_narrow> (match_operand:VN 1 "register_operand" "w")))]
5695 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5696 "vmovn.i<V_sz_elem>\t%P0, %q1"
5697 [(set_attr "neon_type" "neon_shift_1")]
5700 (define_expand "vec_pack_trunc_<mode>"
5701 [(match_operand:<V_narrow_pack> 0 "register_operand" "")
5702 (match_operand:VSHFT 1 "register_operand" "")
5703 (match_operand:VSHFT 2 "register_operand")]
5704 "TARGET_NEON && !BYTES_BIG_ENDIAN"
5706 rtx tempreg = gen_reg_rtx (<V_DOUBLE>mode);
5708 emit_insn (gen_move_lo_quad_<V_double> (tempreg, operands[1]));
5709 emit_insn (gen_move_hi_quad_<V_double> (tempreg, operands[2]));
5710 emit_insn (gen_neon_vec_pack_trunc_<V_double> (operands[0], tempreg));
5714 (define_insn "neon_vabd<mode>_2"
5715 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
5716 (abs:VDQ (minus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
5717 (match_operand:VDQ 2 "s_register_operand" "w"))))]
5718 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
5719 "vabd.<V_s_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2"
5720 [(set (attr "neon_type")
5721 (if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
5722 (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0))
5723 (const_string "neon_fp_vadd_ddd_vabs_dd")
5724 (const_string "neon_fp_vadd_qqq_vabs_qq"))
5725 (const_string "neon_int_5")))]
5728 (define_insn "neon_vabd<mode>_3"
5729 [(set (match_operand:VDQ 0 "s_register_operand" "=w")
5730 (abs:VDQ (unspec:VDQ [(match_operand:VDQ 1 "s_register_operand" "w")
5731 (match_operand:VDQ 2 "s_register_operand" "w")]
5733 "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
5734 "vabd.<V_if_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2"
5735 [(set (attr "neon_type")
5736 (if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
5737 (if_then_else (ne (symbol_ref "<Is_d_reg>") (const_int 0))
5738 (const_string "neon_fp_vadd_ddd_vabs_dd")
5739 (const_string "neon_fp_vadd_qqq_vabs_qq"))
5740 (const_string "neon_int_5")))]