From patchwork Tue Jul 17 19:49:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 171552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B6EA52C00A8 for ; Wed, 18 Jul 2012 05:49:49 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343159390; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Subject:From:To:Date:Content-Type:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=RD1aPP71wtxZJDKjxClC pCxaAuo=; b=coC78ULMmHzNtlSICS88QbVJZqIx2I94IK8ZKB2twwR2WF21AdcC Sdb/SJQGnX6O+AUeVEVU10APwk6eHczvwhFeHh/U9Bwn0NA3EPXCZJIGq0VtVBDC ot0S4nNiwNs1pQx2dQTHqLD92pbzNHc6AkpqPRoX6n+8PrD3OrSKO0o= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Subject:From:To:Date:Content-Type:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=OcISpIRbAVbMtYmalsPHSemXFL9G51hcG/W2Uz7XjOk0LZpaFgUveRfgycDeqy GQ9Zp3jAlrlTvRb/7SYlDtWa7hx+2cJBdQ2QpAezUR5WgJFh89YXWWl8/e/ie4A9 1Kq3aErGeoqHSljcvuDJtfJm0hQ8JHo/6beg27XgQbMcc=; Received: (qmail 14813 invoked by alias); 17 Jul 2012 19:49:46 -0000 Received: (qmail 14804 invoked by uid 22791); 17 Jul 2012 19:49:44 -0000 X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=AWL, BAYES_00, MEDICAL_SUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout05.t-online.de (HELO mailout05.t-online.de) (194.25.134.82) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Jul 2012 19:49:30 +0000 Received: from fwd53.aul.t-online.de (fwd53.aul.t-online.de ) by mailout05.t-online.de with smtp id 1SrDlq-00053n-TW; Tue, 17 Jul 2012 21:49:22 +0200 Received: from [192.168.0.100] (bLgMkqZbQhaAyiuMWk1ZxnY5YvzO3KbYnbmg86hZCgj-1AhnMXL9L+-20PYGTirQWQ@[93.218.163.95]) by fwd53.t-online.de with esmtp id 1SrDlb-12w13I0; Tue, 17 Jul 2012 21:49:07 +0200 Message-ID: <1342554541.2213.17.camel@yam-132-YW-E178-FTW> Subject: [SH] Use some more insn_and_split in MD From: Oleg Endo To: gcc-patches Date: Tue, 17 Jul 2012 21:49:01 +0200 Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hello, The attached patch folds some define_insn and define_split with define_insn_and_split and removes constraints in some expander definitions. Tested on rev 189549 with make -k check RUNTESTFLAGS="--target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a/-mb,-m2a-single/-mb,-m4/-ml,-m4/-mb, -m4-single/-ml,-m4-single/-mb,-m4a-single/-ml,-m4a-single/-mb}" and no new failures. CSiBE result-size (-m4-single -ml -O2 -mpretend-cmove) also shows no changes. OK? Cheers, Oleg ChangeLog: * config/sh/sh.md (mulsidi3, umulsidi3): Remove constraints in expander. Use arith_reg_dest predicate. (rotldi3, rotrdi3): Remove constraints in expander. (adddi3_compact, subdi3_compact, mulsidi3_compact, umulsidi3_compact, ashlsi3_n, *ashlhi3_n, ashrsi2_16, ashrsi2_31, lshrsi3_n): Convert to insn_and_split. Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 189427) +++ gcc/config/sh/sh.md (working copy) @@ -1431,21 +1431,14 @@ [(set_attr "type" "arith_media") (set_attr "highpart" "ignore")]) -(define_insn "adddi3_compact" +(define_insn_and_split "adddi3_compact" [(set (match_operand:DI 0 "arith_reg_dest" "=&r") (plus:DI (match_operand:DI 1 "arith_reg_operand" "%0") (match_operand:DI 2 "arith_reg_operand" "r"))) (clobber (reg:SI T_REG))] "TARGET_SH1" "#" - [(set_attr "length" "6")]) - -(define_split - [(set (match_operand:DI 0 "arith_reg_dest" "") - (plus:DI (match_operand:DI 1 "arith_reg_operand" "") - (match_operand:DI 2 "arith_reg_operand" ""))) - (clobber (reg:SI T_REG))] - "TARGET_SH1 && reload_completed" + "&& reload_completed" [(const_int 0)] { rtx high0 = gen_highpart (SImode, operands[0]); @@ -1556,21 +1549,14 @@ [(set_attr "type" "arith_media") (set_attr "highpart" "ignore")]) -(define_insn "subdi3_compact" +(define_insn_and_split "subdi3_compact" [(set (match_operand:DI 0 "arith_reg_dest" "=&r") (minus:DI (match_operand:DI 1 "arith_reg_operand" "0") (match_operand:DI 2 "arith_reg_operand" "r"))) (clobber (reg:SI T_REG))] "TARGET_SH1" "#" - [(set_attr "length" "6")]) - -(define_split - [(set (match_operand:DI 0 "arith_reg_dest" "") - (minus:DI (match_operand:DI 1 "arith_reg_operand" "") - (match_operand:DI 2 "arith_reg_operand" ""))) - (clobber (reg:SI T_REG))] - "TARGET_SH1 && reload_completed" + "&& reload_completed" [(const_int 0)] { rtx high0 = gen_highpart (SImode, operands[0]); @@ -2861,9 +2847,9 @@ [(set_attr "type" "dmpy")]) (define_expand "mulsidi3" - [(set (match_operand:DI 0 "arith_reg_operand" "=r") - (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) - (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" "r"))))] + [(set (match_operand:DI 0 "arith_reg_dest" "") + (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) + (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" ""))))] "TARGET_SH2 || TARGET_SHMEDIA" { if (TARGET_SH2) @@ -2882,7 +2868,7 @@ [(set_attr "type" "dmpy_media") (set_attr "highpart" "ignore")]) -(define_insn "mulsidi3_compact" +(define_insn_and_split "mulsidi3_compact" [(set (match_operand:DI 0 "arith_reg_dest" "=r") (mult:DI (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) @@ -2890,16 +2876,8 @@ (clobber (reg:SI MACH_REG)) (clobber (reg:SI MACL_REG))] "TARGET_SH2" - "#") - -(define_split - [(set (match_operand:DI 0 "arith_reg_dest" "") - (mult:DI - (sign_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) - (sign_extend:DI (match_operand:SI 2 "arith_reg_operand" "")))) - (clobber (reg:SI MACH_REG)) - (clobber (reg:SI MACL_REG))] - "TARGET_SH2" + "#" + "&& 1" [(const_int 0)] { rtx low_dst = gen_lowpart (SImode, operands[0]); @@ -2930,9 +2908,9 @@ [(set_attr "type" "dmpy")]) (define_expand "umulsidi3" - [(set (match_operand:DI 0 "arith_reg_operand" "=r") - (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) - (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" "r"))))] + [(set (match_operand:DI 0 "arith_reg_dest" "") + (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) + (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" ""))))] "TARGET_SH2 || TARGET_SHMEDIA" { if (TARGET_SH2) @@ -2951,7 +2929,7 @@ [(set_attr "type" "dmpy_media") (set_attr "highpart" "ignore")]) -(define_insn "umulsidi3_compact" +(define_insn_and_split "umulsidi3_compact" [(set (match_operand:DI 0 "arith_reg_dest" "=r") (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "r")) @@ -2959,15 +2937,8 @@ (clobber (reg:SI MACH_REG)) (clobber (reg:SI MACL_REG))] "TARGET_SH2" - "#") - -(define_split - [(set (match_operand:DI 0 "arith_reg_dest" "") - (mult:DI (zero_extend:DI (match_operand:SI 1 "arith_reg_operand" "")) - (zero_extend:DI (match_operand:SI 2 "arith_reg_operand" "")))) - (clobber (reg:SI MACH_REG)) - (clobber (reg:SI MACL_REG))] - "TARGET_SH2" + "#" + "&& 1" [(const_int 0)] { rtx low_dst = gen_lowpart (SImode, operands[0]); @@ -3366,9 +3337,9 @@ ;; ------------------------------------------------------------------------- (define_expand "rotldi3" - [(set (match_operand:DI 0 "arith_reg_dest" "=r") - (rotate:DI (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:HI 2 "mextr_bit_offset" "i")))] + [(set (match_operand:DI 0 "arith_reg_dest" "") + (rotate:DI (match_operand:DI 1 "arith_reg_operand" "") + (match_operand:HI 2 "mextr_bit_offset" "")))] "TARGET_SHMEDIA" "if (! mextr_bit_offset (operands[2], HImode)) FAIL;") @@ -3387,9 +3358,9 @@ [(set_attr "type" "arith_media")]) (define_expand "rotrdi3" - [(set (match_operand:DI 0 "arith_reg_dest" "=r") - (rotatert:DI (match_operand:DI 1 "arith_reg_operand" "r") - (match_operand:HI 2 "mextr_bit_offset" "i")))] + [(set (match_operand:DI 0 "arith_reg_dest" "") + (rotatert:DI (match_operand:DI 1 "arith_reg_operand" "") + (match_operand:HI 2 "mextr_bit_offset" "")))] "TARGET_SHMEDIA" { if (! mextr_bit_offset (operands[2], HImode)) @@ -3567,13 +3538,19 @@ shll%O2 %0" [(set_attr "type" "arith")]) -(define_insn "ashlsi3_n" +(define_insn_and_split "ashlsi3_n" [(set (match_operand:SI 0 "arith_reg_dest" "=r") (ashift:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand" "n"))) (clobber (reg:SI T_REG))] "TARGET_SH1 && ! sh_dynamicalize_shift_p (operands[2])" "#" + "TARGET_SH1 && reload_completed" + [(use (reg:SI R0_REG))] +{ + gen_shifty_op (ASHIFT, operands); + DONE; +} [(set (attr "length") (cond [(match_test "shift_insns_rtx (insn)") (const_string "2") @@ -3584,18 +3561,6 @@ (const_string "8"))) (set_attr "type" "arith")]) -(define_split - [(set (match_operand:SI 0 "arith_reg_dest" "") - (ashift:SI (match_operand:SI 1 "arith_reg_operand" "") - (match_operand:SI 2 "const_int_operand" ""))) - (clobber (reg:SI T_REG))] - "TARGET_SH1 && reload_completed" - [(use (reg:SI R0_REG))] -{ - gen_shifty_op (ASHIFT, operands); - DONE; -}) - (define_insn "ashlsi3_media" [(set (match_operand:SI 0 "arith_reg_dest" "=r,r") (ashift:SI (match_operand:SI 1 "extend_reg_operand" "r,r") @@ -3631,21 +3596,6 @@ FAIL; }) -(define_insn "*ashlhi3_n" - [(set (match_operand:HI 0 "arith_reg_dest" "=r") - (ashift:HI (match_operand:HI 1 "arith_reg_operand" "0") - (match_operand:HI 2 "const_int_operand" "n"))) - (clobber (reg:SI T_REG))] - "TARGET_SH1" - "#" - [(set (attr "length") - (cond [(match_test "shift_insns_rtx (insn)") - (const_string "2") - (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2)) - (const_string "4")] - (const_string "6"))) - (set_attr "type" "arith")]) - (define_expand "ashlhi3" [(parallel [(set (match_operand:HI 0 "arith_reg_operand" "") (ashift:HI (match_operand:HI 1 "arith_reg_operand" "") @@ -3661,17 +3611,26 @@ operands[1] = copy_to_mode_reg (HImode, operands[1]); }) -(define_split - [(set (match_operand:HI 0 "arith_reg_dest" "") - (ashift:HI (match_operand:HI 1 "arith_reg_operand" "") - (match_operand:HI 2 "const_int_operand" ""))) +(define_insn_and_split "*ashlhi3_n" + [(set (match_operand:HI 0 "arith_reg_dest" "=r") + (ashift:HI (match_operand:HI 1 "arith_reg_operand" "0") + (match_operand:HI 2 "const_int_operand" "n"))) (clobber (reg:SI T_REG))] - "TARGET_SH1 && reload_completed" + "TARGET_SH1" + "#" + "&& reload_completed" [(use (reg:SI R0_REG))] { gen_shifty_hi_op (ASHIFT, operands); DONE; -}) +} + [(set (attr "length") + (cond [(match_test "shift_insns_rtx (insn)") + (const_string "2") + (eq (symbol_ref "shift_insns_rtx (insn)") (const_int 2)) + (const_string "4")] + (const_string "6"))) + (set_attr "type" "arith")]) ;; ;; arithmetic shift right @@ -3694,19 +3653,13 @@ ;; ??? This should be a define expand. -(define_insn "ashrsi2_16" +(define_insn_and_split "ashrsi2_16" [(set (match_operand:SI 0 "arith_reg_dest" "=r") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 16)))] "TARGET_SH1" "#" - [(set_attr "length" "4")]) - -(define_split - [(set (match_operand:SI 0 "arith_reg_dest" "") - (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "") - (const_int 16)))] - "TARGET_SH1" + "&& 1" [(set (match_dup 0) (rotate:SI (match_dup 1) (const_int 16))) (set (match_dup 0) (sign_extend:SI (match_dup 2)))] { @@ -3715,21 +3668,14 @@ ;; ??? This should be a define expand. -(define_insn "ashrsi2_31" +(define_insn_and_split "ashrsi2_31" [(set (match_operand:SI 0 "arith_reg_dest" "=r") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (const_int 31))) (clobber (reg:SI T_REG))] "TARGET_SH1" "#" - [(set_attr "length" "4")]) - -(define_split - [(set (match_operand:SI 0 "arith_reg_dest" "") - (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "") - (const_int 31))) - (clobber (reg:SI T_REG))] - "TARGET_SH1" + "&& 1" [(const_int 0)] { emit_insn (gen_ashlsi_c (operands[0], operands[1])); @@ -3799,7 +3745,7 @@ (set_attr "highpart" "ignore")]) (define_expand "ashrsi3" - [(parallel [(set (match_operand:SI 0 "arith_reg_operand" "") + [(parallel [(set (match_operand:SI 0 "arith_reg_dest" "") (ashiftrt:SI (match_operand:SI 1 "arith_reg_operand" "") (match_operand:SI 2 "nonmemory_operand" ""))) (clobber (reg:SI T_REG))])] @@ -3846,13 +3792,19 @@ "shlr%O2 %0" [(set_attr "type" "arith")]) -(define_insn "lshrsi3_n" +(define_insn_and_split "lshrsi3_n" [(set (match_operand:SI 0 "arith_reg_dest" "=r") (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "0") (match_operand:SI 2 "const_int_operand" "n"))) (clobber (reg:SI T_REG))] "TARGET_SH1 && ! sh_dynamicalize_shift_p (operands[2])" "#" + "TARGET_SH1 && reload_completed" + [(use (reg:SI R0_REG))] +{ + gen_shifty_op (LSHIFTRT, operands); + DONE; +} [(set (attr "length") (cond [(match_test "shift_insns_rtx (insn)") (const_string "2") @@ -3863,18 +3815,6 @@ (const_string "8"))) (set_attr "type" "arith")]) -(define_split - [(set (match_operand:SI 0 "arith_reg_dest" "") - (lshiftrt:SI (match_operand:SI 1 "arith_reg_operand" "") - (match_operand:SI 2 "const_int_operand" ""))) - (clobber (reg:SI T_REG))] - "TARGET_SH1 && reload_completed" - [(use (reg:SI R0_REG))] -{ - gen_shifty_op (LSHIFTRT, operands); - DONE; -}) - (define_insn "lshrsi3_media" [(set (match_operand:SI 0 "arith_reg_dest" "=r,r") (lshiftrt:SI (match_operand:SI 1 "extend_reg_operand" "r,r")