[COFF] Add ARM64 intrinsics: __yield, __wfe, __wfi, __sev, __sevl

Summary: These intrinsics result in hint instructions. They are provided here for MSVC ARM64 compatibility.

Reviewers: mstorsjo, compnerd, javed.absar

Reviewed By: mstorsjo

Subscribers: kristof.beyls, chrib, cfe-commits

Differential Revision: https://reviews.llvm.org/D48132

llvm-svn: 334639
This commit is contained in:
Mandeep Singh Grang 2018-06-13 18:49:35 +00:00
parent 20b051ba41
commit 2d28383097
3 changed files with 46 additions and 0 deletions

View File

@ -65,9 +65,15 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc")
BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc")
BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc")
// MSVC
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
// MSVC intrinsics for volatile but non-acquire/release loads and stores
LANGBUILTIN(__iso_volatile_load8, "ccCD*", "n", ALL_MS_LANGUAGES)

View File

@ -6362,18 +6362,23 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
HintID = 0;
break;
case AArch64::BI__builtin_arm_yield:
case AArch64::BI__yield:
HintID = 1;
break;
case AArch64::BI__builtin_arm_wfe:
case AArch64::BI__wfe:
HintID = 2;
break;
case AArch64::BI__builtin_arm_wfi:
case AArch64::BI__wfi:
HintID = 3;
break;
case AArch64::BI__builtin_arm_sev:
case AArch64::BI__sev:
HintID = 4;
break;
case AArch64::BI__builtin_arm_sevl:
case AArch64::BI__sevl:
HintID = 5;
break;
}

View File

@ -24,3 +24,38 @@ void check__isb(void) {
// CHECK-MSVC: @llvm.aarch64.isb(i32 0)
// CHECK-LINUX: error: implicit declaration of function '__isb'
void check__yield(void) {
__yield();
}
// CHECK-MSVC: @llvm.aarch64.hint(i32 1)
// CHECK-LINUX: error: implicit declaration of function '__yield'
void check__wfe(void) {
__wfe();
}
// CHECK-MSVC: @llvm.aarch64.hint(i32 2)
// CHECK-LINUX: error: implicit declaration of function '__wfe'
void check__wfi(void) {
__wfi();
}
// CHECK-MSVC: @llvm.aarch64.hint(i32 3)
// CHECK-LINUX: error: implicit declaration of function '__wfi'
void check__sev(void) {
__sev();
}
// CHECK-MSVC: @llvm.aarch64.hint(i32 4)
// CHECK-LINUX: error: implicit declaration of function '__sev'
void check__sevl(void) {
__sevl();
}
// CHECK-MSVC: @llvm.aarch64.hint(i32 5)
// CHECK-LINUX: error: implicit declaration of function '__sevl'