mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
common/FPControl: MSVC arm64 path for FPCR read/write
MSVC's arm64 cl.exe rejects GCC inline asm (asm volatile mrs/msr FPCR), which broke the Windows arm64 build (C2059 syntax error: 'volatile', cascading to 100+ errors per TU). Read/write FPCR via the system-register intrinsics _ReadStatusReg/_WriteStatusReg(ARM64_FPCR) under (_MSC_VER && !__clang__); clang/clang-cl keep the inline asm. <intrin.h> (which declares these) is already included by VectorIntrin.h under _MSC_VER. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
905e8583d4
commit
ac552ea3e0
@@ -113,14 +113,24 @@ struct FPControlRegister
|
||||
__fi static FPControlRegister GetCurrent()
|
||||
{
|
||||
u64 value;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
// MSVC's arm64 compiler doesn't accept GCC inline asm; read FPCR via the
|
||||
// system-register intrinsic (ARM64_FPCR / _ReadStatusReg from <intrin.h>).
|
||||
value = static_cast<u64>(_ReadStatusReg(ARM64_FPCR));
|
||||
#else
|
||||
asm volatile("\tmrs %0, FPCR\n"
|
||||
: "=r"(value));
|
||||
#endif
|
||||
return FPControlRegister{value};
|
||||
}
|
||||
|
||||
__fi static void SetCurrent(FPControlRegister value)
|
||||
{
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
_WriteStatusReg(ARM64_FPCR, static_cast<__int64>(value.bitmask));
|
||||
#else
|
||||
asm volatile("\tmsr FPCR, %0\n" ::"r"(value.bitmask));
|
||||
#endif
|
||||
}
|
||||
|
||||
__fi static constexpr FPControlRegister GetDefault()
|
||||
|
||||
Reference in New Issue
Block a user