forked from OSchip/llvm-project
ARM: Implement __builtin_arm_nop intrinsic
This patch implements __builtin_arm_nop intrinsic for AArch32 and AArch64, which generates hint 0x0, the alias of NOP instruction. This intrinsic is necessary to implement ACLE __nop intrinsic. Differential Revision: http://reviews.llvm.org/D4495 llvm-svn: 212947
This commit is contained in:
parent
41ffa5d1ba
commit
4d5e23f53a
|
@ -28,6 +28,7 @@ BUILTIN(__builtin_arm_rbit, "UiUi", "nc")
|
|||
BUILTIN(__builtin_arm_rbit64, "LUiLUi", "nc")
|
||||
|
||||
// HINT
|
||||
BUILTIN(__builtin_arm_nop, "v", "")
|
||||
BUILTIN(__builtin_arm_yield, "v", "")
|
||||
BUILTIN(__builtin_arm_wfe, "v", "")
|
||||
BUILTIN(__builtin_arm_wfi, "v", "")
|
||||
|
|
|
@ -68,6 +68,7 @@ BUILTIN(__builtin_arm_crc32d, "UiUiLLUi", "nc")
|
|||
BUILTIN(__builtin_arm_crc32cd, "UiUiLLUi", "nc")
|
||||
|
||||
// HINT
|
||||
BUILTIN(__builtin_arm_nop, "v", "")
|
||||
BUILTIN(__builtin_arm_yield, "v", "")
|
||||
BUILTIN(__builtin_arm_wfe, "v", "")
|
||||
BUILTIN(__builtin_arm_wfi, "v", "")
|
||||
|
|
|
@ -3040,6 +3040,9 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
unsigned HintID = static_cast<unsigned>(-1);
|
||||
switch (BuiltinID) {
|
||||
default: break;
|
||||
case ARM::BI__builtin_arm_nop:
|
||||
HintID = 0;
|
||||
break;
|
||||
case ARM::BI__builtin_arm_yield:
|
||||
case ARM::BI__yield:
|
||||
HintID = 1;
|
||||
|
@ -3804,6 +3807,9 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
|
|||
unsigned HintID = static_cast<unsigned>(-1);
|
||||
switch (BuiltinID) {
|
||||
default: break;
|
||||
case AArch64::BI__builtin_arm_nop:
|
||||
HintID = 0;
|
||||
break;
|
||||
case AArch64::BI__builtin_arm_yield:
|
||||
HintID = 1;
|
||||
break;
|
||||
|
|
|
@ -19,6 +19,12 @@ void test_eh_return_data_regno()
|
|||
res = __builtin_eh_return_data_regno(1); // CHECK: store volatile i32 1
|
||||
}
|
||||
|
||||
void nop() {
|
||||
__builtin_arm_nop();
|
||||
}
|
||||
|
||||
// CHECK: call {{.*}} @llvm.arm.hint(i32 0)
|
||||
|
||||
void yield() {
|
||||
__builtin_arm_yield();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ unsigned long long rbit64(unsigned long long a) {
|
|||
}
|
||||
|
||||
void hints() {
|
||||
__builtin_arm_nop(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 0)
|
||||
__builtin_arm_yield(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 1)
|
||||
__builtin_arm_wfe(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 2)
|
||||
__builtin_arm_wfi(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 3)
|
||||
|
|
Loading…
Reference in New Issue