This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][AArch64] PR target/84748: Mark *compare_cstore<mode>_insn as clobbering CC reg
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, <nd at arm dot com>
- Date: Thu, 8 Mar 2018 13:32:37 +0000
- Subject: Re: [PATCH][AArch64] PR target/84748: Mark *compare_cstore<mode>_insn as clobbering CC reg
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=bestguesspass action=none header.from=arm.com;
- Nodisclaimer: True
- References: <5AA023DD.8030801@foss.arm.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Wed, Mar 07, 2018 at 05:39:41PM +0000, Kyrill Tkachov wrote:
> Hi all,
>
> In this wrong-code PR the combine pass ends up moving a CC-using instruction past a *compare_cstore<mode>_insn
> insn_and_split. After reload the *compare_cstore<mode>_insn splitter ends up generating a SUBS instruction that
> clobbers the condition flags, and things go bad.
>
> The solution is simple, the *compare_cstore<mode>_insn pattern should specify that it clobbers the CC register
> so that combine (or any other pass) does not assume that it can move CC-using patterns across it.
>
> This patch does that and fixes the testcase.
>
> The testcase FAILs on GCC 8 only, but the buggy pattern is in GCC 6 onwards, so we should backport this as
> a latent bug fix after it's had some time to bake in trunk.
>
> Bootstrapped and tested on aarch64-none-linux-gnu.
>
> Ok for trunk and later backports?
OK.
Thanks,
James
> 2018-03-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> PR target/84748
> * config/aarch64/aarch64.md (*compare_cstore<mode>_insn): Mark pattern
> as clobbering CC_REGNUM.
>
> 2018-03-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> PR target/84748
> * gcc.c-torture/execute/pr84748.c: New test.