(set_attr "prefix" "orig,orig,vex,vex")
(set_attr "mode" "TI")])
-(define_expand "avx512f_vinsert<shuffletype>32x4_mask"
- [(match_operand:V16FI 0 "register_operand")
- (match_operand:V16FI 1 "register_operand")
+(define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
+ [(match_operand:AVX512_VEC 0 "register_operand")
+ (match_operand:AVX512_VEC 1 "register_operand")
(match_operand:<ssequartermode> 2 "nonimmediate_operand")
(match_operand:SI 3 "const_0_to_3_operand")
- (match_operand:V16FI 4 "register_operand")
+ (match_operand:AVX512_VEC 4 "register_operand")
(match_operand:<avx512fmaskmode> 5 "register_operand")]
"TARGET_AVX512F"
{
- switch (INTVAL (operands[3]))
- {
- case 0:
- emit_insn (gen_avx512f_vinsert<shuffletype>32x4_1_mask (operands[0],
- operands[1], operands[2], GEN_INT (0xFFF), operands[4],
- operands[5]));
- break;
- case 1:
- emit_insn (gen_avx512f_vinsert<shuffletype>32x4_1_mask (operands[0],
- operands[1], operands[2], GEN_INT (0xF0FF), operands[4],
- operands[5]));
- break;
- case 2:
- emit_insn (gen_avx512f_vinsert<shuffletype>32x4_1_mask (operands[0],
- operands[1], operands[2], GEN_INT (0xFF0F), operands[4],
- operands[5]));
- break;
- case 3:
- emit_insn (gen_avx512f_vinsert<shuffletype>32x4_1_mask (operands[0],
- operands[1], operands[2], GEN_INT (0xFFF0), operands[4],
- operands[5]));
- break;
- default:
- gcc_unreachable ();
- }
+ int mask,selector;
+ mask = INTVAL (operands[3]);
+ selector = GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4 ?
+ 0xFFFF ^ (0xF000 >> mask * 4)
+ : 0xFF ^ (0xC0 >> mask * 2);
+ emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
+ (operands[0], operands[1], operands[2], GEN_INT (selector),
+ operands[4], operands[5]));
DONE;
-
})
-(define_insn "<mask_codefor>avx512f_vinsert<shuffletype>32x4_1<mask_name>"
- [(set (match_operand:V16FI 0 "register_operand" "=v")
- (vec_merge:V16FI
- (match_operand:V16FI 1 "register_operand" "v")
- (vec_duplicate:V16FI
+(define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
+ [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
+ (vec_merge:AVX512_VEC
+ (match_operand:AVX512_VEC 1 "register_operand" "v")
+ (vec_duplicate:AVX512_VEC
(match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
(match_operand:SI 3 "const_int_operand" "n")))]
"TARGET_AVX512F"
{
int mask;
- if (INTVAL (operands[3]) == 0xFFF)
- mask = 0;
- else if ( INTVAL (operands[3]) == 0xF0FF)
- mask = 1;
- else if ( INTVAL (operands[3]) == 0xFF0F)
- mask = 2;
- else if ( INTVAL (operands[3]) == 0xFFF0)
- mask = 3;
+ int selector = INTVAL (operands[3]);
+
+ if (selector == 0xFFF || selector == 0x3F)
+ mask = 0;
+ else if ( selector == 0xF0FF || selector == 0xCF)
+ mask = 1;
+ else if ( selector == 0xFF0F || selector == 0xF3)
+ mask = 2;
+ else if ( selector == 0xFFF0 || selector == 0xFC)
+ mask = 3;
else
gcc_unreachable ();
operands[3] = GEN_INT (mask);
- return "vinsert<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
+ return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
}
[(set_attr "type" "sselog")
(set_attr "length_immediate" "1")
(set_attr "prefix" "evex")
(set_attr "mode" "<sseinsnmode>")])
-(define_expand "avx512f_vinsert<shuffletype>64x4_mask"
- [(match_operand:V8FI 0 "register_operand")
- (match_operand:V8FI 1 "register_operand")
+(define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
+ [(match_operand:AVX512_VEC_2 0 "register_operand")
+ (match_operand:AVX512_VEC_2 1 "register_operand")
(match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
(match_operand:SI 3 "const_0_to_1_operand")
- (match_operand:V8FI 4 "register_operand")
+ (match_operand:AVX512_VEC_2 4 "register_operand")
(match_operand:<avx512fmaskmode> 5 "register_operand")]
"TARGET_AVX512F"
{
DONE;
})
+(define_insn "vec_set_lo_<mode><mask_name>"
+ [(set (match_operand:V16FI 0 "register_operand" "=v")
+ (vec_concat:V16FI
+ (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
+ (vec_select:<ssehalfvecmode>
+ (match_operand:V16FI 1 "register_operand" "v")
+ (parallel [(const_int 8) (const_int 9)
+ (const_int 10) (const_int 11)
+ (const_int 12) (const_int 13)
+ (const_int 14) (const_int 15)]))))]
+ "TARGET_AVX512DQ"
+ "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x0}"
+ [(set_attr "type" "sselog")
+ (set_attr "length_immediate" "1")
+ (set_attr "prefix" "evex")
+ (set_attr "mode" "<sseinsnmode>")])
+
+(define_insn "vec_set_hi_<mode><mask_name>"
+ [(set (match_operand:V16FI 0 "register_operand" "=v")
+ (vec_concat:V16FI
+ (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
+ (vec_select:<ssehalfvecmode>
+ (match_operand:V16FI 1 "register_operand" "v")
+ (parallel [(const_int 0) (const_int 1)
+ (const_int 2) (const_int 3)
+ (const_int 4) (const_int 5)
+ (const_int 6) (const_int 7)]))))]
+ "TARGET_AVX512DQ"
+ "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x1}"
+ [(set_attr "type" "sselog")
+ (set_attr "length_immediate" "1")
+ (set_attr "prefix" "evex")
+ (set_attr "mode" "<sseinsnmode>")])
+
(define_insn "vec_set_lo_<mode><mask_name>"
[(set (match_operand:V8FI 0 "register_operand" "=v")
(vec_concat:V8FI
(set_attr "length_immediate" "1")
(set_attr "prefix" "orig,vex")])
+(define_expand "avx512vl_vinsert<mode>"
+ [(match_operand:VI48F_256 0 "register_operand")
+ (match_operand:VI48F_256 1 "register_operand")
+ (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
+ (match_operand:SI 3 "const_0_to_1_operand")
+ (match_operand:VI48F_256 4 "register_operand")
+ (match_operand:<avx512fmaskmode> 5 "register_operand")]
+ "TARGET_AVX512VL"
+{
+ rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
+
+ switch (INTVAL (operands[3]))
+ {
+ case 0:
+ insn = gen_vec_set_lo_<mode>_mask;
+ break;
+ case 1:
+ insn = gen_vec_set_hi_<mode>_mask;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
+ operands[5]));
+ DONE;
+})
+
(define_expand "avx_vinsertf128<mode>"
[(match_operand:V_256 0 "register_operand")
(match_operand:V_256 1 "register_operand")
DONE;
})
-(define_insn "avx2_vec_set_lo_v4di"
- [(set (match_operand:V4DI 0 "register_operand" "=x")
- (vec_concat:V4DI
- (match_operand:V2DI 2 "nonimmediate_operand" "xm")
- (vec_select:V2DI
- (match_operand:V4DI 1 "register_operand" "x")
- (parallel [(const_int 2) (const_int 3)]))))]
- "TARGET_AVX2"
- "vinserti128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
- [(set_attr "type" "sselog")
- (set_attr "prefix_extra" "1")
- (set_attr "length_immediate" "1")
- (set_attr "prefix" "vex")
- (set_attr "mode" "OI")])
-
-(define_insn "avx2_vec_set_hi_v4di"
- [(set (match_operand:V4DI 0 "register_operand" "=x")
- (vec_concat:V4DI
- (vec_select:V2DI
- (match_operand:V4DI 1 "register_operand" "x")
- (parallel [(const_int 0) (const_int 1)]))
- (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
- "TARGET_AVX2"
- "vinserti128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
- [(set_attr "type" "sselog")
- (set_attr "prefix_extra" "1")
- (set_attr "length_immediate" "1")
- (set_attr "prefix" "vex")
- (set_attr "mode" "OI")])
-
-(define_insn "vec_set_lo_<mode>"
- [(set (match_operand:VI8F_256 0 "register_operand" "=x")
+(define_insn "vec_set_lo_<mode><mask_name>"
+ [(set (match_operand:VI8F_256 0 "register_operand" "=v")
(vec_concat:VI8F_256
- (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "xm")
+ (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
(vec_select:<ssehalfvecmode>
- (match_operand:VI8F_256 1 "register_operand" "x")
+ (match_operand:VI8F_256 1 "register_operand" "v")
(parallel [(const_int 2) (const_int 3)]))))]
"TARGET_AVX"
- "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
+{
+ if (TARGET_AVX512VL)
+ return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
+ else
+ return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
+}
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<sseinsnmode>")])
-(define_insn "vec_set_hi_<mode>"
- [(set (match_operand:VI8F_256 0 "register_operand" "=x")
+(define_insn "vec_set_hi_<mode><mask_name>"
+ [(set (match_operand:VI8F_256 0 "register_operand" "=v")
(vec_concat:VI8F_256
(vec_select:<ssehalfvecmode>
- (match_operand:VI8F_256 1 "register_operand" "x")
+ (match_operand:VI8F_256 1 "register_operand" "v")
(parallel [(const_int 0) (const_int 1)]))
- (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "xm")))]
+ (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
"TARGET_AVX"
- "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
+{
+ if (TARGET_AVX512VL)
+ return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
+ else
+ return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
+}
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<sseinsnmode>")])
-(define_insn "vec_set_lo_<mode>"
- [(set (match_operand:VI4F_256 0 "register_operand" "=x")
+(define_insn "vec_set_lo_<mode><mask_name>"
+ [(set (match_operand:VI4F_256 0 "register_operand" "=v")
(vec_concat:VI4F_256
- (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "xm")
+ (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
(vec_select:<ssehalfvecmode>
- (match_operand:VI4F_256 1 "register_operand" "x")
+ (match_operand:VI4F_256 1 "register_operand" "v")
(parallel [(const_int 4) (const_int 5)
(const_int 6) (const_int 7)]))))]
"TARGET_AVX"
- "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
+{
+ if (TARGET_AVX512VL)
+ return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
+ else
+ return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
+}
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<sseinsnmode>")])
-(define_insn "vec_set_hi_<mode>"
- [(set (match_operand:VI4F_256 0 "register_operand" "=x")
+(define_insn "vec_set_hi_<mode><mask_name>"
+ [(set (match_operand:VI4F_256 0 "register_operand" "=v")
(vec_concat:VI4F_256
(vec_select:<ssehalfvecmode>
- (match_operand:VI4F_256 1 "register_operand" "x")
+ (match_operand:VI4F_256 1 "register_operand" "v")
(parallel [(const_int 0) (const_int 1)
(const_int 2) (const_int 3)]))
- (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "xm")))]
+ (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
"TARGET_AVX"
- "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
+{
+ if (TARGET_AVX512VL)
+ return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
+ else
+ return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
+}
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
DONE;
})
-(define_expand "avx2_extracti128"
- [(match_operand:V2DI 0 "nonimmediate_operand")
- (match_operand:V4DI 1 "register_operand")
- (match_operand:SI 2 "const_0_to_1_operand")]
- "TARGET_AVX2"
-{
- rtx (*insn)(rtx, rtx);
-
- switch (INTVAL (operands[2]))
- {
- case 0:
- insn = gen_vec_extract_lo_v4di;
- break;
- case 1:
- insn = gen_vec_extract_hi_v4di;
- break;
- default:
- gcc_unreachable ();
- }
-
- emit_insn (insn (operands[0], operands[1]));
- DONE;
-})
-
-(define_expand "avx2_inserti128"
- [(match_operand:V4DI 0 "register_operand")
- (match_operand:V4DI 1 "register_operand")
- (match_operand:V2DI 2 "nonimmediate_operand")
- (match_operand:SI 3 "const_0_to_1_operand")]
- "TARGET_AVX2"
-{
- rtx (*insn)(rtx, rtx, rtx);
-
- switch (INTVAL (operands[3]))
- {
- case 0:
- insn = gen_avx2_vec_set_lo_v4di;
- break;
- case 1:
- insn = gen_avx2_vec_set_hi_v4di;
- break;
- default:
- gcc_unreachable ();
- }
-
- emit_insn (insn (operands[0], operands[1], operands[2]));
- DONE;
-})
-
(define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
[(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
(ashiftrt:VI48_AVX512F_AVX512VL