From patchwork Fri Jun 5 05:00:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 481026 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 7407F1401F6 for ; Fri, 5 Jun 2015 15:00:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=AUxwQyb9; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject; q=dns; s=default; b=l2NUVvJo8PtSHp1 +eE/koDD62qpQL4n6o12uPLjGF9b5UY2DfJu2HRjQcwGlWK4l09GehUZ1Pb1txQs Swv66odouX7eVTexEAMESBlzHkaakq3ulMrMvqCes5e7QLMBZdTpwsbCHM8i+Oqv XWGWKERr0GSq2jDyHKP5oYSjrMT8= 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:date :message-id:from:to:subject; s=default; bh=j5vv5bDBqU/sVTfm45mTp mUv1bE=; b=AUxwQyb9dZZmV9WVGcZqbc5vSXEv/3ZbUnnO3f9B2oQbKbgCquodl 2JU7L15BTugFWwNUyW/wLllHIBLpvKtlDgZlQG/b4KSeLQnpK42o5GyfIfxhAZpV GaQH4bguWXDkS1eOiHn67mYaQTPglrHLT7PR9UdPIbUBdWBg9wbXJE= Received: (qmail 115626 invoked by alias); 5 Jun 2015 05:00:16 -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 115588 invoked by uid 89); 5 Jun 2015 05:00:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 05 Jun 2015 05:00:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 556E3AC7C9 for ; Fri, 5 Jun 2015 05:00:10 +0000 (UTC) Received: from greed.delorie.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t55509YZ008598 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 5 Jun 2015 01:00:10 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id t55508C1024778 for ; Fri, 5 Jun 2015 01:00:08 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id t55508sB024772; Fri, 5 Jun 2015 01:00:08 -0400 Date: Fri, 5 Jun 2015 01:00:08 -0400 Message-Id: <201506050500.t55508sB024772@greed.delorie.com> From: DJ Delorie To: gcc-patches@gcc.gnu.org Subject: [msp430] special case sym->SI moves X-IsSubscribed: yes Symbols are normally PSImode, and the MSP430 has PSImode registers and PSImode moves to reg/mem. But sometimes gcc uses an SImode move instead, if the result will later be used in SImode (as in getP() in gcc/testsuite/gcc.dg/torture/pr65077.c). Committed. * config/msp430/msp430.md (movsi_s): New. Special case for storing a 20-bit symbol into a 32-bit register. * config/msp430/msp430.c (msp430_subreg): Add support for it. * config/msp430/predicates.md (msp430_symbol_operand): New. Index: gcc/config/msp430/predicates.md =================================================================== --- gcc/config/msp430/predicates.md (revision 224143) +++ gcc/config/msp430/predicates.md (working copy) @@ -79,6 +79,10 @@ ; TRUE for constants which are bit positions for zero_extract (define_predicate "msp430_bitpos" (and (match_code "const_int") (match_test (" INTVAL (op) >= 0 && INTVAL (op) <= 15 ")))) + +(define_predicate "msp430_symbol_operand" + (match_code "symbol_ref") +) Index: gcc/config/msp430/msp430.md =================================================================== --- gcc/config/msp430/msp430.md (revision 224143) +++ gcc/config/msp430/msp430.md (working copy) @@ -211,12 +211,25 @@ [(set (match_operand:SI 0 "nonimmediate_operand") (match_operand:SI 1 "general_operand"))] "" "" ) +(define_insn_and_split "movsi_s" + [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") + (subreg:SI (match_operand:PSI 1 "msp430_symbol_operand" "i") 0))] + "" + "" + "reload_completed" + [(set (match_operand:HI 2 "nonimmediate_operand") + (match_operand:HI 4 "general_operand")) + (set (match_operand:HI 3 "nonimmediate_operand") + (match_operand:HI 5 "general_operand"))] + "msp430_split_movsi (operands);" + ) + (define_insn_and_split "movsi_x" [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") (match_operand:SI 1 "general_operand" "rmi"))] "" "#" "reload_completed" Index: gcc/config/msp430/msp430.c =================================================================== --- gcc/config/msp430/msp430.c (revision 224143) +++ gcc/config/msp430/msp430.c (working copy) @@ -2371,12 +2371,19 @@ msp430_subreg (machine_mode mode, rtx r, rv = gen_rtx_SUBREG (mode, ireg, byte); else rv = simplify_gen_subreg (mode, ireg, imode, byte); } else if (GET_CODE (r) == MEM) rv = adjust_address (r, mode, byte); + else if (GET_CODE (r) == SYMBOL_REF + && (byte == 0 || byte == 2) + && mode == HImode) + { + rv = gen_rtx_ZERO_EXTRACT (HImode, r, GEN_INT (16), GEN_INT (8*byte)); + rv = gen_rtx_CONST (HImode, r); + } else rv = simplify_gen_subreg (mode, r, omode, byte); if (!rv) gcc_unreachable ();