return true;
})
+;; Return true if OP is a parallel for a vbroadcastf128 permute.
+(define_predicate "avx_vbroadcast128_operand"
+ (and (match_code "parallel")
+ (match_code "const_int" "a"))
+{
+ int i, nelt = XVECLEN (op, 0);
+ int half = nelt / 2;
+
+ for (i = 0; i < nelt; ++i)
+ {
+ int index = INTVAL (XVECEXP (op, 0, i));
+ if ((i < half && index != i)
+ || (i >= half && index != (i - half)))
+ return false;
+ }
+
+ return true;
+})
+
;; Return true if OP is a parallel for a palignr permute.
(define_predicate "palignr_operand"
(and (match_code "parallel")
(set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
(set_attr "mode" "<sseinsnmode>")])
+
+(define_insn_and_split "*avx_vbroadcastf128_<mode>_perm"
+ [(set (match_operand:V_256 0 "register_operand")
+ (vec_select:V_256
+ (vec_concat:V_256
+ (match_operand:<ssehalfvecmode> 1 "memory_operand")
+ (match_operand:<ssehalfvecmode> 2 "general_operand"))
+ (match_parallel 3 "avx_vbroadcast128_operand"
+ [(match_operand 4 "const_int_operand")])))]
+ "TARGET_AVX && ix86_pre_reload_split ()"
+ "#"
+ "&& 1"
+ [(set (match_dup 0)
+ (vec_concat: V_256 (match_dup 1) (match_dup 1)))])
+
;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
(define_mode_iterator VI4F_BRCST32x2
[V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=x86-64-v3 -O3" } */
+/* { dg-final { scan-assembler-not "vpermpd"} } */
+/* { dg-final { scan-assembler {(?n)vbroadcastf(?:128|64x2)} } } */
+
+void
+foo (double* __restrict a, double* b, double* c, int n)
+{
+ for (int i = 0; i != n; i+=4)
+ {
+ a[i] += b[i] * c[i];
+ a[i+1] += b[i+1] * c[i+1];
+ a[i+2] += b[i] * c[i+2];
+ a[i+3] += b[i+1] * c[i+3];
+ }
+
+}