Commit 66c5c67b by Simon Dardis Committed by Simon Dardis

Update loongson vector reductions.

2015-11-06  Simon Dardis  <simon.dardis@imgtec.com>

        * config/mips/loongson.md (vec_loongson_extract_lo_<mode>): New, extract
        low part to scalar.
        (reduc_uplus_<mode>): Remove.
        (reduc_plus_scal_<mode>): Rename from reduc_splus_<mode>, Use vec
        loongson_extract_lo_<mode>.
        (reduc_smax_scal_<mode>, reduc_smin_scal_<mode>): Rename from
        reduc_smax_<mode>, reduc_smax_<mode>, use vec
        loongson_extract_lo_<mode>.
        (reduc_umax_scal_<mode>, reduc_umin_scal_<mode>): Rename.

From-SVN: r229844
parent 61d371eb
2015-11-06 Simon Dardis <simon.dardis@imgtec.com>
* config/mips/loongson.md (vec_loongson_extract_lo_<mode>): New, extract
low part to scalar.
(reduc_uplus_<mode>): Remove.
(reduc_plus_scal_<mode>): Rename from reduc_splus_<mode>, Use vec
loongson_extract_lo_<mode>.
(reduc_smax_scal_<mode>, reduc_smin_scal_<mode>): Rename from
reduc_smax_<mode>, reduc_smax_<mode>, use vec
loongson_extract_lo_<mode>.
(reduc_umax_scal_<mode>, reduc_umin_scal_<mode>): Rename.
2015-11-06 Richard Biener <rguenther@suse.de> 2015-11-06 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (struct _bb_vec_info): Add region_begin/end * tree-vectorizer.h (struct _bb_vec_info): Add region_begin/end
...@@ -852,58 +852,66 @@ ...@@ -852,58 +852,66 @@
"dsrl\t%0,%1,%2" "dsrl\t%0,%1,%2"
[(set_attr "type" "fcvt")]) [(set_attr "type" "fcvt")])
(define_expand "reduc_uplus_<mode>" (define_insn "vec_loongson_extract_lo_<mode>"
[(match_operand:VWH 0 "register_operand" "") [(set (match_operand:<V_inner> 0 "register_operand" "=r")
(match_operand:VWH 1 "register_operand" "")] (vec_select:<V_inner>
(match_operand:VWHB 1 "register_operand" "f")
(parallel [(const_int 0)])))]
"TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS" "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
{ "mfc1\t%0,%1"
mips_expand_vec_reduc (operands[0], operands[1], gen_add<mode>3); [(set_attr "type" "mfc")])
DONE;
})
; ??? Given that we're not describing a widening reduction, we should (define_expand "reduc_plus_scal_<mode>"
; not have separate optabs for signed and unsigned. [(match_operand:<V_inner> 0 "register_operand" "")
(define_expand "reduc_splus_<mode>"
[(match_operand:VWHB 0 "register_operand" "")
(match_operand:VWHB 1 "register_operand" "")] (match_operand:VWHB 1 "register_operand" "")]
"TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS" "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
{ {
emit_insn (gen_reduc_uplus_<mode>(operands[0], operands[1])); rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
mips_expand_vec_reduc (tmp, operands[1], gen_add<mode>3);
emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
DONE; DONE;
}) })
(define_expand "reduc_smax_<mode>" (define_expand "reduc_smax_scal_<mode>"
[(match_operand:VWHB 0 "register_operand" "") [(match_operand:<V_inner> 0 "register_operand" "")
(match_operand:VWHB 1 "register_operand" "")] (match_operand:VWHB 1 "register_operand" "")]
"TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS" "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
{ {
mips_expand_vec_reduc (operands[0], operands[1], gen_smax<mode>3); rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
mips_expand_vec_reduc (tmp, operands[1], gen_smax<mode>3);
emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
DONE; DONE;
}) })
(define_expand "reduc_smin_<mode>" (define_expand "reduc_smin_scal_<mode>"
[(match_operand:VWHB 0 "register_operand" "") [(match_operand:<V_inner> 0 "register_operand" "")
(match_operand:VWHB 1 "register_operand" "")] (match_operand:VWHB 1 "register_operand" "")]
"TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS" "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
{ {
mips_expand_vec_reduc (operands[0], operands[1], gen_smin<mode>3); rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
mips_expand_vec_reduc (tmp, operands[1], gen_smin<mode>3);
emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
DONE; DONE;
}) })
(define_expand "reduc_umax_<mode>" (define_expand "reduc_umax_scal_<mode>"
[(match_operand:VB 0 "register_operand" "") [(match_operand:<V_inner> 0 "register_operand" "")
(match_operand:VB 1 "register_operand" "")] (match_operand:VB 1 "register_operand" "")]
"TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS" "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
{ {
mips_expand_vec_reduc (operands[0], operands[1], gen_umax<mode>3); rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
mips_expand_vec_reduc (tmp, operands[1], gen_umax<mode>3);
emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
DONE; DONE;
}) })
(define_expand "reduc_umin_<mode>" (define_expand "reduc_umin_scal_<mode>"
[(match_operand:VB 0 "register_operand" "") [(match_operand:<V_inner> 0 "register_operand" "")
(match_operand:VB 1 "register_operand" "")] (match_operand:VB 1 "register_operand" "")]
"TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS" "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
{ {
mips_expand_vec_reduc (operands[0], operands[1], gen_umin<mode>3); rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
mips_expand_vec_reduc (tmp, operands[1], gen_umin<mode>3);
emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
DONE; DONE;
}) })
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