Commit 7dab511c by Richard Henderson Committed by Richard Henderson

mips: Improved vectorization support for Loongson and mips3d-ps.

	* config/mips/loongson.md (UNSPEC_LOONGSON_PINSR_0,
	UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2,
	UNSPEC_LOONGSON_PINSR_3): Replace with...
	(UNSPEC_LOONGSON_PINSRH): ... this.
	(UNSPEC_LOONGSON_VINIT): New.
	(UNSPEC_LOONGSON_DSLL, UNSPEC_LOONGSON_DSRL): New.
	(VWB): New mode iterator.
	(V_inner): New mode attribute.
	(loongson_vec_init1_<VHB>): New.
	(*vec_concatv2si): New.
	(and<VWHB>3, ior<VWHB>3, xor<VWHB>3, one_cmpl<VWHB>2): New.
	(*loongson_nor): New.
	(loongson_pextrh): Un-macro-ify.
	(loongson_pmaddhw): Likewise.
	(smaxv4hi3, umaxv8qi3, sminv4hi3, uminv8qi3): Likewise.
	(loongson_pinsrh_0): Represent with vec_select+vec_concat.
	(loongson_pinsrh_1, loongson_pinsrh_2, loongson_pinsrh_3): Likewise.
	(*vec_setv4hi, vec_setv4hi): New.
	(sdot_prodv4hi): New.
	(smax<VWB>3, smin<VWB>3): New.
	(reduc_uplus_v8qi): New.
	(loongson_pshufh): Remove destination matching input.
	(ashl<VWH>3, ashr<VWH>3, lshr<VWH>3): Fix type attribute.
	(vec_interleave_high<VWHB>, vec_interleave_low<VWHB>): Remove.
	(loongson_punpckhbh, loongson_punpckhhw, loongson_punpckhhw_qi,
	loongson_punpckhwd, loongson_punpckhwd_qi, loongson_punpckhwd_hi,
	loongson_punpcklbh, loongson_punpcklhw, loongson_punpcklhw_qi,
	loongson_punpcklwd, loongson_punpcklwd_qi, loongson_punpcklwd_hi,
	vec_perm_const<VWHB>, vec_unpacks_lo_<VHB>, vec_unpacks_hi_<VHB>,
	vec_unpacku_lo_<VHB>, vec_unpacku_hi_<VHB>, vec_shl_<VWHBDI>,
	vec_shr_<VWHBDI>, reduc_uplus_<VWH>, reduc_splus_<VWHB>,
	reduc_smax_<VWHB>, reduc_smin_<VWHB>, reduc_umax_<VWHB>,
	reduc_umin_<VB>): New.
	* config/mips/mips-ps-3d.md (vec_perm_const_ps): New.
	(mips_pul_ps, mips_puu_ps, mips_pll_ps, mips_plu_ps): Expand in
	terms of vec_perm_const_ps.
	(vec_perm_constv2sf): New.
	(vec_initv2sf): Use mips_expand_vector_init.
	(vec_concatv2sf): Rename from vec_initv2sf_internal.
	(vec_setv2sf): Use vec_perm_const_ps.
	(reduc_splus_v2sf, reduc_smin_v2sf, reduc_smax_v2sf): New.
	* config/mips/loongson.h (pshufh_u, pshufh_s): Don't pass dest to
	the builtin.
	* config/mips/mips-modes.def (V16QI, V8HI, V4SI, V4SF): New modes.
	* config/mips/mips-protos.h: Update.
	* config/mips/mips.c (mips_get_arg_info): Match V2SFmode, not all
	MODE_VECTOR_FLOAT.
	(mips_return_mode_in_fpr_p): Likewise.
	(mips_cannot_change_mode_class): Allow 8-byte integral mode changes.
	(CODE_FOR_loongson_punpckhbh, CODE_FOR_loongson_punpckhhw,
	CODE_FOR_loongson_punpckhwd, CODE_FOR_loongson_punpcklbh,
	CODE_FOR_loongson_punpcklhw, CODE_FOR_loongson_punpcklwd): Remove.
	(mips_builtins): Remove first operand for loongson pshufh builtins.
	(MAX_VECT_LEN, struct expand_vec_perm_d): New.
	(mips_expand_vselect, mips_expand_vselect_vconcat,
	mips_expand_vpc_loongson_even_odd, mips_expand_vpc_loongson_pshufh,
	mips_expand_vpc_loongson_bcast, mips_expand_vec_perm_const_1,
	mips_expand_vec_perm_const, mips_vectorize_vec_perm_const_ok,
	mips_expand_vec_unpack, mips_constant_elt_p, mips_expand_vi_broadcast,
	mips_expand_vi_constant, mips_expand_vi_loongson_one_pinsrh,
	mips_expand_vi_general, mips_expand_vec_reduc, mips_expand_vec_minmax,
	TARGET_VECTORIZE_VEC_PERM_CONST_OK): New.
	(mips_expand_vector_init): Rewrite.
	* config/mips/predicates.md (const_2_or_3_operand): New.
	(const_0_to_3_operand): New.

