Re: [PATCH] vsyscall: use __iter_div_u64_rem()

From: Arnd Bergmann
Date: Mon Jul 22 2019 - 06:48:28 EST


On Mon, Jul 22, 2019 at 12:39 PM Jan Beulich <JBeulich@xxxxxxxx> wrote:
> On 22.07.2019 12:10, Thomas Gleixner wrote:
> > On Thu, 11 Jul 2019, Arnd Bergmann wrote:
> "q" was used in that commit exclusively for byte sized operands, simply
> because that _is_ the constraint to use in such cases. Using "r" is
> wrong on 32-bit, as it would include inaccessible byte portions of %sp,
> %bp, %si, and %di. This is how it's described in gcc sources / docs:
>
> "Any register accessible as @code{@var{r}l}. In 32-bit mode, @code{a},
> @code{b}, @code{c}, and @code{d}; in 64-bit mode, any integer register."
>
> What I'm struggling with is why clang would evaluate that asm() in the
> first place when a 64-bit field (perf_ctr_virt_mask) is being accessed.

clang does the optimization and warning checking in a different order,
in this case the argument type checks for the inline assembly is done
before it eliminates the dead code.

Arnd