From patchwork Mon Sep 1 14:22:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 384882 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 F37BD1401B1 for ; Tue, 2 Sep 2014 00:23:14 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=Qyie5V3arteo6y1/pRT03Fkv29PvsKy+zhw9wRIE3aHQOt3KhR wpyPrqj8V/hNu4OwHZAVz46Wg5+QRQZgyCblYtpZzwJkyz75iVM7YXi5nSt0XUbL CCd+ulKEiVoU5KmKwxIALx46d1QBRDPWAZfRzda07ExWIASv5ZTISQ6OE= 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 :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=nVs7J5ZHeY6XnjKIPkAGBM2dwlQ=; b=lkvMl4bubh4zINBq3VdZ XOtB/5JTFLW2GRcSoRI2Wzt7ZO1XKjvKsDhNV1h5TM6vt13SHNx132pnVFO1WVZG lLkuZY4DLAvAi/YouZBSftklryo2s1Iz+xOpLTVAhdmxk827iSeoio7nsF2W8Cqy nqpzMyyn1qR1Y4J1HtDJMiU= Received: (qmail 6788 invoked by alias); 1 Sep 2014 14:23:02 -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 6777 invoked by uid 89); 1 Sep 2014 14:23:00 -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_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 Sep 2014 14:22:50 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XOSVJ-0000T8-8S from Maciej_Rozycki@mentor.com ; Mon, 01 Sep 2014 07:22:46 -0700 Received: from localhost (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.2.247.3; Mon, 1 Sep 2014 15:22:43 +0100 Date: Mon, 1 Sep 2014 15:22:39 +0100 From: "Maciej W. Rozycki" To: David Edelsohn CC: Subject: [PATCH] Power/GCC: Fix e500 vs non-e500 register save slot issue Message-ID: User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Hi, This fixes an issue with the mode used for register save slots on the stack where e500 processor support is enabled along non-e500 multilibs. In that case the HARD_REGNO_CALLER_SAVE_MODE macro definition from gcc/config/rs6000/e500.h overrides one in gcc/config/rs6000/rs6000.h even for non-e500 multilibs. I think the ABI for a given multilib must not change with other multilibs being enabled or disabled. I have therefore rewritten the generic macro to take both e500 and non-e500 cases into account, following the preexisting case of TARGET_DF_SPE -- there's no run-time performance hit for purely non-e500 targets as TARGET_E500_DOUBLE then expands to 0 and the extra e500 support code is optimised away. The change doesn't make the TARGET_VSX case check for TARGET_E500_DOUBLE being clear, as the two are mutually exclusive and guarded by CHECK_E500_OPTIONS already. This fixes: FAIL: gcc.target/powerpc/pr47862.c scan-assembler-not stfd failures on non-e500 multilibs. Regression-tested with the following powerpc-gnu-linux multilibs: -mcpu=603e -mcpu=603e -msoft-float -mcpu=8540 -mfloat-gprs=single -mspe=yes -mabi=spe -mcpu=8548 -mfloat-gprs=double -mspe=yes -mabi=spe -mcpu=7400 -maltivec -mabi=altivec -mcpu=e6500 -maltivec -mabi=altivec -mcpu=e5500 -m64 -mcpu=e6500 -m64 -maltivec -mabi=altivec OK to apply? 2014-09-01 Maciej W. Rozycki gcc/ * config/rs6000/e500.h (HARD_REGNO_CALLER_SAVE_MODE): Remove macro. * config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Handle TARGET_E500_DOUBLE case here. Maciej gcc-power-linux-e500-hard-regno-caller-save-mode.diff Index: gcc-fsf-trunk-quilt/gcc/config/rs6000/e500.h =================================================================== --- gcc-fsf-trunk-quilt.orig/gcc/config/rs6000/e500.h 2014-08-21 14:11:19.037911725 +0100 +++ gcc-fsf-trunk-quilt/gcc/config/rs6000/e500.h 2014-08-26 20:37:43.398961962 +0100 @@ -43,12 +43,3 @@ error ("E500 and FPRs not supported"); \ } \ } while (0) - -/* Override rs6000.h definition. */ -#undef HARD_REGNO_CALLER_SAVE_MODE -/* When setting up caller-save slots (MODE == VOIDmode) ensure we - allocate space for DFmode. Save gprs in the correct mode too. */ -#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ - (TARGET_E500_DOUBLE && ((MODE) == VOIDmode || (MODE) == DFmode) \ - ? DFmode \ - : choose_hard_reg_mode ((REGNO), (NREGS), false)) Index: gcc-fsf-trunk-quilt/gcc/config/rs6000/rs6000.h =================================================================== --- gcc-fsf-trunk-quilt.orig/gcc/config/rs6000/rs6000.h 2014-08-26 20:30:10.348973028 +0100 +++ gcc-fsf-trunk-quilt/gcc/config/rs6000/rs6000.h 2014-08-26 20:37:43.398961962 +0100 @@ -1186,9 +1186,11 @@ enum data_align { align_abi, align_opt, && ((MODE) == VOIDmode || ALTIVEC_OR_VSX_VECTOR_MODE (MODE)) \ && FP_REGNO_P (REGNO) \ ? V2DFmode \ - : ((MODE) == TFmode && FP_REGNO_P (REGNO)) \ + : TARGET_E500_DOUBLE && ((MODE) == VOIDmode || (MODE) == DFmode) \ ? DFmode \ - : ((MODE) == TDmode && FP_REGNO_P (REGNO)) \ + : !TARGET_E500_DOUBLE && (MODE) == TFmode && FP_REGNO_P (REGNO) \ + ? DFmode \ + : !TARGET_E500_DOUBLE && (MODE) == TDmode && FP_REGNO_P (REGNO) \ ? DImode \ : choose_hard_reg_mode ((REGNO), (NREGS), false))