Re: [PATCH] arm64/io: Don't use WZR in writel

From: Robin Murphy
Date: Mon Mar 18 2019 - 13:59:24 EST


On 18/03/2019 17:30, Marc Gonzalez wrote:
On 18/03/2019 18:19, Robin Murphy wrote:

For the context bank reset, yes, I am assuming that no complier will
ever be perverse enough to detect that cfg is not written after the
NULL check and immediately reallocate it to XZR for no good reason.
I'd like to think that assumption is going to hold for the reasonable
scope of this particular workaround, though.

I'm not sure I understand the above paragraph.

In code such as:

if (val == 0) foo(val);

gcc's algorithm is likely to figure out that the code is equivalent to

if (val == 0) foo(0)

and perform constant-propagation, etc.

Is that what we're talking about?

As may already be apparent, the way I expect compilers to behave, and the way compilers actually behave, are two overlapping but distinct sets of concepts...

Robin.