Re: Potentially Broken Address Dependency via test_bit() When Compiling With Clang

From: Peter Zijlstra
Date: Wed Oct 27 2021 - 08:34:42 EST


On Wed, Oct 27, 2021 at 02:17:48PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 27, 2021 at 12:19:48PM +0200, Paul Heidekrüger wrote:
> I would personally not consider this a dependend load. The result
> depends on two loads, but there is no actual ordering between them.
>
> r1 = *x
> r2 = *y
> b = 1 & (r1 >> r2);
>
> (more or less)

melver pointed out on IRC that I missed the whole BIT_WORD(nr) thing.
And with that restored this should indeed be an address dependency.

Still, I wasn't actually expecting test_bit() to be one. Nice find.