From patchwork Tue Apr 22 14:22:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bruel X-Patchwork-Id: 341356 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0A120140121 for ; Wed, 23 Apr 2014 00:23:05 +1000 (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:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=TH8pC0oLwRL/Lrdhf1adoCkPnNQXWlMF3Fr67GrKo6u/s0 43yPAAvoGs+W8mw9uZdo42N6l+BsmqbJtrGQQGqp0PGrl6BNn0J6hLVl/p2LsBeh xBPsA1gHpXRM+cuH33gbcFyi2qMOQwX2uzJPEG07VC1etTPwDGDHKnOa607MQ= 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:date:from:mime-version:to:subject:content-type; s= default; bh=aKiSyBh7T1LTtuaJwpyRk6mP+js=; b=WYfBt+WYoqhYy72FZBQx Kxpcb5EZMe4O1kZu6opsphALje90D+DD5xTB0qZO1K1UpHlM2nvFaWdiQE8ucsKw xBh+wGz35oWjp09bGDXeyDLpJDmJ9+B8d5Vn+hSV5ki2JvC0W/H6bmeKESK8U2Ot jPZ9hRs2lW5VRKJ2NuFbINs= Received: (qmail 21092 invoked by alias); 22 Apr 2014 14:22:58 -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 21082 invoked by uid 89); 22 Apr 2014 14:22:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mx07-00178001.pphosted.com Received: from mx07-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (62.209.51.94) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 22 Apr 2014 14:22:57 +0000 Received: from pps.filterd (m0046670.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id s3MEEvjg001759; Tue, 22 Apr 2014 16:22:53 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 1kdqyk8p7q-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 22 Apr 2014 16:22:53 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 41DDF4E; Tue, 22 Apr 2014 14:22:47 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas2.st.com [10.75.90.16]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1ADFE2C9D2; Tue, 22 Apr 2014 14:22:47 +0000 (GMT) Received: from [164.129.122.166] (164.129.122.166) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.298.1; Tue, 22 Apr 2014 16:22:46 +0200 Message-ID: <53567B36.70507@st.com> Date: Tue, 22 Apr 2014 16:22:46 +0200 From: Christian Bruel User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Kaz Kojima , "gcc-patches@gcc.gnu.org" Subject: [PATCH, SH] Extend HIQI mode constants X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.96, 1.0.14, 0.0.0000 definitions=2014-04-22_05:2014-04-22, 2014-04-22, 1970-01-01 signatures=0 X-IsSubscribed: yes This patch allows constant propagation from HIQI modes, as illustrated by the attached testcase, by converting them into a new SImode pseudo. It also merge the HIQI mode patterns using general_movdst_operand for both. No regression on sh-none-elf. OK for trunk ? Thanks, 2014-04-22 Christian Bruel * config/sh/sh.md (mov): Replace movQIHI. Force immediates to SImode. 2014-04-22 Christian Bruel * gcc.target/sh/hiconst.c: New test. Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 209556) +++ gcc/config/sh/sh.md (working copy) @@ -6978,20 +6978,20 @@ label: [(set_attr "type" "sfunc") (set_attr "needs_delay_slot" "yes")]) -(define_expand "movhi" - [(set (match_operand:HI 0 "general_movdst_operand" "") - (match_operand:HI 1 "general_movsrc_operand" ""))] +(define_expand "mov" + [(set (match_operand:QIHI 0 "general_movdst_operand") + (match_operand:QIHI 1 "general_movsrc_operand"))] "" { - prepare_move_operands (operands, HImode); -}) + if (can_create_pseudo_p () && CONST_INT_P (operands[1]) + && REG_P (operands[0]) && REGNO (operands[0]) != R0_REG) + { + rtx reg = gen_reg_rtx(SImode); + emit_move_insn (reg, operands[1]); + operands[1] = gen_lowpart (mode, reg); + } -(define_expand "movqi" - [(set (match_operand:QI 0 "general_operand" "") - (match_operand:QI 1 "general_operand" ""))] - "" -{ - prepare_move_operands (operands, QImode); + prepare_move_operands (operands, mode); }) ;; Specifying the displacement addressing load / store patterns separately Index: gcc/testsuite/gcc.target/sh/hiconst.c =================================================================== --- gcc/testsuite/gcc.target/sh/hiconst.c (revision 0) +++ gcc/testsuite/gcc.target/sh/hiconst.c (working copy) @@ -0,0 +1,22 @@ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-O1" } */ + +char a; +int b; + +foo(char *pt, int *pti) +{ + a = 0; + b = 0; + *pt = 0; + *pti = 0; +} + +rab(char *pt, int *pti) +{ + pt[2] = 0; + pti[3] = 0; +} + +/* { dg-final { scan-assembler-times "mov\t#0" 2 } } */ +