summaryrefslogtreecommitdiff
path: root/gcc/config/s390
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-26 10:32:58 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-26 10:32:58 +0000
commitf118d3f026939501c610e1d0b3b535cf5f30d815 (patch)
tree7ed8a72c8edff95aea29d180bbc2f6554171e4d6 /gcc/config/s390
parent23e1bdb8d9d61cd4fe26d32a87fe551503f2845c (diff)
downloadgcc-f118d3f026939501c610e1d0b3b535cf5f30d815.tar.gz
S/390: Add widening vector mult lo/hi patterns
Add support for widening vector multiply lo/hi patterns. These do not directly match on IBM Z instructions but can be emulated with even/odd + vector merge. gcc/ChangeLog: 2017-09-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * config/s390/vector.md ("vec_widen_umult_lo_<mode>") ("vec_widen_umult_hi_<mode>", "vec_widen_smult_lo_<mode>") ("vec_widen_smult_hi_<mode>"): New expander definitions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253192 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/s390')
-rw-r--r--gcc/config/s390/vector.md83
1 files changed, 79 insertions, 4 deletions
diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md
index 3cf79896720..29131cdbf35 100644
--- a/gcc/config/s390/vector.md
+++ b/gcc/config/s390/vector.md
@@ -1065,10 +1065,85 @@
"vmlo<bhfgq>\t%v0,%v1,%v2"
[(set_attr "op_type" "VRR")])
-; vec_widen_umult_hi
-; vec_widen_umult_lo
-; vec_widen_smult_hi
-; vec_widen_smult_lo
+
+; Widening hi/lo multiplications
+
+; The S/390 instructions vml and vmh return the low or high parts of
+; the double sized result elements in the corresponding elements of
+; the target register. That's NOT what the vec_widen_umult_lo/hi
+; patterns are expected to do.
+
+; We emulate the widening lo/hi multiplies with the even/odd versions
+; followed by a vector merge
+
+
+(define_expand "vec_widen_umult_lo_<mode>"
+ [(set (match_dup 3)
+ (unspec:<vec_double> [(match_operand:VI_QHS 1 "register_operand" "%v")
+ (match_operand:VI_QHS 2 "register_operand" "v")]
+ UNSPEC_VEC_UMULT_EVEN))
+ (set (match_dup 4)
+ (unspec:<vec_double> [(match_dup 1) (match_dup 2)]
+ UNSPEC_VEC_UMULT_ODD))
+ (set (match_operand:<vec_double> 0 "register_operand" "=v")
+ (unspec:<vec_double> [(match_dup 3) (match_dup 4)]
+ UNSPEC_VEC_MERGEL))]
+ "TARGET_VX"
+ {
+ operands[3] = gen_reg_rtx (<vec_double>mode);
+ operands[4] = gen_reg_rtx (<vec_double>mode);
+ })
+
+(define_expand "vec_widen_umult_hi_<mode>"
+ [(set (match_dup 3)
+ (unspec:<vec_double> [(match_operand:VI_QHS 1 "register_operand" "%v")
+ (match_operand:VI_QHS 2 "register_operand" "v")]
+ UNSPEC_VEC_UMULT_EVEN))
+ (set (match_dup 4)
+ (unspec:<vec_double> [(match_dup 1) (match_dup 2)]
+ UNSPEC_VEC_UMULT_ODD))
+ (set (match_operand:<vec_double> 0 "register_operand" "=v")
+ (unspec:<vec_double> [(match_dup 3) (match_dup 4)]
+ UNSPEC_VEC_MERGEH))]
+ "TARGET_VX"
+ {
+ operands[3] = gen_reg_rtx (<vec_double>mode);
+ operands[4] = gen_reg_rtx (<vec_double>mode);
+ })
+
+(define_expand "vec_widen_smult_lo_<mode>"
+ [(set (match_dup 3)
+ (unspec:<vec_double> [(match_operand:VI_QHS 1 "register_operand" "%v")
+ (match_operand:VI_QHS 2 "register_operand" "v")]
+ UNSPEC_VEC_SMULT_EVEN))
+ (set (match_dup 4)
+ (unspec:<vec_double> [(match_dup 1) (match_dup 2)]
+ UNSPEC_VEC_SMULT_ODD))
+ (set (match_operand:<vec_double> 0 "register_operand" "=v")
+ (unspec:<vec_double> [(match_dup 3) (match_dup 4)]
+ UNSPEC_VEC_MERGEL))]
+ "TARGET_VX"
+ {
+ operands[3] = gen_reg_rtx (<vec_double>mode);
+ operands[4] = gen_reg_rtx (<vec_double>mode);
+ })
+
+(define_expand "vec_widen_smult_hi_<mode>"
+ [(set (match_dup 3)
+ (unspec:<vec_double> [(match_operand:VI_QHS 1 "register_operand" "%v")
+ (match_operand:VI_QHS 2 "register_operand" "v")]
+ UNSPEC_VEC_SMULT_EVEN))
+ (set (match_dup 4)
+ (unspec:<vec_double> [(match_dup 1) (match_dup 2)]
+ UNSPEC_VEC_SMULT_ODD))
+ (set (match_operand:<vec_double> 0 "register_operand" "=v")
+ (unspec:<vec_double> [(match_dup 3) (match_dup 4)]
+ UNSPEC_VEC_MERGEH))]
+ "TARGET_VX"
+ {
+ operands[3] = gen_reg_rtx (<vec_double>mode);
+ operands[4] = gen_reg_rtx (<vec_double>mode);
+ })
; vec_widen_ushiftl_hi
; vec_widen_ushiftl_lo