From patchwork Fri Dec 14 23:28:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 153916 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2653101ljp; Fri, 14 Dec 2018 15:28:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ut4iCll8rqHEX0Xflqz4yWUBE0HiWrErbh92lFJbyldTaHBvXc/bgaGpDspMzGPvkKKH+C X-Received: by 2002:a63:554b:: with SMTP id f11mr4516046pgm.37.1544830110261; Fri, 14 Dec 2018 15:28:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544830110; cv=none; d=google.com; s=arc-20160816; b=uRsomft4BvgmIL2Dy5UHPmz4X3NnpeqpZjcUOX0/+HDHZLhVbFhBi5FNVGLTa1HhCd IN6PUVnCmlqnic7JAdpPaAG2W8ipi5zdK7FS2/NBVny8z6eSed1Xoz0ZZx9YFHr2CazB b8GwOmn3R/5F115//0EwUDmSXqQePsNDw3WPliSBwbj0Bp5TU/Ce2ORCGPZ4CNDn6AP8 fs9P1d/mgEOYYkCRpojUZA9Z8h4eSdD8aK2nnGz+BhJQpNinqGuz9oTBFVyDRU+0A+JJ JlOb9CdM0S90XNBKC1/AQusIA9RxGZAN7LQJ/45hJMeL0vasJ7AS0kNskN2xr0lSOhi2 ndng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature :delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=sWWbXrbINZprZ741aAr+PMrKuGGfqse36LNCUx8HT6c=; b=e4IpTkmRmTvLeLmzglRmregxS2sZWbc/1xbseZaBfJDYdiHCxO8buccS6dav93yR/P qQ0DZlyeZ6f3+k6SOh8ksLE1YbSsn+uUt4EGBX33Yq7tkDWSl/zz3zIZpZ8b5K0K5CdU vcd03zmy4YucqmX3YUg4egnYVpFkJ84eWCDqyzaIknV+Ln68FuD2+sA2HZv1t8RG9VB1 20Bmdy6amNOdaI8JUhO7n4rk8ZLDO4QNaKVUPmrUyqQE4113lxQGK8PXsPCfY5J2AjYe pcxDbcxg4VFlaiKHpBAaJVp6jSGdTqEcLh0V7P+FYx1rf8jaNiwJ7wJ3UdGXqXQpi+cw GglQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JgbYNDQF; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YqE0++7T; spf=pass (google.com: domain of gcc-patches-return-492553-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-492553-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z14si4550081pgz.180.2018.12.14.15.28.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 15:28:30 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-492553-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JgbYNDQF; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=YqE0++7T; spf=pass (google.com: domain of gcc-patches-return-492553-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-492553-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=d+iQzUKAj6Orfbok96sJskB5aslJ0swihNqkUEeTwjWAUh XGA8iFMISTK15yWw+611GkAggwz1j+xjLP+9XzwNC9L0Qr7XORNUegzDoTeThvYF JR5oekgt8plsdmm8fg+qMuQDle+ZV3aavtyfdk5ptBrH6KE5TC1UsUFx3OfXc= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=8YNWHb5qM+07WCXdts1kGc4Xw0o=; b=JgbYNDQFcln5KBn5GCeW zaaLvUt06rEWLfXDrM+VjY9MBcp3+ZNlTJXK1ebg6U3xXoGWmcnzPV/J0bgf4uZA pd+USPgjTagdmjteeAUAuh6qItd8ejKOc5RrMpZOukD3BheN+0E0gePO9j714IJZ EA4y++RiOP9jF2/WikBTYLI= Received: (qmail 23837 invoked by alias); 14 Dec 2018 23:28:19 -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 23823 invoked by uid 89); 14 Dec 2018 23:28:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=r242693, amodragmailcom, saving, flag_pic X-HELO: mail-it1-f181.google.com Received: from mail-it1-f181.google.com (HELO mail-it1-f181.google.com) (209.85.166.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Dec 2018 23:28:15 +0000 Received: by mail-it1-f181.google.com with SMTP id g85so11335638ita.3 for ; Fri, 14 Dec 2018 15:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=4TOniY0sgJ79alE01mBK8w0v9vJqpFserBaj6tAl2yw=; b=YqE0++7TzThsPfeAmj8P1ZGS/83qUZwHsSmGtIhUlz+S48BtaU9TnlMzfauf8NPVhP Jgg+NriL7pqrM/vPfMFBk5JyosJwF2xUrYaAIbPoXnByRtcvoBaIm1OGkDjmGYXwPFGL RICuGsNovX13cTIJuZ29K4jx87WleMzeRwwuo= MIME-Version: 1.0 From: Thomas Preudhomme Date: Fri, 14 Dec 2018 23:28:02 +0000 Message-ID: Subject: [PATCH, ARM] Fix PR77904 testcase failure To: kyrylo.tkachov@foss.arm.com, Ramana Radhakrishnan , Richard Earnshaw , gcc-patches@gcc.gnu.org X-IsSubscribed: yes Hi, Commit r242693 forced fp to be saved/restored when needed due to an instance of GCC using fp as a scratch register to save sp while it's being clobbered by an inline asm. The normal path in thumb1_compute_save_reg_mask saving callee-saved registers which are live in the function does not work in that case because fp is chosen to hold sp after that function is called. Since clobbering sp is now errored out by the compiler and this was the only case reported where fp was live but not marked as such when thumb1_compute_save_reg_mask is called, I believe the whole commit r242693 should be reverted. ChangeLog entries are as follows: *** gcc/ChangeLog *** 2018-12-14 Thomas Preud'homme Revert: 2016-11-22 Thomas Preud'homme PR target/77904 * config/arm/arm.c (thumb1_compute_save_reg_mask): Mark frame pointer in save register mask if it is needed. *** gcc/testsuite/ChangeLog *** 2018-12-14 Thomas Preud'homme Revert: 2016-11-22 Thomas Preud'homme PR target/77904 * gcc.target/arm/pr77904.c: New test. Testing: Built an arm-none-eabi GCC cross-compiler targeting Armv6S-M and regression testsuite does not show any regression. Ok for stage3? Best regards, Thomas >From 63c52e7bf932947be7122cdc63f6cdc913479259 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 14 Dec 2018 16:02:59 +0000 Subject: [PATCH] [PATCH, ARM] Fix PR77904 testcase failure Hi, Commit r242693 forced fp to be saved/restored when needed due to an instance of GCC using fp as a scratch register to save sp while it's being clobbered by an inline asm. The normal path in thumb1_compute_save_reg_mask saving callee-saved registers which are live in the function does not work in that case because fp is chosen to hold sp after that function is called. Since clobbering sp is now errored out by the compiler and this was the only case reported where fp was live but not marked as such when thumb1_compute_save_reg_mask is called, I believe the whole commit r242693 should be reverted. ChangeLog entries are as follows: *** gcc/ChangeLog *** 2018-12-14 Thomas Preud'homme Revert: 2016-11-22 Thomas Preud'homme PR target/77904 * config/arm/arm.c (thumb1_compute_save_reg_mask): Mark frame pointer in save register mask if it is needed. *** gcc/testsuite/ChangeLog *** 2018-12-14 Thomas Preud'homme Revert: 2016-11-22 Thomas Preud'homme PR target/77904 * gcc.target/arm/pr77904.c: New test. Testing: Built an arm-none-eabi GCC cross-compiler targeting Armv6S-M and regression testsuite does not show any regression. Ok for stage3? Best regards, Thomas --- gcc/ChangeLog | 9 ++++++ gcc/config/arm/arm.c | 4 --- gcc/testsuite/ChangeLog | 8 +++++ gcc/testsuite/gcc.target/arm/pr77904.c | 45 -------------------------- 4 files changed, 17 insertions(+), 49 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/arm/pr77904.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8e374fb15f..9caeb1d5e18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-12-14 Thomas Preud'homme + + Revert: + 2016-11-22 Thomas Preud'homme + + PR target/77904 + * config/arm/arm.c (thumb1_compute_save_reg_mask): Mark frame pointer + in save register mask if it is needed. + 2018-11-27 Alan Modra * config/rs6000/aix71.h (ASM_SPEC): Don't select default -maix64 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 40f0574e32e..2ab5d8abc33 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -19553,10 +19553,6 @@ thumb1_compute_save_core_reg_mask (void) if (df_regs_ever_live_p (reg) && callee_saved_reg_p (reg)) mask |= 1 << reg; - /* Handle the frame pointer as a special case. */ - if (frame_pointer_needed) - mask |= 1 << HARD_FRAME_POINTER_REGNUM; - if (flag_pic && !TARGET_SINGLE_PIC_BASE && arm_pic_register != INVALID_REGNUM diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e1f6d05a45..4e58c8940da 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2018-12-14 Thomas Preud'homme + + Revert: + 2016-11-22 Thomas Preud'homme + + PR target/77904 + * gcc.target/arm/pr77904.c: New test. + 2018-11-27 Jozef Lawrynowicz * lib/target-supports.exp diff --git a/gcc/testsuite/gcc.target/arm/pr77904.c b/gcc/testsuite/gcc.target/arm/pr77904.c deleted file mode 100644 index 76728c07e73..00000000000 --- a/gcc/testsuite/gcc.target/arm/pr77904.c +++ /dev/null @@ -1,45 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2" } */ - -__attribute__ ((noinline, noclone)) void -clobber_sp (void) -{ - __asm volatile ("" : : : "sp"); -} - -int -main (void) -{ - int ret; - - __asm volatile ("mov\tr4, #0xf4\n\t" - "mov\tr5, #0xf5\n\t" - "mov\tr6, #0xf6\n\t" - "mov\tr7, #0xf7\n\t" - "mov\tr0, #0xf8\n\t" - "mov\tr8, r0\n\t" - "mov\tr0, #0xfa\n\t" - "mov\tr10, r0" - : : : "r0", "r4", "r5", "r6", "r7", "r8", "r10"); - clobber_sp (); - - __asm volatile ("cmp\tr4, #0xf4\n\t" - "bne\tfail\n\t" - "cmp\tr5, #0xf5\n\t" - "bne\tfail\n\t" - "cmp\tr6, #0xf6\n\t" - "bne\tfail\n\t" - "cmp\tr7, #0xf7\n\t" - "bne\tfail\n\t" - "mov\tr0, r8\n\t" - "cmp\tr0, #0xf8\n\t" - "bne\tfail\n\t" - "mov\tr0, r10\n\t" - "cmp\tr0, #0xfa\n\t" - "bne\tfail\n\t" - "mov\t%0, #1\n" - "fail:\n\t" - "sub\tr0, #1" - : "=r" (ret) : :); - return ret; -} -- 2.19.1