From patchwork Mon Dec 8 14:18:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 418699 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 5384C1400DD for ; Tue, 9 Dec 2014 01:19:01 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; q=dns; s=default; b=inCYyxXuo0F7mOWzUCm hXZkfod15ZHY5KFMzD5YOEyLf+F3R8WiRunMNjv9g7toskn2qQB4nl/ELrg0bOJW 7YibvAH0GBwpbL79r62xR+RQEwDI4d3NAe7V941xFUKNcSZ4l6D/3HMgFXn6HTRM b0fg6YGMh75Co1Z7M/HD3yZY= 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:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; s=default; bh=NIoRQd6O5l+UR9Jcw+Mivm7Uj sA=; b=D9kNcrRgTCNQT7T/+RLcojY0SZm7aHaURGPubUx5IfNfEmPAbwYwuEYgB 09/L1nfCt70A6y6IM2aCcnuS88AkcR7xU8m0A330gSsl1EJZ9JtwyAeEZvBkkhaI lv4HrjjpmeNFzBBeZfNnrQNLZqWi9f9kzgSlW2Uu72EKTjA20g= Received: (qmail 17148 invoked by alias); 8 Dec 2014 14:18:24 -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 17128 invoked by uid 89); 8 Dec 2014 14:18:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 08 Dec 2014 14:18:23 +0000 Received: from gcc1-power7.osuosl.org (localhost [127.0.0.1]) by gcc1-power7.osuosl.org (8.14.6/8.14.6) with ESMTP id sB8EIL0g032550; Mon, 8 Dec 2014 06:18:21 -0800 Received: (from segher@localhost) by gcc1-power7.osuosl.org (8.14.6/8.14.6/Submit) id sB8EILmT032549; Mon, 8 Dec 2014 06:18:21 -0800 From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com, Segher Boessenkool Subject: [PATCH 01/10] rs6000: Clobber XER[CA] in all user asm statements Date: Mon, 8 Dec 2014 06:18:02 -0800 Message-Id: <7a4b7bd73211032ecf856de06a20e14a323e08ba.1418024189.git.segher@kernel.crashing.org> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes A lot of old user code clobbers the carry bit without telling the compiler about it. This used to just work, because the compiler never used the bit outside of a single RTL instruction. But that will change. Let's clobber the carry bit in every asm; this isn't very expensive. 2014-12-08 Segher Boessenkool gcc/ PR target/64180 * config/rs6000/rs6000.c (TARGET_MD_ASM_CLOBBERS): Define. (rs6000_md_asm_clobbers): New function. --- gcc/config/rs6000/rs6000.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index cdb9de9..e58fc81 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1556,6 +1556,9 @@ static const struct attribute_spec rs6000_attribute_table[] = #undef TARGET_ASM_LOOP_ALIGN_MAX_SKIP #define TARGET_ASM_LOOP_ALIGN_MAX_SKIP rs6000_loop_align_max_skip +#undef TARGET_MD_ASM_CLOBBERS +#define TARGET_MD_ASM_CLOBBERS rs6000_md_asm_clobbers + #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE rs6000_option_override @@ -3146,6 +3149,19 @@ rs6000_builtin_mask_calculate (void) | ((TARGET_LONG_DOUBLE_128) ? RS6000_BTM_LDBL128 : 0)); } +/* Implement TARGET_MD_ASM_CLOBBERS. All asm statements are considered + to clobber the XER[CA] bit because clobbering that bit without telling + the compiler worked just fine with versions of GCC before GCC 5, and + breaking a lot of older code in ways that are hard to track down is + not such a great idea. */ + +static tree +rs6000_md_asm_clobbers (tree, tree, tree clobbers) +{ + tree s = build_string (strlen (reg_names[CA_REGNO]), reg_names[CA_REGNO]); + return tree_cons (NULL_TREE, s, clobbers); +} + /* Override command line options. Mostly we process the processor type and sometimes adjust other TARGET_ options. */