public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Cooper <Andrew.Cooper3@citrix.com>
To: Mark Rutland <mark.rutland@arm.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"will@kernel.org" <will@kernel.org>,
	"marcan@marcan.st" <marcan@marcan.st>,
	"maz@kernel.org" <maz@kernel.org>,
	"szabolcs.nagy@arm.com" <szabolcs.nagy@arm.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"opendmb@gmail.com" <opendmb@gmail.com>,
	"Andrew Pinski" <pinskia@gmail.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"x86@kernel.org" <x86@kernel.org>,
	Jeremy Linton <jeremy.linton@arm.com>
Subject: Re: GCC 12 miscompilation of volatile asm (was: Re: [PATCH] arm64/io: Remind compiler that there is a memory side effect)
Date: Tue, 5 Apr 2022 13:20:50 +0000	[thread overview]
Message-ID: <7988e82a-8494-a954-0a79-7f86d34a96ad@citrix.com> (raw)
In-Reply-To: <Ykw+bVS9WY/JfoYO@FVFF77S0Q05N>

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

  reply	other threads:[~2022-04-05 13:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 16:44 [PATCH] arm64/io: Remind compiler that there is a memory side effect Jeremy Linton
2022-04-01 17:22 ` Mark Rutland
2022-04-03  7:36   ` Andrew Pinski
2022-04-03  7:47     ` Ard Biesheuvel
2022-04-03  7:47       ` Ard Biesheuvel
2022-04-04  9:14         ` Will Deacon
2022-04-03 17:40     ` Doug Berger
2022-04-05 12:51   ` GCC 12 miscompilation of volatile asm (was: Re: [PATCH] arm64/io: Remind compiler that there is a memory side effect) Mark Rutland
2022-04-05 13:04     ` Mark Rutland
2022-04-05 13:20       ` Andrew Cooper [this message]
2022-04-05 14:05     ` Peter Zijlstra
2022-04-11 10:22       ` Mark Rutland
2022-04-11 10:31     ` Mark Rutland
2022-04-11 19:02       ` Jeremy Linton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7988e82a-8494-a954-0a79-7f86d34a96ad@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=f.fainelli@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jeremy.linton@arm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=opendmb@gmail.com \
    --cc=peterz@infradead.org \
    --cc=pinskia@gmail.com \
    --cc=szabolcs.nagy@arm.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).