[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-kernel
Subject: Re: More annoying code generation by clang
From: Peter Zijlstra <peterz () infradead ! org>
Date: 2024-04-08 8:49:34
Message-ID: 20240408084934.GC21904 () noisy ! programming ! kicks-ass ! net
[Download RAW message or body]
On Thu, Apr 04, 2024 at 03:53:49PM -0700, Linus Torvalds wrote:
> diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
> index 66e57c010392..6159d2cbbfde 100644
> --- a/arch/x86/include/asm/barrier.h
> +++ b/arch/x86/include/asm/barrier.h
> @@ -33,20 +33,15 @@
> * Returns:
> * 0 - (index < size)
> */
> +#define array_index_mask_nospec(idx,sz) ({ \
> + typeof((idx)+(sz)) __idx = (idx); \
> + typeof(__idx) __sz = (sz); \
> + typeof(__idx) __mask; \
> + asm volatile ("cmp %1,%2; sbb %0,%0" \
> + :"=r" (__mask) \
> + :"ir"(__sz),"r" (__idx) \
> + :"cc"); \
> + __mask; })
Should this not carry a comment about the "ir" constraint wanting to be
"g" except for clang being daft?
(I really wish clang would go fix this, it keeps coming up time and
again).
>
> /* Prevent speculative execution past this barrier. */
> #define barrier_nospec() asm volatile("lfence":::"memory")
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic