[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7988e82a-8494-a954-0a79-7f86d34a96ad@citrix.com>
Date: Tue, 5 Apr 2022 13:20:50 +0000
From: Andrew Cooper <Andrew.Cooper3@...rix.com>
To: Mark Rutland <mark.rutland@....com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"gcc@....gnu.org" <gcc@....gnu.org>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"will@...nel.org" <will@...nel.org>,
"marcan@...can.st" <marcan@...can.st>,
"maz@...nel.org" <maz@...nel.org>,
"szabolcs.nagy@....com" <szabolcs.nagy@....com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"opendmb@...il.com" <opendmb@...il.com>,
"Andrew Pinski" <pinskia@...il.com>,
Ard Biesheuvel <ardb@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"x86@...nel.org" <x86@...nel.org>,
Jeremy Linton <jeremy.linton@....com>
Subject: Re: GCC 12 miscompilation of volatile asm (was: Re: [PATCH] arm64/io:
Remind compiler that there is a memory side effect)
On 05/04/2022 14:04, Mark Rutland wrote:
> On Tue, Apr 05, 2022 at 01:51:30PM +0100, Mark Rutland wrote:
> My x86_64 test case is:
>
> Per compiler explorer (https://godbolt.org/z/cveff9hq5) GCC trunk currently
> compiles this as:
>
> | msr_rmw_set_bits:
> | mov rcx, rdi
> | rdmsr
> | sal rdx, 32
> | mov eax, eax
> | or rax, rsi
> | or rax, rdx
> | mov rdx, rax
> | shr rdx, 32
> | wrmsr
> | ret
> | func_with_msr_side_effects:
> | ret
>
Yeah... that code gen is very broken for func_with_msr_side_effects().
~Andrew
Powered by blists - more mailing lists