llvmorg-21-init-2651-gbac417107339.patch (1955B)
1 From bac4171073399352e5bd0ba541820e2a9b3f37d7 Mon Sep 17 00:00:00 2001 2 From: Devon Loehr <DKLoehr@users.noreply.github.com> 3 Date: Sat, 22 Feb 2025 03:46:08 -0500 4 Subject: [PATCH] Remove xbegin and _xend (#126952) 5 6 `intrin.h` contains declarations for both `xbegin` and `_xend`, but they 7 should already be included transitively from `rtmintrin.h` via 8 `immintrin.h` and/or `x86intrin.h`. Having them in both places causes 9 problems if both headers are included. 10 11 Furthermore, the `intrin.h` declaration of `xbegin` seems to be bugged 12 anyway, since it's missing its leading underscore. 13 14 Fixes #95133 15 --- 16 clang/lib/Headers/intrin.h | 2 -- 17 clang/test/Headers/no-xend.cpp | 10 ++++++++++ 18 2 files changed, 10 insertions(+), 2 deletions(-) 19 create mode 100644 clang/test/Headers/no-xend.cpp 20 21 diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h 22 index 376046aeeaf5e..3dd1eb45817d4 100644 23 --- a/clang/lib/Headers/intrin.h 24 +++ b/clang/lib/Headers/intrin.h 25 @@ -162,8 +162,6 @@ void _Store_HLERelease(long volatile *, long); 26 void _Store64_HLERelease(__int64 volatile *, __int64); 27 void _StorePointer_HLERelease(void *volatile *, void *); 28 void _WriteBarrier(void); 29 -unsigned __int32 xbegin(void); 30 -void _xend(void); 31 32 /* These additional intrinsics are turned on in x64/amd64/x86_64 mode. */ 33 #if defined(__x86_64__) && !defined(__arm64ec__) 34 diff --git a/clang/test/Headers/no-xend.cpp b/clang/test/Headers/no-xend.cpp 35 new file mode 100644 36 index 0000000000000..b2fb1de011557 37 --- /dev/null 38 +++ b/clang/test/Headers/no-xend.cpp 39 @@ -0,0 +1,10 @@ 40 +// RUN: %clang_cc1 -triple x86_64-pc-win32 \ 41 +// RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ 42 +// RUN: -ffreestanding -fsyntax-only -Werror -Wsystem-headers \ 43 +// RUN: -isystem %S/Inputs/include %s 44 + 45 +#include <immintrin.h> 46 + 47 +#pragma clang attribute push(__attribute__((target("avx"))), apply_to=function) 48 +#include <intrin.h> 49 +#pragma clang attribute pop