From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54945 invoked by alias); 13 Dec 2018 22:21:58 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 54803 invoked by uid 89); 13 Dec 2018 22:21:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=BAYES_00,KAM_NUMSUBJECT,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=UD:eu, 10PM, 10pm, sk:PIC_OFF X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Dec 2018 22:21:51 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXYXQ-0000VL-Hb for gcc-patches@gcc.gnu.org; Thu, 13 Dec 2018 16:28:59 -0500 Received: from server28.superhosting.bg ([217.174.156.11]:34605) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXYXQ-0000CI-2W for gcc-patches@gcc.gnu.org; Thu, 13 Dec 2018 16:28:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dinux.eu; s=default; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eyv44BnYKoN9HC1KqylSG2b/cxHepmqq4l7EBFcRDb4=; b=u8EqkdX5B5iTR3GPGoHfqWeHj+ we0OH1Ah09gS7ZCI6MJUdpLq+XwF1l6l96hEfXDuj3XFFBxX4Ml05y9hrGpwUG/Vz2IppxyogjcI0 Fm1AadsrBmUlqSfY79BG3pYVOEX23ea8JkkUV0UUITj+uS9hZYpVfr1QvgUXpW8Yns6H1aNe+lOb6 nhkbXx4tGyoH839B9vh4CV35ZI/t7kkCVToQi+Nl4b+vuMSDGZxbP+QEqRX4gCZEuIJ9/jQKT7tHr K3mRmypDxhGaviTg8dGSdh6eLyrJjsNX/+Qsnprx7Vtw3J4u8RahquYscPWzRBBc/QZ4zRL51QV7c KmSHmtHw==; Received: from [95.87.234.74] (port=50986 helo=tpdeb.localnet) by server28.superhosting.bg with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gXYVE-00077U-Qa; Thu, 13 Dec 2018 23:26:42 +0200 From: Dimitar Dimitrov To: Segher Boessenkool Cc: Christophe Lyon , Thomas Preudhomme , gcc Patches , Richard Sandiford , Thomas Preud'homme Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807 Date: Thu, 13 Dec 2018 22:21:00 -0000 Message-ID: <3948697.eYaff1WIgU@tpdeb> User-Agent: KMail/5.2.3 (Linux/4.9.0-8-amd64; KDE/5.28.0; x86_64; ; ) In-Reply-To: <20181213144837.GD3803@gate.crashing.org> References: <20181209100856.14051-1-dimitar@dinux.eu> <4591520.WeSID5Fo3g@tpdeb> <20181213144837.GD3803@gate.crashing.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-OutGoing-Spam-Status: No, score=-0.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.174.156.11 X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00984.txt.bz2 On Thu, Dec 13, 2018 at 8:48:38 EET Segher Boessenkool wrote: > On Wed, Dec 12, 2018 at 06:26:10PM +0200, Dimitar Dimitrov wrote: > > I expect that if I mark a HW register as "clobber", compiler would save > > its > > contents before executing the asm statement, and after that it would > > restore its contents. This is the GCC behaviour for all but the SP and > > PIC registers. That is why I believe that PR52813 is a valid bug. > > It won't do it for *any* fixed registers. But you do not want to error > or even warn for some fixed registers, for example the "flags" register > on x86 is *always* written to by asm. Yes, you are correct. > > But you never want to warn for non-fixed registers, and e.g. > PIC_OFFSET_TABLE_REGNUM isn't always a fixed register (when flag_pic is 0 > for example). I could not trace how PIC_OFFSET_TABLE_REGNUM on i386 gets marked as fixed register. I'll dig more through the source. > > > I'm not sure how GCC could recover if SP is clobbered. If SP is clobbered > > in such a way that GCC will not notice (e.g. thread switching), then why > > should GCC know about it in the first place? > > Up until today, GCC has always just ignored it if you claimed to clobber > the stack pointer. My point is that the silent ignoring is confusing to users, as shown by PR52813. How would you suggest me to proceed: - Leave patch as-is. - Revert patch. Update documentation to point that clobber marker for fixed registers is ignored by GCC. Close PR52813 as invalid. - Revert patch. Discuss more broadly and specify behaviour of asm clobber for fixed registers (and SP in particular). Thanks, Dimitar