diff --git a/AK/BigIntBase.h b/AK/BigIntBase.h index 4ddff627263..ab17104950a 100644 --- a/AK/BigIntBase.h +++ b/AK/BigIntBase.h @@ -154,17 +154,6 @@ constexpr StaticStorage> get_storage_of(T value) } // ===== Utilities ===== -template -ALWAYS_INLINE constexpr void taint_for_optimizer(T& value) -{ - if (!is_constant_evaluated()) { - asm volatile("" - : "+rm"(value) - : - : "memory"); - } -} - ALWAYS_INLINE constexpr NativeWord extend_sign(bool sign) { return sign ? max_word : 0; diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index c5c7b1a7f9f..57c986c67cc 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -166,6 +166,28 @@ constexpr bool is_constant_evaluated() #endif } +template +ALWAYS_INLINE constexpr void taint_for_optimizer(T& value) +requires(IsIntegral) +{ + if (!is_constant_evaluated()) { + asm volatile("" + : "+r"(value)); + } +} + +template +ALWAYS_INLINE constexpr void taint_for_optimizer(T& value) +requires(!IsIntegral) +{ + if (!is_constant_evaluated()) { + asm volatile("" + : + : "m"(value) + : "memory"); + } +} + // These can't be exported into the global namespace as they would clash with the C standard library. #define __DEFINE_GENERIC_ABS(type, zero, intrinsic) \