Commit 0c7189ae by Jakub Jelinek Committed by Jakub Jelinek

i386.md (UNSPEC_VPERMDI): Remove.

	* config/i386/i386.md (UNSPEC_VPERMDI): Remove.
	* config/i386/i386.c (ix86_expand_vec_perm): Handle
	V16QImode and V32QImode for TARGET_AVX2.
	(MAX_VECT_LEN): Increase to 32.
	(expand_vec_perm_blend): Add support for 32-byte integer
	vectors with TARGET_AVX2.
	(valid_perm_using_mode_p): New function.
	(expand_vec_perm_pshufb): Add support for 32-byte integer
	vectors with TARGET_AVX2.
	(expand_vec_perm_vpshufb2_vpermq): New function.
	(expand_vec_perm_vpshufb2_vpermq_even_odd): New function.
	(expand_vec_perm_even_odd_1): Handle 32-byte integer vectors
	with TARGET_AVX2.
	(ix86_expand_vec_perm_builtin_1): Try expand_vec_perm_vpshufb2_vpermq
	and expand_vec_perm_vpshufb2_vpermq_even_odd.
	* config/i386/sse.md (VEC_EXTRACT_EVENODD_MODE): Add for TARGET_AVX2
	32-byte integer vector modes.
	(vec_pack_trunc_<mode>): Use VI248_AVX2 instead of VI248_128.
	(avx2_interleave_highv32qi, avx2_interleave_lowv32qi): Remove pasto.
	(avx2_pshufdv3, avx2_pshuflwv3, avx2_pshufhwv3): Generate
	4 new operands.
	(avx2_pshufd_1, avx2_pshuflw_1, avx2_pshufhw_1): Don't use
	match_dup, instead add 4 new operands and require they have
	right cross-lane values.
	(avx2_permv4di): Change into define_expand.
	(avx2_permv4di_1): New instruction.
	(avx2_permv2ti): Use nonimmediate_operand instead of register_operand
	for "xm" constrained operand.
	(VEC_PERM_AVX2): Add V32QI and V16QI for TARGET_AVX2.

