Skip to content

[clang][ARM] Include arm_acle.h in intrin.h on supported platforms #144172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion clang/include/clang/Basic/BuiltinHeaders.def
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//

HEADER(NO_HEADER, nullptr)
HEADER(ARMACLE_H, "arm_acle.h")
HEADER(BLOCKS_H, "Blocks.h")
HEADER(COMPLEX_H, "complex.h")
HEADER(CTYPE_H, "ctype.h")
Expand Down
16 changes: 8 additions & 8 deletions clang/include/clang/Basic/BuiltinsAArch64.def
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ BUILTIN(__builtin_arm_wfi, "v", "")
BUILTIN(__builtin_arm_sev, "v", "")
BUILTIN(__builtin_arm_sevl, "v", "")
BUILTIN(__builtin_arm_chkfeat, "WUiWUi", "")
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__yield, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfe, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfi, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sev, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sevl, "v", "h", INTRIN_H, ALL_LANGUAGES, "")

// Like __builtin_trap but provide an 16-bit immediate reason code (which goes into `brk #N`).
BUILTIN(__builtin_arm_trap, "vUIs", "nr")
Expand Down Expand Up @@ -87,9 +87,9 @@ TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
BUILTIN(__builtin_arm_isb, "vUi", "nc")
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", INTRIN_H, ALL_LANGUAGES, "")

TARGET_BUILTIN(__builtin_arm_jcvt, "Zid", "nc", "v8.3a")

Expand Down
16 changes: 8 additions & 8 deletions clang/include/clang/Basic/BuiltinsARM.def
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,19 @@ BUILTIN(__builtin_arm_wfi, "v", "")
BUILTIN(__builtin_arm_sev, "v", "")
BUILTIN(__builtin_arm_sevl, "v", "")
BUILTIN(__builtin_arm_dbg, "vUi", "")
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__yield, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfe, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__wfi, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sev, "v", "h", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__sevl, "v", "h", INTRIN_H, ALL_LANGUAGES, "")

// Data barrier
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
BUILTIN(__builtin_arm_isb, "vUi", "nc")
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", INTRIN_H, ALL_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", INTRIN_H, ALL_LANGUAGES, "")

// Prefetch
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Headers/intrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,48 @@

void check__dmb(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__dmb(0);
}

void check__dsb(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__dsb(0);
}

void check__isb(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__isb(0);
}

void check__yield(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__yield();
}

void check__wfe(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__wfe();
}

void check__wfi(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__wfi();
}

void check__sev(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__sev();
}

void check__sevl(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__sevl();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,48 @@

void check__dmb(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__dmb(0);
}

void check__dsb(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__dsb(0);
}

void check__isb(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__isb(0);
}

void check__yield(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__yield();
}

void check__wfe(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__wfe();
}

void check__wfi(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__wfi();
}

void check__sev(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__sev();
}

void check__sevl(void) {
// expected-warning@+2{{call to undeclared library function}}
// expected-note@+1{{include the header <arm_acle.h> or explicitly provide a declaration for}}
// expected-note@+1{{include the header <intrin.h> or explicitly provide a declaration for}}
__sevl();
}
7 changes: 7 additions & 0 deletions clang/test/Headers/arm-acle-no-direct-include.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// 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(); }
Loading