aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Kong <Yi.Kong@arm.com>2014-07-03 16:01:25 +0000
committerYi Kong <Yi.Kong@arm.com>2014-07-03 16:01:25 +0000
commit4efadfb0b0ec545d0ef609c5eeb6a0342d0e56e4 (patch)
treee0d654ac689692faca5d56aeccf3fba730da6ad7
parent93e52da641d66ca01c26c236cfab641ca405dd9d (diff)
downloadllvm-4efadfb0b0ec545d0ef609c5eeb6a0342d0e56e4.zip
llvm-4efadfb0b0ec545d0ef609c5eeb6a0342d0e56e4.tar.gz
llvm-4efadfb0b0ec545d0ef609c5eeb6a0342d0e56e4.tar.bz2
[ARM] Implement ISB memory barrier intrinsic
Adds support for __builtin_arm_isb. Also corrects DSB and ISB instructions modelling by adding has-side-effects property. llvm-svn: 212277
-rw-r--r--clang/include/clang/Basic/BuiltinsARM.def1
-rw-r--r--clang/lib/Sema/SemaChecking.cpp7
-rw-r--r--clang/test/CodeGen/builtins-arm.c1
-rw-r--r--clang/test/Sema/builtins-arm.c6
4 files changed, 12 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/BuiltinsARM.def b/clang/include/clang/Basic/BuiltinsARM.def
index 7f32e87..a423b75 100644
--- a/clang/include/clang/Basic/BuiltinsARM.def
+++ b/clang/include/clang/Basic/BuiltinsARM.def
@@ -77,6 +77,7 @@ BUILTIN(__builtin_arm_sevl, "v", "")
// Data barrier
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
+BUILTIN(__builtin_arm_isb, "vUi", "nc")
// MSVC
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 9fa8fd1..f7d5623 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -613,8 +613,8 @@ bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
if (CheckNeonBuiltinFunctionCall(BuiltinID, TheCall))
return true;
- // For NEON intrinsics which take an immediate value as part of the
- // instruction, range check them here.
+ // For intrinsics which take an immediate value as part of the instruction,
+ // range check them here.
unsigned i = 0, l = 0, u = 0;
switch (BuiltinID) {
default: return false;
@@ -623,7 +623,8 @@ bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
case ARM::BI__builtin_arm_vcvtr_f:
case ARM::BI__builtin_arm_vcvtr_d: i = 1; u = 1; break;
case ARM::BI__builtin_arm_dmb:
- case ARM::BI__builtin_arm_dsb: l = 0; u = 15; break;
+ case ARM::BI__builtin_arm_dsb:
+ case ARM::BI__builtin_arm_isb: l = 0; u = 15; break;
}
// FIXME: VFP Intrinsics should error if VFP not present.
diff --git a/clang/test/CodeGen/builtins-arm.c b/clang/test/CodeGen/builtins-arm.c
index 7b72072..e55183c 100644
--- a/clang/test/CodeGen/builtins-arm.c
+++ b/clang/test/CodeGen/builtins-arm.c
@@ -52,6 +52,7 @@ void sevl() {
void test_barrier() {
__builtin_arm_dmb(1); //CHECK: call {{.*}} @llvm.arm.dmb(i32 1)
__builtin_arm_dsb(2); //CHECK: call {{.*}} @llvm.arm.dsb(i32 2)
+ __builtin_arm_isb(3); //CHECK: call {{.*}} @llvm.arm.isb(i32 3)
}
// CHECK: call {{.*}} @llvm.arm.rbit(i32 %a)
diff --git a/clang/test/Sema/builtins-arm.c b/clang/test/Sema/builtins-arm.c
index 3ac1da0..6c367d3 100644
--- a/clang/test/Sema/builtins-arm.c
+++ b/clang/test/Sema/builtins-arm.c
@@ -31,4 +31,10 @@ void test2() {
*ptr = '0'; // expected-error {{incomplete type 'void' is not assignable}}
}
+void test3() {
+ __builtin_arm_dsb(16); // expected-error {{argument should be a value from 0 to 15}}
+ __builtin_arm_dmb(17); // expected-error {{argument should be a value from 0 to 15}}
+ __builtin_arm_isb(18); // expected-error {{argument should be a value from 0 to 15}}
+}
+
#endif