diff options
Diffstat (limited to 'arch/arm64/include/asm/sysreg.h')
| -rw-r--r-- | arch/arm64/include/asm/sysreg.h | 11 | 
1 files changed, 10 insertions, 1 deletions
| diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index 6455db1b54fd..c231d2a3e515 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -1220,10 +1220,19 @@  	__val;								\  }) +/* + * The "Z" constraint combined with the "%x0" template should be enough + * to force XZR generation if (v) is a constant 0 value but LLVM does not + * yet understand that modifier/constraint combo so a conditional is required + * to nudge the compiler into using XZR as a source for a 0 constant value. + */  #define write_sysreg_s(v, r) do {					\  	u64 __val = (u64)(v);						\  	u32 __maybe_unused __check_r = (u32)(r);			\ -	asm volatile(__msr_s(r, "%x0") : : "rZ" (__val));		\ +	if (__builtin_constant_p(__val) && __val == 0)			\ +		asm volatile(__msr_s(r, "xzr"));			\ +	else								\ +		asm volatile(__msr_s(r, "%x0") : : "r" (__val));	\  } while (0)  /* | 
