From patchwork Tue Nov 5 12:00:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 288483 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 978462C00A9 for ; Tue, 5 Nov 2013 23:01:42 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:date:content-type:mime-version; q= dns; s=default; b=h31tqyUym932LEke94R4F84qQjJMf5iizAVD2HngGKDu8i H248MP11DlWva9Rysp3Skbr3jwpVA6svbV9+r/Gxi6u5pGbpHG0X7VKOLf0iC38V cF16UimPzVhx40aq6+s360HHs5nTDT7RPjseivdm6/26/ItQsdYco9F13pTlQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:date:content-type:mime-version; s= default; bh=YqCL5YwuaXSqe8HGpt6gHCcetF8=; b=DQxsbNPhiVpOUiLEa2C+ pO39NFmtWts28Un8oWEmsgEbW/ogVJPfpIateBE+o5mC3garndP0tP9w/dWyQxQE UP70m2TqrTIs0YjlSk4YUtKYzJ0voZIfmZ5cbXKKuBQtPJ8k2tmPiTNEup2E57MJ c6Uqj7ibyFfj2stzW/eL7EY= Received: (qmail 3791 invoked by alias); 5 Nov 2013 12:01:26 -0000 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 Received: (qmail 3777 invoked by uid 89); 5 Nov 2013 12:01:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mailout05.t-online.de Received: from Unknown (HELO mailout05.t-online.de) (194.25.134.82) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Nov 2013 12:00:39 +0000 Received: from fwd06.aul.t-online.de (fwd06.aul.t-online.de ) by mailout05.t-online.de with smtp id 1VdfIz-0007eV-UA; Tue, 05 Nov 2013 13:00:21 +0100 Received: from [192.168.0.103] (r1IKZ8Zr8hF-aFXpOfxpFpFbP36DntJp9-NgOkEiNDnk9JH-g0c+0Y2Up3loDJXgFe@[93.195.5.246]) by fwd06.t-online.de with esmtp id 1VdfIr-2DtTZw0; Tue, 5 Nov 2013 13:00:13 +0100 Message-ID: <1383652804.2445.395.camel@yam-132-YW-E178-FTW> Subject: [SH] Split addi,subdi,negdi before reload From: Oleg Endo To: gcc-patches Date: Tue, 05 Nov 2013 13:00:04 +0100 Mime-Version: 1.0 X-IsSubscribed: yes Hello, It seems that splitting multi-word insns before reload results in slightly better code on average (according to CSiBE). The attached patch implements that. Tested on rev. 204263 with make -k -j4 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. However, as far as I recall there have been some issues with this in the past, I just can't find/remember what it was exactly. Kaz, could you please run it through your test setup, too and let me know if it's OK for trunk? Thanks, Oleg gcc/ChangeLog: * config/sh/sh.md (adddi3): Remove empty constraints. Remove can_create_pseudo_p and arith_reg_operand check. (adddi3_compact, subdi3_compact, *negdi2): Remove constraints, split before reload. Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 204263) +++ gcc/config/sh/sh.md (working copy) @@ -1747,15 +1747,13 @@ ;; ------------------------------------------------------------------------- (define_expand "adddi3" - [(set (match_operand:DI 0 "arith_reg_operand" "") - (plus:DI (match_operand:DI 1 "arith_reg_operand" "") - (match_operand:DI 2 "arith_operand" "")))] + [(set (match_operand:DI 0 "arith_reg_operand") + (plus:DI (match_operand:DI 1 "arith_reg_operand") + (match_operand:DI 2 "arith_operand")))] "" { if (TARGET_SH1) { - if (!can_create_pseudo_p () && ! arith_reg_operand (operands[2], DImode)) - FAIL; operands[2] = force_reg (DImode, operands[2]); emit_insn (gen_adddi3_compact (operands[0], operands[1], operands[2])); DONE; @@ -1794,22 +1792,22 @@ (set_attr "highpart" "ignore")]) (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"))) + [(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" + "&& can_create_pseudo_p ()" [(const_int 0)] { - rtx high0 = gen_highpart (SImode, operands[0]); - rtx high2 = gen_highpart (SImode, operands[2]); - rtx low0 = gen_lowpart (SImode, operands[0]); - emit_insn (gen_clrt ()); - emit_insn (gen_addc (low0, low0, gen_lowpart (SImode, operands[2]))); - emit_insn (gen_addc (high0, high0, high2)); + emit_insn (gen_addc (gen_lowpart (SImode, operands[0]), + gen_lowpart (SImode, operands[1]), + gen_lowpart (SImode, operands[2]))); + emit_insn (gen_addc (gen_highpart (SImode, operands[0]), + gen_highpart (SImode, operands[1]), + gen_highpart (SImode, operands[2]))); DONE; }) @@ -2108,22 +2106,22 @@ (set_attr "highpart" "ignore")]) (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"))) + [(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" + "&& can_create_pseudo_p ()" [(const_int 0)] { - rtx high0 = gen_highpart (SImode, operands[0]); - rtx high2 = gen_highpart (SImode, operands[2]); - rtx low0 = gen_lowpart (SImode, operands[0]); - emit_insn (gen_clrt ()); - emit_insn (gen_subc (low0, low0, gen_lowpart (SImode, operands[2]))); - emit_insn (gen_subc (high0, high0, high2)); + emit_insn (gen_subc (gen_lowpart (SImode, operands[0]), + gen_lowpart (SImode, operands[1]), + gen_lowpart (SImode, operands[2]))); + emit_insn (gen_subc (gen_highpart (SImode, operands[0]), + gen_highpart (SImode, operands[1]), + gen_highpart (SImode, operands[2]))); DONE; }) @@ -5567,8 +5565,8 @@ "sub r63, %1, %0" [(set_attr "type" "arith_media")]) -;; Don't expand immediately because otherwise neg:DI (abs:DI) will not be -;; combined. +;; Don't split into individual negc insns immediately so that neg:DI (abs:DI) +;; can be combined. (define_expand "negdi2" [(parallel [(set (match_operand:DI 0 "arith_reg_dest") (neg:DI (match_operand:DI 1 "arith_reg_operand"))) @@ -5576,12 +5574,12 @@ "TARGET_SH1") (define_insn_and_split "*negdi2" - [(set (match_operand:DI 0 "arith_reg_dest" "=&r") - (neg:DI (match_operand:DI 1 "arith_reg_operand" "r"))) + [(set (match_operand:DI 0 "arith_reg_dest") + (neg:DI (match_operand:DI 1 "arith_reg_operand"))) (clobber (reg:SI T_REG))] "TARGET_SH1" "#" - "&& reload_completed" + "&& can_create_pseudo_p ()" [(const_int 0)] { emit_insn (gen_clrt ());