Skip to content

[clang][ARM][AArch64] Don't require arm_acle header for universally defined intrinsics #136742

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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, "")
BUILTIN(__yield, "v", "")
BUILTIN(__wfe, "v", "")
BUILTIN(__wfi, "v", "")
BUILTIN(__sev, "v", "")
BUILTIN(__sevl, "v", "")

// 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, "")
BUILTIN(__dmb, "vUi", "nc")
BUILTIN(__dsb, "vUi", "nc")
BUILTIN(__isb, "vUi", "nc")

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, "")
BUILTIN(__yield, "v", "")
BUILTIN(__wfe, "v", "")
BUILTIN(__wfi, "v", "")
BUILTIN(__sev, "v", "")
BUILTIN(__sevl, "v", "")

// 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, "")
BUILTIN(__dmb, "vUi", "nc")
BUILTIN(__dsb, "vUi", "nc")
BUILTIN(__isb, "vUi", "nc")

// Prefetch
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Headers/arm_acle.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ extern "C" {

/* 7 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
/* 7.3 Memory barriers */
/*
void __dmb(unsigned int);
void __dsb(unsigned int);
void __isb(unsigned int);
*/

/* 7.4 Hints */
/*
void __wfi(void);
void __wfe(void);
void __sev(void);
void __sevl(void);
void __yield(void);
*/

#if defined(__ARM_32BIT_STATE) && __ARM_32BIT_STATE
#define __dbg(t) __builtin_arm_dbg(t)
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion clang/test/CodeGen/arm-former-microsoft-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// RUN: %clang_cc1 -triple armv7-eabi -Werror -emit-llvm -o - %s \
// RUN: | FileCheck %s
#include <arm_acle.h>
void check__dmb(void) {
__dmb(0);
}
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions clang/test/CodeGen/arm64-former-microsoft-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// RUN: %clang_cc1 -triple arm64-darwin -Wno-implicit-function-declaration -fms-compatibility -emit-llvm -o - %s \
// RUN: | FileCheck %s

#include <arm_acle.h>

void check__dmb(void) {
__dmb(0);
}
Expand Down
2 changes: 0 additions & 2 deletions clang/test/CodeGen/builtins-arm-microsoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// RUN: | FileCheck %s -check-prefix CHECK-EABI
// REQUIRES: arm-registered-target

#include <arm_acle.h>

void test_yield_intrinsic() {
__yield();
}
Expand Down
12 changes: 0 additions & 12 deletions clang/test/Headers/Inputs/include/stdint.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
#ifndef STDINT_H
#define STDINT_H

#ifdef __INT8_TYPE__
typedef __INT8_TYPE__ int8_t;
#endif
typedef unsigned char uint8_t;

#ifdef __INT16_TYPE__
typedef __INT16_TYPE__ int16_t;
typedef unsigned __INT16_TYPE__ uint16_t;
#endif

#ifdef __INT32_TYPE__
typedef __INT32_TYPE__ int32_t;
typedef unsigned __INT32_TYPE__ uint32_t;
#endif

#ifdef __INT64_TYPE__
typedef __INT64_TYPE__ int64_t;
typedef unsigned __INT64_TYPE__ uint64_t;
#endif

Expand Down
4 changes: 0 additions & 4 deletions clang/test/Headers/ms-intrin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ typedef __SIZE_TYPE__ size_t;

#include <intrin.h>

#ifdef __ARM_ACLE
#include <arm_acle.h>
#endif

// Use some C++ to make sure we closed the extern "C" brackets.
template <typename T>
void foo(T V) {}
Expand Down
Loading