2011-09-17 Jakub Jelinek <jakub@redhat.com>
+ * config/i386/sse.md (VIMAX_AVX2): Change V4DI to V2TI.
+ (sse2_avx, sseinsnmode): Add V2TI.
+ (REDUC_SMINMAX_MODE): New mode iterator.
+ (reduc_smax_v4sf, reduc_smin_v4sf, reduc_smax_v8sf,
+ reduc_smin_v8sf, reduc_smax_v4df, reduc_smin_v4df): Remove.
+ (reduc_<code>_<mode>): New smaxmin and umaxmin expanders.
+ (sse2_lshrv1ti3): Rename to...
+ (<sse2_avx2>_lshr<mode>3): ... this. Use VIMAX_AVX2 mode
+ iterator. Move before umaxmin expanders.
+ * config/i386/i386.h (VALID_AVX256_REG_MODE,
+ SSE_REG_MODE_P): Accept V2TImode.
+ * config/i386/i386.c (ix86_expand_reduc): Handle V32QImode,
+ V16HImode, V8SImode and V4DImode.
+
* config/i386/i386.c (ix86_build_const_vector): Handle V8SImode
and V4DImode.
(ix86_build_signbit_mask): Likewise.
VI8_AVX2 mode iterator.
(vcond<V_256:mode><VI_256:mode>, vcondu<V_256:mode><VI_256:mode>):
New expanders.
-
+
2011-09-17 Richard Sandiford <rdsandiford@googlemail.com>
* config/ia64/itanium2.md: Use match_test rather than eq/ne symbol_ref
{
rtx tmp1, tmp2, tmp3, tmp4, tmp5;
enum machine_mode mode = GET_MODE (in);
+ int i;
tmp1 = gen_reg_rtx (mode);
tmp2 = gen_reg_rtx (mode);
emit_insn (fn (tmp2, tmp1, in));
emit_insn (gen_avx_shufpd256 (tmp3, tmp2, tmp2, const1_rtx));
break;
+ case V32QImode:
+ case V16HImode:
+ case V8SImode:
+ case V4DImode:
+ emit_insn (gen_avx2_permv2ti (gen_lowpart (V4DImode, tmp1),
+ gen_lowpart (V4DImode, in),
+ gen_lowpart (V4DImode, in),
+ const1_rtx));
+ tmp4 = in;
+ tmp5 = tmp1;
+ for (i = 64; i >= GET_MODE_BITSIZE (GET_MODE_INNER (mode)); i >>= 1)
+ {
+ if (i != 64)
+ {
+ tmp2 = gen_reg_rtx (mode);
+ tmp3 = gen_reg_rtx (mode);
+ }
+ emit_insn (fn (tmp2, tmp4, tmp5));
+ emit_insn (gen_avx2_lshrv2ti3 (gen_lowpart (V2TImode, tmp3),
+ gen_lowpart (V2TImode, tmp2),
+ GEN_INT (i)));
+ tmp4 = tmp2;
+ tmp5 = tmp3;
+ }
+ break;
default:
gcc_unreachable ();
}
[(V4DI "TARGET_AVX2") V2DI])
(define_mode_iterator VIMAX_AVX2
- [(V4DI "TARGET_AVX2") V1TI])
+ [(V2TI "TARGET_AVX2") V1TI])
(define_mode_iterator SSESCALARMODE
[(V4DI "TARGET_AVX2") TI])
(V8HI "sse2") (V16HI "avx2")
(V4SI "sse2") (V8SI "avx2")
(V2DI "sse2") (V4DI "avx2")
- (V1TI "sse2")])
+ (V1TI "sse2") (V2TI "avx2")])
(define_mode_attr ssse3_avx2
[(V16QI "ssse3") (V32QI "avx2")
;; SSE instruction mode
(define_mode_attr sseinsnmode
- [(V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI")
+ [(V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
(V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
(V8SF "V8SF") (V4DF "V4DF")
(V4SF "V4SF") (V2DF "V2DF")
DONE;
})
+;; Modes handled by reduc_sm{in,ax}* patterns.
+(define_mode_iterator REDUC_SMINMAX_MODE
+ [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
+ (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
+ (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
+ (V4SF "TARGET_SSE")])
-(define_expand "reduc_smax_v4sf"
- [(match_operand:V4SF 0 "register_operand" "")
- (match_operand:V4SF 1 "register_operand" "")]
- "TARGET_SSE"
-{
- ix86_expand_reduc (gen_smaxv4sf3, operands[0], operands[1]);
- DONE;
-})
-
-(define_expand "reduc_smin_v4sf"
- [(match_operand:V4SF 0 "register_operand" "")
- (match_operand:V4SF 1 "register_operand" "")]
- "TARGET_SSE"
-{
- ix86_expand_reduc (gen_sminv4sf3, operands[0], operands[1]);
- DONE;
-})
-
-(define_expand "reduc_smax_v8sf"
- [(match_operand:V8SF 0 "register_operand" "")
- (match_operand:V8SF 1 "register_operand" "")]
- "TARGET_AVX"
-{
- ix86_expand_reduc (gen_smaxv8sf3, operands[0], operands[1]);
- DONE;
-})
-
-(define_expand "reduc_smin_v8sf"
- [(match_operand:V8SF 0 "register_operand" "")
- (match_operand:V8SF 1 "register_operand" "")]
- "TARGET_AVX"
-{
- ix86_expand_reduc (gen_sminv8sf3, operands[0], operands[1]);
- DONE;
-})
-
-(define_expand "reduc_smax_v4df"
- [(match_operand:V4DF 0 "register_operand" "")
- (match_operand:V4DF 1 "register_operand" "")]
- "TARGET_AVX"
+(define_expand "reduc_<code>_<mode>"
+ [(smaxmin:REDUC_SMINMAX_MODE
+ (match_operand:REDUC_SMINMAX_MODE 0 "register_operand" "")
+ (match_operand:REDUC_SMINMAX_MODE 1 "register_operand" ""))]
+ ""
{
- ix86_expand_reduc (gen_smaxv4df3, operands[0], operands[1]);
+ ix86_expand_reduc (gen_<code><mode>3, operands[0], operands[1]);
DONE;
})
-(define_expand "reduc_smin_v4df"
- [(match_operand:V4DF 0 "register_operand" "")
- (match_operand:V4DF 1 "register_operand" "")]
- "TARGET_AVX"
+(define_expand "reduc_<code>_<mode>"
+ [(umaxmin:VI_256
+ (match_operand:VI_256 0 "register_operand" "")
+ (match_operand:VI_256 1 "register_operand" ""))]
+ "TARGET_AVX2"
{
- ix86_expand_reduc (gen_sminv4df3, operands[0], operands[1]);
+ ix86_expand_reduc (gen_<code><mode>3, operands[0], operands[1]);
DONE;
})
operands[1] = gen_lowpart (V1TImode, operands[1]);
})
-(define_expand "<code><mode>3"
- [(set (match_operand:VI124_256 0 "register_operand" "")
- (umaxmin:VI124_256
- (match_operand:VI124_256 1 "nonimmediate_operand" "")
- (match_operand:VI124_256 2 "nonimmediate_operand" "")))]
- "TARGET_AVX2"
- "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
-
-(define_insn "*avx2_<code><mode>3"
- [(set (match_operand:VI124_256 0 "register_operand" "=x")
- (umaxmin:VI124_256
- (match_operand:VI124_256 1 "nonimmediate_operand" "%x")
- (match_operand:VI124_256 2 "nonimmediate_operand" "xm")))]
- "TARGET_AVX2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
- "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
- [(set_attr "type" "sseiadd")
- (set_attr "prefix_extra" "1")
- (set_attr "prefix" "vex")
- (set_attr "mode" "OI")])
-
-(define_insn "sse2_lshrv1ti3"
- [(set (match_operand:V1TI 0 "register_operand" "=x,x")
- (lshiftrt:V1TI
- (match_operand:V1TI 1 "register_operand" "0,x")
+(define_insn "<sse2_avx2>_lshr<mode>3"
+ [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,x")
+ (lshiftrt:VIMAX_AVX2
+ (match_operand:VIMAX_AVX2 1 "register_operand" "0,x")
(match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
"TARGET_SSE2"
{
(set_attr "atom_unit" "sishuf")
(set_attr "prefix_data16" "1,*")
(set_attr "prefix" "orig,vex")
- (set_attr "mode" "TI")])
+ (set_attr "mode" "<sseinsnmode>")])
+
+(define_expand "<code><mode>3"
+ [(set (match_operand:VI124_256 0 "register_operand" "")
+ (umaxmin:VI124_256
+ (match_operand:VI124_256 1 "nonimmediate_operand" "")
+ (match_operand:VI124_256 2 "nonimmediate_operand" "")))]
+ "TARGET_AVX2"
+ "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
+
+(define_insn "*avx2_<code><mode>3"
+ [(set (match_operand:VI124_256 0 "register_operand" "=x")
+ (umaxmin:VI124_256
+ (match_operand:VI124_256 1 "nonimmediate_operand" "%x")
+ (match_operand:VI124_256 2 "nonimmediate_operand" "xm")))]
+ "TARGET_AVX2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
+ "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "type" "sseiadd")
+ (set_attr "prefix_extra" "1")
+ (set_attr "prefix" "vex")
+ (set_attr "mode" "OI")])
(define_expand "<code><mode>3"
[(set (match_operand:VI124_256 0 "register_operand" "")