forked from OSchip/llvm-project
parent
bb415eac2e
commit
26d104a9ec
|
@ -80,6 +80,9 @@ BUILTIN(__builtin_arm_dmb, "vUi", "nc")
|
|||
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
|
||||
BUILTIN(__builtin_arm_isb, "vUi", "nc")
|
||||
|
||||
// Prefetch
|
||||
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
|
||||
|
||||
// MSVC
|
||||
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
|
||||
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
|
||||
|
|
|
@ -3088,6 +3088,18 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
|
|||
return Builder.CreateCall(F, llvm::ConstantInt::get(Int32Ty, HintID));
|
||||
}
|
||||
|
||||
if (BuiltinID == ARM::BI__builtin_arm_prefetch) {
|
||||
Value *Address = EmitScalarExpr(E->getArg(0));
|
||||
Value *RW = EmitScalarExpr(E->getArg(1));
|
||||
Value *IsData = EmitScalarExpr(E->getArg(2));
|
||||
|
||||
// Locality is not supported on ARM target
|
||||
Value *Locality = llvm::ConstantInt::get(Int32Ty, 3);
|
||||
|
||||
Value *F = CGM.getIntrinsic(Intrinsic::prefetch);
|
||||
return Builder.CreateCall4(F, Address, RW, Locality, IsData);
|
||||
}
|
||||
|
||||
if (BuiltinID == ARM::BI__builtin_arm_rbit) {
|
||||
return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::arm_rbit),
|
||||
EmitScalarExpr(E->getArg(0)),
|
||||
|
|
|
@ -624,6 +624,11 @@ bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
|
|||
return CheckARMBuiltinExclusiveCall(BuiltinID, TheCall, 64);
|
||||
}
|
||||
|
||||
if (BuiltinID == ARM::BI__builtin_arm_prefetch) {
|
||||
return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1) ||
|
||||
SemaBuiltinConstantArgRange(TheCall, 2, 0, 1);
|
||||
}
|
||||
|
||||
if (CheckNeonBuiltinFunctionCall(BuiltinID, TheCall))
|
||||
return true;
|
||||
|
||||
|
|
|
@ -66,3 +66,14 @@ void test_barrier() {
|
|||
unsigned rbit(unsigned a) {
|
||||
return __builtin_arm_rbit(a);
|
||||
}
|
||||
|
||||
void prefetch(int i) {
|
||||
__builtin_arm_prefetch(&i, 0, 1);
|
||||
// CHECK: call {{.*}} @llvm.prefetch(i8* %0, i32 0, i32 3, i32 1)
|
||||
|
||||
__builtin_arm_prefetch(&i, 1, 1);
|
||||
// CHECK: call {{.*}} @llvm.prefetch(i8* %0, i32 1, i32 3, i32 1)
|
||||
|
||||
__builtin_arm_prefetch(&i, 1, 0);
|
||||
// CHECK: call {{.*}} @llvm.prefetch(i8* %0, i32 1, i32 3, i32 0)
|
||||
}
|
||||
|
|
|
@ -37,4 +37,9 @@ void test3() {
|
|||
__builtin_arm_isb(18); // expected-error {{argument should be a value from 0 to 15}}
|
||||
}
|
||||
|
||||
void test4() {
|
||||
__builtin_arm_prefetch(0, 2, 0); // expected-error {{argument should be a value from 0 to 1}}
|
||||
__builtin_arm_prefetch(0, 0, 2); // expected-error {{argument should be a value from 0 to 1}}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue