aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/s390/subst.md
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2016-03-01 09:23:41 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2016-03-01 09:23:41 +0000
commita9fcf821ebc87275f31d4f145b6cb85f1bb79237 (patch)
treeff149799c4077f2dafd41dbf9b34bbdb627ee769 /gcc/config/s390/subst.md
parentadf22b3f5a9b826192c4582c897e9b8c8b4ff37a (diff)
downloadgcc-a9fcf821ebc87275f31d4f145b6cb85f1bb79237.zip
gcc-a9fcf821ebc87275f31d4f145b6cb85f1bb79237.tar.gz
gcc-a9fcf821ebc87275f31d4f145b6cb85f1bb79237.tar.bz2
S/390: Get rid of Y constraint in arithmetic right shift
patterns. The arithmetic shift patterns set also the condition code. This adds more substitution potential. Depending on whether the actual result or the CC output will be used 3 different variants of each of these patterns are needed. This multiplied with the PLUS and the AND operands from the earlier substitutions enables a lot of folding. 2016-03-01 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * config/s390/s390.md ("*ashrdi3_cc_31") ("*ashrdi3_cconly_31""*ashrdi3_cc_31_and") ("*ashrdi3_cconly_31_and", "*ashrdi3_31_and", "*ashrdi3_31"): Merge insn definitions into ... ("*ashrdi3_31<addr_style_op_cc><masked_op_cc><setcc><cconly>"): New pattern definition. ("*ashr<mode>3_cc", "*ashr<mode>3_cconly", "ashr<mode>3", ) ("*ashr<mode>3_cc_and", "*ashr<mode>3_cconly_and") ("*ashr<mode>3_and"): Merge insn definitions into ... ("*ashr<mode>3<addr_style_op_cc><masked_op_cc><setcc><cconly>"): New pattern definition. * config/s390/subst.md ("addr_style_op_cc_subst") ("masked_op_cc_subst", "setcc_subst", "cconly_subst"): New substitutions patterns plus attributes. Add ashiftrt to SUBST iterator. From-SVN: r233845
Diffstat (limited to 'gcc/config/s390/subst.md')
-rw-r--r--gcc/config/s390/subst.md62
1 files changed, 61 insertions, 1 deletions
diff --git a/gcc/config/s390/subst.md b/gcc/config/s390/subst.md
index 907676a..3becf20 100644
--- a/gcc/config/s390/subst.md
+++ b/gcc/config/s390/subst.md
@@ -19,7 +19,7 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_code_iterator SUBST [rotate ashift lshiftrt])
+(define_code_iterator SUBST [rotate ashift lshiftrt ashiftrt])
; This expands an register/immediate operand to a register+immediate
; operand to draw advantage of the address style operand format
@@ -59,3 +59,63 @@
; Use this in the insn name.
(define_subst_attr "masked_op" "masked_op_subst" "" "_and")
+
+
+; This is like the addr_style_op substitution above but with a CC clobber.
+(define_subst "addr_style_op_cc_subst"
+ [(set (match_operand:DSI 0 "" "")
+ (ashiftrt:DSI (match_operand:DSI 1 "" "")
+ (match_operand:SI 2 "" "")))
+ (clobber (reg:CC CC_REGNUM))]
+ "REG_P (operands[2])"
+ [(set (match_dup 0)
+ (ashiftrt:DSI (match_dup 1)
+ (plus:SI (match_dup 2)
+ (match_operand 3 "const_int_operand" "n"))))
+ (clobber (reg:CC CC_REGNUM))])
+
+(define_subst_attr "addr_style_op_cc" "addr_style_op_cc_subst" "" "_plus")
+(define_subst_attr "addr_style_op_cc_ops" "addr_style_op_cc_subst" "%Y2" "%Y3(%2)")
+
+
+; This is like the masked_op substitution but with a CC clobber.
+(define_subst "masked_op_cc_subst"
+ [(set (match_operand:DSI 0 "" "")
+ (ashiftrt:DSI (match_operand:DSI 1 "" "")
+ (match_operand:SI 2 "" "")))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ [(set (match_dup 0)
+ (ashiftrt:DSI (match_dup 1)
+ (and:SI (match_dup 2)
+ (match_operand:SI 3 "const_int_6bitset_operand" ""))))
+ (clobber (reg:CC CC_REGNUM))])
+(define_subst_attr "masked_op_cc" "masked_op_cc_subst" "" "_and")
+
+
+; This adds an explicit CC reg set to an operation while keeping the
+; set for the operation result as well.
+(define_subst "setcc_subst"
+ [(set (match_operand:DSI 0 "" "")
+ (match_operand:DSI 1 "" ""))
+ (clobber (reg:CC CC_REGNUM))]
+ "s390_match_ccmode(insn, CCSmode)"
+ [(set (reg CC_REGNUM)
+ (compare (match_dup 1) (const_int 0)))
+ (set (match_dup 0) (match_dup 1))])
+
+; Use this in the insn name.
+(define_subst_attr "setcc" "setcc_subst" "" "_cc")
+
+; This adds an explicit CC reg set to an operation while dropping the
+; result of the operation.
+(define_subst "cconly_subst"
+ [(set (match_operand:DSI 0 "" "")
+ (match_operand:DSI 1 "" ""))
+ (clobber (reg:CC CC_REGNUM))]
+ "s390_match_ccmode(insn, CCSmode)"
+ [(set (reg CC_REGNUM)
+ (compare (match_dup 1) (const_int 0)))
+ (clobber (match_scratch:DSI 0 "=d,d"))])
+
+(define_subst_attr "cconly" "cconly_subst" "" "_cconly")