From 69a21a95fde54cffacf132e64ec3629622f240aa Mon Sep 17 00:00:00 2001 From: Alex Sepkowski Date: Mon, 17 Aug 2026 17:48:18 -0700 Subject: [PATCH 1/2] Skip FP environment test under x64 ARM64 emulation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cf0be5dd-405f-45e0-897d-a4762fa7b920 --- tools/clang/unittests/HLSL/CompilerTest.cpp | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/clang/unittests/HLSL/CompilerTest.cpp b/tools/clang/unittests/HLSL/CompilerTest.cpp index f590a8745c..e03e698f11 100644 --- a/tools/clang/unittests/HLSL/CompilerTest.cpp +++ b/tools/clang/unittests/HLSL/CompilerTest.cpp @@ -4364,7 +4364,34 @@ void VerifyDivByZeroThrows() { VERIFY_IS_TRUE(bCaughtExpectedException); } +static bool IsX64EmulatedOnArm64() { +#if defined(_M_X64) + using IsWow64Process2Fn = BOOL(WINAPI *)(HANDLE, USHORT *, USHORT *); + HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll"); + auto isWow64Process2 = reinterpret_cast( + GetProcAddress(kernel32, "IsWow64Process2")); + if (!isWow64Process2) + return false; + + USHORT processMachine = IMAGE_FILE_MACHINE_UNKNOWN; + USHORT nativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; + return isWow64Process2(GetCurrentProcess(), &processMachine, + &nativeMachine) && + nativeMachine == IMAGE_FILE_MACHINE_ARM64; +#else + return false; +#endif +} + TEST_F(CompilerTest, CodeGenFloatingPointEnvironment) { + if (IsX64EmulatedOnArm64()) { + WEX::Logging::Log::Comment( + L"Skipping floating-point environment test under x64 emulation on " + L"ARM64."); + WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped); + return; + } + unsigned int fpOriginal; VERIFY_IS_TRUE(_controlfp_s(&fpOriginal, 0, 0) == 0); From 1319f520550fda11ebf7b10329dc7bc1bf2886e3 Mon Sep 17 00:00:00 2001 From: Alex Sepkowski Date: Mon, 17 Aug 2026 18:03:51 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- tools/clang/unittests/HLSL/CompilerTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/clang/unittests/HLSL/CompilerTest.cpp b/tools/clang/unittests/HLSL/CompilerTest.cpp index e03e698f11..048773af19 100644 --- a/tools/clang/unittests/HLSL/CompilerTest.cpp +++ b/tools/clang/unittests/HLSL/CompilerTest.cpp @@ -4368,7 +4368,7 @@ static bool IsX64EmulatedOnArm64() { #if defined(_M_X64) using IsWow64Process2Fn = BOOL(WINAPI *)(HANDLE, USHORT *, USHORT *); HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll"); - auto isWow64Process2 = reinterpret_cast( + IsWow64Process2Fn isWow64Process2 = reinterpret_cast( GetProcAddress(kernel32, "IsWow64Process2")); if (!isWow64Process2) return false;