forked from OSchip/llvm-project
CodeGen: complete ARM ACLE hint 8.4 support
Add support for the remaining hints from the ACLE. Although __dbg is listed as a hint, it is handled different, so it is not covered by this change. llvm-svn: 207930
This commit is contained in:
parent
6323a2d63c
commit
956c2ec532
|
@ -60,6 +60,9 @@ BUILTIN(__builtin_arm_crc32cd, "UiUiLLUi", "nc")
|
|||
|
||||
// HINT
|
||||
BUILTIN(__yield, "v", "")
|
||||
BUILTIN(__wfe, "v", "")
|
||||
BUILTIN(__wfi, "v", "")
|
||||
BUILTIN(__sev, "v", "")
|
||||
BUILTIN(__sevl, "v", "")
|
||||
|
||||
// Data barrier
|
||||
|
|
|
@ -4327,14 +4327,29 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
|
|||
|
||||
Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
||||
const CallExpr *E) {
|
||||
if (BuiltinID == ARM::BI__yield) {
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::arm_hint);
|
||||
return Builder.CreateCall(F, llvm::ConstantInt::get(Int32Ty, 1));
|
||||
unsigned HintID = static_cast<unsigned>(-1);
|
||||
switch (BuiltinID) {
|
||||
default: break;
|
||||
case ARM::BI__yield:
|
||||
HintID = 1;
|
||||
break;
|
||||
case ARM::BI__wfe:
|
||||
HintID = 2;
|
||||
break;
|
||||
case ARM::BI__wfi:
|
||||
HintID = 3;
|
||||
break;
|
||||
case ARM::BI__sev:
|
||||
HintID = 4;
|
||||
break;
|
||||
case ARM::BI__sevl:
|
||||
HintID = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
if (BuiltinID == ARM::BI__sevl) {
|
||||
if (HintID != static_cast<unsigned>(-1)) {
|
||||
Function *F = CGM.getIntrinsic(Intrinsic::arm_hint);
|
||||
return Builder.CreateCall(F, llvm::ConstantInt::get(Int32Ty, 5));
|
||||
return Builder.CreateCall(F, llvm::ConstantInt::get(Int32Ty, HintID));
|
||||
}
|
||||
|
||||
if (BuiltinID == ARM::BI__clear_cache) {
|
||||
|
|
|
@ -19,6 +19,30 @@ void test_eh_return_data_regno()
|
|||
res = __builtin_eh_return_data_regno(1); // CHECK: store volatile i32 1
|
||||
}
|
||||
|
||||
void yield() {
|
||||
__yield();
|
||||
}
|
||||
|
||||
// CHECK: call {{.*}} @llvm.arm.hint(i32 1)
|
||||
|
||||
void wfe() {
|
||||
__wfe();
|
||||
}
|
||||
|
||||
// CHECK: call {{.*}} @llvm.arm.hint(i32 2)
|
||||
|
||||
void wfi() {
|
||||
__wfi();
|
||||
}
|
||||
|
||||
// CHECK: call {{.*}} @llvm.arm.hint(i32 3)
|
||||
|
||||
void sev() {
|
||||
__sev();
|
||||
}
|
||||
|
||||
// CHECK: call {{.*}} @llvm.arm.hint(i32 4)
|
||||
|
||||
void sevl() {
|
||||
__sevl();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue