[clang][ARM] Include arm_acle.h in intrin.h on supported platforms (#144172)
Right now when using ARM intrinsics without including `arm_acle.h`, we
throw a warning saying to include it or provide a declaration for the
function.
MSVC doesn't have any ARM-intrinsic specific header, so include Clang's
ARM intrinsic header (`arm_acle.h`) in `intrin.h` so we don't get a
warning that tells the user to include a header that doesn't exist.
Ideally we could change the header based on the platform, but we don't
have the infra for that at the moment.
See https://github.com/llvm/llvm-project/pull/140910 for more info.
Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h
index 588c283..210ed0c 100644
--- a/clang/lib/Headers/intrin.h
+++ b/clang/lib/Headers/intrin.h
@@ -30,6 +30,10 @@
#include <arm64intr.h>
#endif
+#if defined(__ARM_ACLE)
+#include <arm_acle.h>
+#endif
+
/* For the definition of jmp_buf. */
#if __STDC_HOSTED__
#include <setjmp.h>
diff --git a/clang/test/Headers/arm-acle-no-direct-include.c b/clang/test/Headers/arm-acle-no-direct-include.c
new file mode 100644
index 0000000..b69549d
--- /dev/null
+++ b/clang/test/Headers/arm-acle-no-direct-include.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cl --target=aarch64-windows-msvc -Xclang -verify /E -U__STDC_HOSTED__ -Wno-builtin-macro-redefined %s 2>&1 | FileCheck %s
+
+// expected-no-diagnostics
+
+// CHECK: void __yield(void);
+#include <intrin.h>
+void f() { __yield(); }
+