From 0ae5f699a5d0135b13dbbed67a430726ed5de439 Mon Sep 17 00:00:00 2001 From: Harry Gillanders Date: Mon, 10 Aug 2026 20:03:32 +0100 Subject: [PATCH 1/2] Fix `__builtins_msvc.d`'s unittests failing to compile without `-dip1000` when targeting AArch64. --- druntime/src/__builtins_msvc.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/druntime/src/__builtins_msvc.d b/druntime/src/__builtins_msvc.d index be850e3c40ec..20327ad33a77 100644 --- a/druntime/src/__builtins_msvc.d +++ b/druntime/src/__builtins_msvc.d @@ -1528,7 +1528,7 @@ version (MSVCIntrinsics) } /* This is trusted so that it's @safe without DIP1000 enabled. */ - @safe pure nothrow @nogc unittest + @trusted pure nothrow @nogc unittest { static bool test() { From 731e34e98239a3d564cb07db7abaf3f304e8233c Mon Sep 17 00:00:00 2001 From: Harry Gillanders Date: Mon, 10 Aug 2026 20:05:10 +0100 Subject: [PATCH 2/2] Prevent LDC from emitting `'+prfchw' is not a recognized feature for this target (ignoring feature)` when targeting AArch64 in `__builtins_msvc.d`. --- druntime/src/__builtins_msvc.d | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/druntime/src/__builtins_msvc.d b/druntime/src/__builtins_msvc.d index 20327ad33a77..c94da811ce7a 100644 --- a/druntime/src/__builtins_msvc.d +++ b/druntime/src/__builtins_msvc.d @@ -1357,9 +1357,18 @@ version (MSVCIntrinsics) } } + version (X86_64_Or_X86) + { + /* prfchw forces prefetchw to be emitted on x86 (which is how MSVC behaves). */ + private enum prefetchWriteTarget = "prfchw"; + } + else + { + private enum prefetchWriteTarget = ""; + } + /* This is trusted so that it's @safe without DIP1000 enabled. */ - /* prfchw forces prefetchw to be emitted on x86 (which is how MSVC behaves). */ - @llvm_target("prfchw") + @llvm_target(prefetchWriteTarget) extern(C) pragma(inline, true) private void prefetchData(bool write, ubyte level)(scope const(void)* address) @trusted pure nothrow @nogc