From patchwork Fri May 29 02:06:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 477533 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 BF90514012C for ; Fri, 29 May 2015 12:07:06 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=rIwTyiwN; 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=hXtppAvdusjKmI6 TVuRE7tFih7FcttzyeLlVWJlCoav2zz1sXsDmJI5j+zaa2+aBfC/ViOaPV9LCYJl +g37fWsXtAN+BRJJaPd8CZtsvl/qBiWRSRO2GQpb3CfhseRcYosTv2f2lHM8O8QH /G6WzBSKM/cpzGotEvlmWb0PDcC8= 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=BlnfdwEiz1gE/1ljlSrW2 rzVX3Q=; b=rIwTyiwNm2eZwg18XQGW+i8/tMj8lwqky0f4tNfK09T//G5nYKSqu xrscJNNsVS9h19+tB2Tm5dn3UACrCFABUt52M3tFA5pjGo5HcORbDN8Dxwm3NFb3 sw9NSw1n7M00bW9KwKHKAr7551XMvkIeyXxKrNkwIfksIPWhwVey4E= Received: (qmail 22662 invoked by alias); 29 May 2015 02:06: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 22600 invoked by uid 89); 29 May 2015 02:06:57 -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_05, 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, 29 May 2015 02:06:56 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 8A11336506E for ; Fri, 29 May 2015 02:06:55 +0000 (UTC) Received: from greed.delorie.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4T26sOF012009 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 28 May 2015 22:06:55 -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 t4T26sgW018435 for ; Thu, 28 May 2015 22:06:54 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id t4T26rHk018433; Thu, 28 May 2015 22:06:53 -0400 Date: Thu, 28 May 2015 22:06:53 -0400 Message-Id: <201505290206.t4T26rHk018433@greed.delorie.com> From: DJ Delorie To: gcc-patches@gcc.gnu.org Subject: [expmed] Avoid clobbering a yet-to-be-used base/index register. X-IsSubscribed: yes 20040625-1 fails on targets with pointers bigger than WORD_SIZE (rl78, msp430/-mlarge) because the base register is clobbered, partially rebuilt with the new value, then used as a base for the second part of the calculation. Ok? * expmed.c (extract_bit_field_1): Avoid clobbering a yet-to-be-used base/index register. Index: expmed.c =================================================================== --- expmed.c (revision 223850) +++ expmed.c (working copy) @@ -1613,12 +1613,17 @@ extract_bit_field_1 (rtx str_rtx, unsign unsigned int i; rtx_insn *last; if (target == 0 || !REG_P (target) || !valid_multiword_target_p (target)) target = gen_reg_rtx (mode); + /* In case we're about to clobber a base register or something + (see gcc.c-torture/execute/20040625-1.c). */ + if (reg_mentioned_p (target, str_rtx)) + target = gen_reg_rtx (mode); + /* Indicate for flow that the entire target reg is being set. */ emit_clobber (target); last = get_last_insn (); for (i = 0; i < nwords; i++) {