From-SVN: r182662
parent 7a37d6ea
2011-12-23 Richard Henderson <rth@redhat.com>
* config/mips/loongson.md (UNSPEC_LOONGSON_PINSR_0,
UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2,
UNSPEC_LOONGSON_PINSR_3): Replace with...
(UNSPEC_LOONGSON_PINSRH): ... this.
(UNSPEC_LOONGSON_VINIT): New.
(UNSPEC_LOONGSON_DSLL, UNSPEC_LOONGSON_DSRL): New.
(VWB): New mode iterator.
(V_inner): New mode attribute.
(loongson_vec_init1_<VHB>): New.
(*vec_concatv2si): New.
(and<VWHB>3, ior<VWHB>3, xor<VWHB>3, one_cmpl<VWHB>2): New.
(*loongson_nor): New.
(loongson_pextrh): Un-macro-ify.
(loongson_pmaddhw): Likewise.
(smaxv4hi3, umaxv8qi3, sminv4hi3, uminv8qi3): Likewise.
(loongson_pinsrh_0): Represent with vec_select+vec_concat.
(loongson_pinsrh_1, loongson_pinsrh_2, loongson_pinsrh_3): Likewise.
(*vec_setv4hi, vec_setv4hi): New.
(sdot_prodv4hi): New.
(smax<VWB>3, smin<VWB>3): New.
(reduc_uplus_v8qi): New.
(loongson_pshufh): Remove destination matching input.
(ashl<VWH>3, ashr<VWH>3, lshr<VWH>3): Fix type attribute.
(vec_interleave_high<VWHB>, vec_interleave_low<VWHB>): Remove.
(loongson_punpckhbh, loongson_punpckhhw, loongson_punpckhhw_qi,
loongson_punpckhwd, loongson_punpckhwd_qi, loongson_punpckhwd_hi,
loongson_punpcklbh, loongson_punpcklhw, loongson_punpcklhw_qi,
loongson_punpcklwd, loongson_punpcklwd_qi, loongson_punpcklwd_hi,
vec_perm_const<VWHB>, vec_unpacks_lo_<VHB>, vec_unpacks_hi_<VHB>,
vec_unpacku_lo_<VHB>, vec_unpacku_hi_<VHB>, vec_shl_<VWHBDI>,
vec_shr_<VWHBDI>, reduc_uplus_<VWH>, reduc_splus_<VWHB>,
reduc_smax_<VWHB>, reduc_smin_<VWHB>, reduc_umax_<VWHB>,
reduc_umin_<VB>): New.
* config/mips/mips-ps-3d.md (vec_perm_const_ps): New.
(mips_pul_ps, mips_puu_ps, mips_pll_ps, mips_plu_ps): Expand in
terms of vec_perm_const_ps.
(vec_perm_constv2sf): New.
(vec_initv2sf): Use mips_expand_vector_init.
(vec_concatv2sf): Rename from vec_initv2sf_internal.
(vec_setv2sf): Use vec_perm_const_ps.
(reduc_splus_v2sf, reduc_smin_v2sf, reduc_smax_v2sf): New.
* config/mips/loongson.h (pshufh_u, pshufh_s): Don't pass dest to
the builtin.
* config/mips/mips-modes.def (V16QI, V8HI, V4SI, V4SF): New modes.
* config/mips/mips-protos.h: Update.
* config/mips/mips.c (mips_get_arg_info): Match V2SFmode, not all
MODE_VECTOR_FLOAT.
(mips_return_mode_in_fpr_p): Likewise.
(mips_cannot_change_mode_class): Allow 8-byte integral mode changes.
(CODE_FOR_loongson_punpckhbh, CODE_FOR_loongson_punpckhhw,
CODE_FOR_loongson_punpckhwd, CODE_FOR_loongson_punpcklbh,
CODE_FOR_loongson_punpcklhw, CODE_FOR_loongson_punpcklwd): Remove.
(mips_builtins): Remove first operand for loongson pshufh builtins.
(MAX_VECT_LEN, struct expand_vec_perm_d): New.
(mips_expand_vselect, mips_expand_vselect_vconcat,
mips_expand_vpc_loongson_even_odd, mips_expand_vpc_loongson_pshufh,
mips_expand_vpc_loongson_bcast, mips_expand_vec_perm_const_1,
mips_expand_vec_perm_const, mips_vectorize_vec_perm_const_ok,
mips_expand_vec_unpack, mips_constant_elt_p, mips_expand_vi_broadcast,
mips_expand_vi_constant, mips_expand_vi_loongson_one_pinsrh,
mips_expand_vi_general, mips_expand_vec_reduc, mips_expand_vec_minmax,
TARGET_VECTORIZE_VEC_PERM_CONST_OK): New.
(mips_expand_vector_init): Rewrite.
* config/mips/predicates.md (const_2_or_3_operand): New.
(const_0_to_3_operand): New.
2011-12-23 Dmitry Plotnikov <dplotnikov@ispras.ru>
* config/arm/neon.md (float<mode><V_cvtto>2): New.
......@@ -449,13 +449,13 @@ psadbh (uint8x8_t s, uint8x8_t t)
__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
pshufh_u (uint16x4_t dest, uint16x4_t s, uint8_t order)
{
return __builtin_loongson_pshufh_u (dest, s, order);
return __builtin_loongson_pshufh_u (s, order);
}
__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
pshufh_s (int16x4_t dest, int16x4_t s, uint8_t order)
{
return __builtin_loongson_pshufh_s (dest, s, order);
return __builtin_loongson_pshufh_s (s, order);
}
/* Shift left logical. */
......
......@@ -26,9 +26,15 @@ RESET_FLOAT_FORMAT (DF, mips_double_format);
FLOAT_MODE (TF, 16, mips_quad_format);
/* Vector modes. */
VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
VECTOR_MODES (INT, 4); /* V4QI V2HI */
VECTOR_MODES (INT, 4); /* V4QI V2HI */
VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
/* Double-sized vector modes for vec_concat. */
VECTOR_MODE (INT, QI, 16); /* V16QI */
VECTOR_MODE (INT, HI, 8); /* V8HI */
VECTOR_MODE (INT, SI, 4); /* V4SI */
VECTOR_MODE (FLOAT, SF, 4); /* V4SF */
VECTOR_MODES (FRACT, 4); /* V4QQ V2HQ */
VECTOR_MODES (UFRACT, 4); /* V4UQQ V2UHQ */
......
......@@ -328,6 +328,11 @@ extern void mips_expand_atomic_qihi (union mips_gen_fn_ptrs,
rtx, rtx, rtx, rtx);
extern void mips_expand_vector_init (rtx, rtx);
extern bool mips_expand_vec_perm_const (rtx op[4]);
extern void mips_expand_vec_unpack (rtx op[2], bool, bool);
extern void mips_expand_vec_reduc (rtx, rtx, rtx (*)(rtx, rtx, rtx));
extern void mips_expand_vec_minmax (rtx, rtx, rtx,
rtx (*) (rtx, rtx, rtx), bool);
extern bool mips_eh_uses (unsigned int);
extern bool mips_epilogue_uses (unsigned int);
......
......@@ -73,8 +73,15 @@
;; This is used for indexing into vectors, and hence only accepts const_int.
(define_predicate "const_0_or_1_operand"
(and (match_code "const_int")
(ior (match_test "op == CONST0_RTX (GET_MODE (op))")
(match_test "op == CONST1_RTX (GET_MODE (op))"))))
(match_test "IN_RANGE (INTVAL (op), 0, 1)")))
(define_predicate "const_2_or_3_operand"
(and (match_code "const_int")
(match_test "IN_RANGE (INTVAL (op), 2, 3)")))
(define_predicate "const_0_to_3_operand"
(and (match_code "const_int")
(match_test "IN_RANGE (INTVAL (op), 0, 3)")))
(define_predicate "qi_mask_operand"
(and (match_code "const_int")
......
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