From patchwork Sat Jul 7 09:42:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 169571 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 63C4B2C0203 for ; Sat, 7 Jul 2012 19:42:54 +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=1342258975; 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=58rAt269KE4yqOKCLqmN roztZLM=; b=CaqUdmHtLUy3qLq3Q539GqMrECZX3CH6Q3tLAdULcMnFowNm4NsH 5gE7z+XKFxmcoetfKWkSJVYkVzxJO2Ye5D8kD1OjxCrcf8xHYomlkpxHIT+lIjV+ 7r73Tt7tHFSQo8zf1hOn81KnrnVnngNR+XRaxj8BmAj1MnBcvTfxIk0= 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=Pp4c4WSaB7MDRz5QIJuHuvI2Ia5jJev73QsrAx9Ifio27f5Y5voYiEy9OY9pHX kWtCfIECO/yFPXuo7zgqayYDP83XB380Q2cPRM+a/Jq3wJz5KHWEUxK+pjH0am7E IP3uYRokSb01vLcfkeAocuWCogLhiMUiDmxyWNNDZp0Vk=; Received: (qmail 29499 invoked by alias); 7 Jul 2012 09:42:47 -0000 Received: (qmail 29483 invoked by uid 22791); 7 Jul 2012 09:42:45 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout11.t-online.de (HELO mailout11.t-online.de) (194.25.134.85) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 Jul 2012 09:42:32 +0000 Received: from fwd08.aul.t-online.de (fwd08.aul.t-online.de ) by mailout11.t-online.de with smtp id 1SnRX4-0000x3-9v; Sat, 07 Jul 2012 11:42:30 +0200 Received: from [192.168.0.104] (VTw12gZfYhCa-O23VZSgBpzXgRq4g8K54go03peukvjFOeG1UEuT3+EsvDGSYYMZIp@[93.218.168.173]) by fwd08.t-online.de with esmtp id 1SnRWw-0VOKAK0; Sat, 7 Jul 2012 11:42:22 +0200 Message-ID: <1341654137.2228.7.camel@yam-132-YW-E178-FTW> Subject: [SH] PR 51244 - Add nott insn From: Oleg Endo To: gcc-patches Date: Sat, 07 Jul 2012 11:42:17 +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 adds the 'nott' insn that is supported by SH2A. While the 'nott' pattern itself is usually combined away entirely (CSiBE shows no diffs for SH2A), on non-SH2A the new patterns seem to catch a few border cases, where unnecessary movt sequences can be eliminated. Tested against rev 189338 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. Cheers, Oleg ChangeLog: * config/sh/sh.md (*branch_true_eq, *branch_false_ne, nott): New insns. Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 189269) +++ gcc/config/sh/sh.md (working copy) @@ -7220,6 +7220,17 @@ } [(set_attr "type" "cbranch")]) +(define_insn "*branch_true_eq" + [(set (pc) (if_then_else (eq (match_operand 1 "t_reg_operand" "") + (const_int 1)) + (label_ref (match_operand 0 "" "")) + (pc)))] + "TARGET_SH1" +{ + return output_branch (1, insn, operands); +} + [(set_attr "type" "cbranch")]) + (define_insn "branch_false" [(set (pc) (if_then_else (eq (match_operand 1 "t_reg_operand" "") (const_int 0)) @@ -7231,6 +7242,17 @@ } [(set_attr "type" "cbranch")]) +(define_insn "*branch_false_ne" + [(set (pc) (if_then_else (ne (match_operand 1 "t_reg_operand" "") + (const_int 1)) + (label_ref (match_operand 0 "" "")) + (pc)))] + "TARGET_SH1" +{ + return output_branch (0, insn, operands); +} + [(set_attr "type" "cbranch")]) + ;; Patterns to prevent reorg from re-combining a condbranch with a branch ;; which destination is too far away. ;; The const_int_operand is distinct for each branch target; it avoids @@ -9844,6 +9866,20 @@ "" [(const_int 0)]) +(define_insn_and_split "nott" + [(set (reg:SI T_REG) (xor:SI (reg:SI T_REG) (const_int 1)))] + "TARGET_SH1" +{ + gcc_assert (TARGET_SH2A); + return "nott"; +} + "! TARGET_SH2A && can_create_pseudo_p ()" + [(set (match_dup 0) (reg:SI T_REG)) + (set (reg:SI T_REG) (eq:SI (match_dup 0) (const_int 0)))] +{ + operands[0] = gen_reg_rtx (SImode); +}) + (define_expand "cstoresf4" [(set (match_operand:SI 0 "register_operand" "=r") (match_operator:SI 1 "sh_float_comparison_operator"