From-SVN: r179870
parent 9d901b0e
2011-10-12 Jakub Jelinek <jakub@redhat.com> 2011-10-12 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.md (UNSPEC_VPERMDI): Remove.
* config/i386/i386.c (ix86_expand_vec_perm): Handle
V16QImode and V32QImode for TARGET_AVX2.
(MAX_VECT_LEN): Increase to 32.
(expand_vec_perm_blend): Add support for 32-byte integer
vectors with TARGET_AVX2.
(valid_perm_using_mode_p): New function.
(expand_vec_perm_pshufb): Add support for 32-byte integer
vectors with TARGET_AVX2.
(expand_vec_perm_vpshufb2_vpermq): New function.
(expand_vec_perm_vpshufb2_vpermq_even_odd): New function.
(expand_vec_perm_even_odd_1): Handle 32-byte integer vectors
with TARGET_AVX2.
(ix86_expand_vec_perm_builtin_1): Try expand_vec_perm_vpshufb2_vpermq
and expand_vec_perm_vpshufb2_vpermq_even_odd.
* config/i386/sse.md (VEC_EXTRACT_EVENODD_MODE): Add for TARGET_AVX2
32-byte integer vector modes.
(vec_pack_trunc_<mode>): Use VI248_AVX2 instead of VI248_128.
(avx2_interleave_highv32qi, avx2_interleave_lowv32qi): Remove pasto.
(avx2_pshufdv3, avx2_pshuflwv3, avx2_pshufhwv3): Generate
4 new operands.
(avx2_pshufd_1, avx2_pshuflw_1, avx2_pshufhw_1): Don't use
match_dup, instead add 4 new operands and require they have
right cross-lane values.
(avx2_permv4di): Change into define_expand.
(avx2_permv4di_1): New instruction.
(avx2_permv2ti): Use nonimmediate_operand instead of register_operand
for "xm" constrained operand.
(VEC_PERM_AVX2): Add V32QI and V16QI for TARGET_AVX2.
* config/i386/sse.md (avx2_gathersi<mode>, * config/i386/sse.md (avx2_gathersi<mode>,
avx2_gatherdi<mode>, avx2_gatherdi<mode>256): Add clobber of avx2_gatherdi<mode>, avx2_gatherdi<mode>256): Add clobber of
match_scratch, change memory_operand to register_operand, match_scratch, change memory_operand to register_operand,
...@@ -235,7 +235,6 @@ ...@@ -235,7 +235,6 @@
UNSPEC_VPERMSI UNSPEC_VPERMSI
UNSPEC_VPERMDF UNSPEC_VPERMDF
UNSPEC_VPERMSF UNSPEC_VPERMSF
UNSPEC_VPERMDI
UNSPEC_VPERMTI UNSPEC_VPERMTI
UNSPEC_GATHER UNSPEC_GATHER
......
...@@ -4330,10 +4330,10 @@ ...@@ -4330,10 +4330,10 @@
;; Modes handled by vec_extract_even/odd pattern. ;; Modes handled by vec_extract_even/odd pattern.
(define_mode_iterator VEC_EXTRACT_EVENODD_MODE (define_mode_iterator VEC_EXTRACT_EVENODD_MODE
[(V16QI "TARGET_SSE2") [(V32QI "TARGET_AVX2") (V16QI "TARGET_SSE2")
(V8HI "TARGET_SSE2") (V16HI "TARGET_AVX2") (V8HI "TARGET_SSE2")
(V4SI "TARGET_SSE2") (V8SI "TARGET_AVX2") (V4SI "TARGET_SSE2")
(V2DI "TARGET_SSE2") (V4DI "TARGET_AVX2") (V2DI "TARGET_SSE2")
(V8SF "TARGET_AVX") V4SF (V8SF "TARGET_AVX") V4SF
(V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")]) (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
...@@ -6196,11 +6196,9 @@ ...@@ -6196,11 +6196,9 @@
DONE; DONE;
}) })
;; ??? Irritatingly, the 256-bit VPSHUFB only shuffles within the 128-bit
;; lanes. For now, we don't try to support V32QI or V16HImode. So we
;; don't want to use VI_AVX2.
(define_mode_iterator VEC_PERM_AVX2 (define_mode_iterator VEC_PERM_AVX2
[V16QI V8HI V4SI V2DI V4SF V2DF [V16QI V8HI V4SI V2DI V4SF V2DF
(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
(V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2") (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
(V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")]) (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")])
...@@ -6431,8 +6429,8 @@ ...@@ -6431,8 +6429,8 @@
(define_expand "vec_pack_trunc_<mode>" (define_expand "vec_pack_trunc_<mode>"
[(match_operand:<ssepackmode> 0 "register_operand" "") [(match_operand:<ssepackmode> 0 "register_operand" "")
(match_operand:VI248_128 1 "register_operand" "") (match_operand:VI248_AVX2 1 "register_operand" "")
(match_operand:VI248_128 2 "register_operand" "")] (match_operand:VI248_AVX2 2 "register_operand" "")]
"TARGET_SSE2" "TARGET_SSE2"
{ {
rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]); rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
...@@ -6513,8 +6511,7 @@ ...@@ -6513,8 +6511,7 @@
(const_int 28) (const_int 60) (const_int 28) (const_int 60)
(const_int 29) (const_int 61) (const_int 29) (const_int 61)
(const_int 30) (const_int 62) (const_int 30) (const_int 62)
(const_int 31) (const_int 63) (const_int 31) (const_int 63)])))]
(const_int 32) (const_int 64)])))]
"TARGET_AVX2" "TARGET_AVX2"
"vpunpckhbw\t{%2, %1, %0|%0, %1, %2}" "vpunpckhbw\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sselog") [(set_attr "type" "sselog")
...@@ -6559,7 +6556,6 @@ ...@@ -6559,7 +6556,6 @@
(const_int 5) (const_int 37) (const_int 5) (const_int 37)
(const_int 6) (const_int 38) (const_int 6) (const_int 38)
(const_int 7) (const_int 39) (const_int 7) (const_int 39)
(const_int 15) (const_int 47)
(const_int 16) (const_int 48) (const_int 16) (const_int 48)
(const_int 17) (const_int 49) (const_int 17) (const_int 49)
(const_int 18) (const_int 50) (const_int 18) (const_int 50)
...@@ -6919,7 +6915,11 @@ ...@@ -6919,7 +6915,11 @@
GEN_INT ((mask >> 0) & 3), GEN_INT ((mask >> 0) & 3),
GEN_INT ((mask >> 2) & 3), GEN_INT ((mask >> 2) & 3),
GEN_INT ((mask >> 4) & 3), GEN_INT ((mask >> 4) & 3),
GEN_INT ((mask >> 6) & 3))); GEN_INT ((mask >> 6) & 3),
GEN_INT (((mask >> 0) & 3) + 4),
GEN_INT (((mask >> 2) & 3) + 4),
GEN_INT (((mask >> 4) & 3) + 4),
GEN_INT (((mask >> 6) & 3) + 4)));
DONE; DONE;
}) })
...@@ -6931,11 +6931,15 @@ ...@@ -6931,11 +6931,15 @@
(match_operand 3 "const_0_to_3_operand" "") (match_operand 3 "const_0_to_3_operand" "")
(match_operand 4 "const_0_to_3_operand" "") (match_operand 4 "const_0_to_3_operand" "")
(match_operand 5 "const_0_to_3_operand" "") (match_operand 5 "const_0_to_3_operand" "")
(match_dup 2) (match_operand 6 "const_4_to_7_operand" "")
(match_dup 3) (match_operand 7 "const_4_to_7_operand" "")
(match_dup 4) (match_operand 8 "const_4_to_7_operand" "")
(match_dup 5)])))] (match_operand 9 "const_4_to_7_operand" "")])))]
"TARGET_AVX2" "TARGET_AVX2
&& INTVAL (operands[2]) + 4 == INTVAL (operands[6])
&& INTVAL (operands[3]) + 4 == INTVAL (operands[7])
&& INTVAL (operands[4]) + 4 == INTVAL (operands[8])
&& INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
{ {
int mask = 0; int mask = 0;
mask |= INTVAL (operands[2]) << 0; mask |= INTVAL (operands[2]) << 0;
...@@ -7002,7 +7006,11 @@ ...@@ -7002,7 +7006,11 @@
GEN_INT ((mask >> 0) & 3), GEN_INT ((mask >> 0) & 3),
GEN_INT ((mask >> 2) & 3), GEN_INT ((mask >> 2) & 3),
GEN_INT ((mask >> 4) & 3), GEN_INT ((mask >> 4) & 3),
GEN_INT ((mask >> 6) & 3))); GEN_INT ((mask >> 6) & 3),
GEN_INT (((mask >> 0) & 3) + 8),
GEN_INT (((mask >> 2) & 3) + 8),
GEN_INT (((mask >> 4) & 3) + 8),
GEN_INT (((mask >> 6) & 3) + 8)));
DONE; DONE;
}) })
...@@ -7018,15 +7026,19 @@ ...@@ -7018,15 +7026,19 @@
(const_int 5) (const_int 5)
(const_int 6) (const_int 6)
(const_int 7) (const_int 7)
(match_dup 2) (match_operand 6 "const_8_to_11_operand" "")
(match_dup 3) (match_operand 7 "const_8_to_11_operand" "")
(match_dup 4) (match_operand 8 "const_8_to_11_operand" "")
(match_dup 5) (match_operand 9 "const_8_to_11_operand" "")
(const_int 12) (const_int 12)
(const_int 13) (const_int 13)
(const_int 14) (const_int 14)
(const_int 15)])))] (const_int 15)])))]
"TARGET_AVX2" "TARGET_AVX2
&& INTVAL (operands[2]) + 8 == INTVAL (operands[6])
&& INTVAL (operands[3]) + 8 == INTVAL (operands[7])
&& INTVAL (operands[4]) + 8 == INTVAL (operands[8])
&& INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
{ {
int mask = 0; int mask = 0;
mask |= INTVAL (operands[2]) << 0; mask |= INTVAL (operands[2]) << 0;
...@@ -7098,7 +7110,11 @@ ...@@ -7098,7 +7110,11 @@
GEN_INT (((mask >> 0) & 3) + 4), GEN_INT (((mask >> 0) & 3) + 4),
GEN_INT (((mask >> 2) & 3) + 4), GEN_INT (((mask >> 2) & 3) + 4),
GEN_INT (((mask >> 4) & 3) + 4), GEN_INT (((mask >> 4) & 3) + 4),
GEN_INT (((mask >> 6) & 3) + 4))); GEN_INT (((mask >> 6) & 3) + 4),
GEN_INT (((mask >> 0) & 3) + 12),
GEN_INT (((mask >> 2) & 3) + 12),
GEN_INT (((mask >> 4) & 3) + 12),
GEN_INT (((mask >> 6) & 3) + 12)));
DONE; DONE;
}) })
...@@ -7118,11 +7134,15 @@ ...@@ -7118,11 +7134,15 @@
(const_int 9) (const_int 9)
(const_int 10) (const_int 10)
(const_int 11) (const_int 11)
(match_dup 2) (match_operand 6 "const_12_to_15_operand" "")
(match_dup 3) (match_operand 7 "const_12_to_15_operand" "")
(match_dup 4) (match_operand 8 "const_12_to_15_operand" "")
(match_dup 5)])))] (match_operand 9 "const_12_to_15_operand" "")])))]
"TARGET_AVX2" "TARGET_AVX2
&& INTVAL (operands[2]) + 8 == INTVAL (operands[6])
&& INTVAL (operands[3]) + 8 == INTVAL (operands[7])
&& INTVAL (operands[4]) + 8 == INTVAL (operands[8])
&& INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
{ {
int mask = 0; int mask = 0;
mask |= (INTVAL (operands[2]) - 4) << 0; mask |= (INTVAL (operands[2]) - 4) << 0;
...@@ -11526,14 +11546,39 @@ ...@@ -11526,14 +11546,39 @@
(set_attr "prefix" "vex") (set_attr "prefix" "vex")
(set_attr "mode" "OI")]) (set_attr "mode" "OI")])
(define_insn "avx2_permv4di" (define_expand "avx2_permv4di"
[(match_operand:V4DI 0 "register_operand" "")
(match_operand:V4DI 1 "nonimmediate_operand" "")
(match_operand:SI 2 "const_0_to_255_operand" "")]
"TARGET_AVX2"
{
int mask = INTVAL (operands[2]);
emit_insn (gen_avx2_permv4di_1 (operands[0], operands[1],
GEN_INT ((mask >> 0) & 3),
GEN_INT ((mask >> 2) & 3),
GEN_INT ((mask >> 4) & 3),
GEN_INT ((mask >> 6) & 3)));
DONE;
})
(define_insn "avx2_permv4di_1"
[(set (match_operand:V4DI 0 "register_operand" "=x") [(set (match_operand:V4DI 0 "register_operand" "=x")
(unspec:V4DI (vec_select:V4DI
[(match_operand:V4DI 1 "register_operand" "xm") (match_operand:V4DI 1 "nonimmediate_operand" "xm")
(match_operand:SI 2 "const_0_to_255_operand" "n")] (parallel [(match_operand 2 "const_0_to_3_operand" "")
UNSPEC_VPERMDI))] (match_operand 3 "const_0_to_3_operand" "")
(match_operand 4 "const_0_to_3_operand" "")
(match_operand 5 "const_0_to_3_operand" "")])))]
"TARGET_AVX2" "TARGET_AVX2"
"vpermq\t{%2, %1, %0|%0, %1, %2}" {
int mask = 0;
mask |= INTVAL (operands[2]) << 0;
mask |= INTVAL (operands[3]) << 2;
mask |= INTVAL (operands[4]) << 4;
mask |= INTVAL (operands[5]) << 6;
operands[2] = GEN_INT (mask);
return "vpermq\t{%2, %1, %0|%0, %1, %2}";
}
[(set_attr "type" "sselog") [(set_attr "type" "sselog")
(set_attr "prefix" "vex") (set_attr "prefix" "vex")
(set_attr "mode" "OI")]) (set_attr "mode" "OI")])
...@@ -11542,7 +11587,7 @@ ...@@ -11542,7 +11587,7 @@
[(set (match_operand:V4DI 0 "register_operand" "=x") [(set (match_operand:V4DI 0 "register_operand" "=x")
(unspec:V4DI (unspec:V4DI
[(match_operand:V4DI 1 "register_operand" "x") [(match_operand:V4DI 1 "register_operand" "x")
(match_operand:V4DI 2 "register_operand" "xm") (match_operand:V4DI 2 "nonimmediate_operand" "xm")
(match_operand:SI 3 "const_0_to_255_operand" "n")] (match_operand:SI 3 "const_0_to_255_operand" "n")]
UNSPEC_VPERMTI))] UNSPEC_VPERMTI))]
"TARGET_AVX2" "TARGET_AVX2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment