1 // RUN: %clang_cc1 -triple thumbv8m.base-unknown-unknown-eabi -emit-llvm -mrelocation-model static -mcmse -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple thumbebv8m.base-unknown-unknown-eabi -emit-llvm -mrelocation-model static -mcmse -o - %s | FileCheck %s
6 unsigned test_cmse_primitives(void *p
) {
7 // CHECK: define {{.*}} i32 @test_cmse_primitives
8 cmse_address_info_t tt_val
, ttt_val
;
9 cmse_address_info_t tta_val
, ttat_val
;
13 ttt_val
= cmse_TTT(p
);
14 tta_val
= cmse_TTA(p
);
15 ttat_val
= cmse_TTAT(p
);
16 // CHECK: call i32 @llvm.arm.cmse.tt
17 // CHECK: call i32 @llvm.arm.cmse.ttt
18 // CHECK: call i32 @llvm.arm.cmse.tta
19 // CHECK: call i32 @llvm.arm.cmse.ttat
24 sum
+= ttat_val
.value
;
26 sum
+= tt_val
.flags
.mpu_region
;
27 sum
+= tt_val
.flags
.sau_region
;
28 sum
+= tt_val
.flags
.mpu_region_valid
;
29 sum
+= tt_val
.flags
.sau_region_valid
;
30 sum
+= tt_val
.flags
.read_ok
;
31 sum
+= tt_val
.flags
.readwrite_ok
;
32 sum
+= tt_val
.flags
.nonsecure_read_ok
;
33 sum
+= tt_val
.flags
.nonsecure_readwrite_ok
;
34 sum
+= tt_val
.flags
.secure
;
35 sum
+= tt_val
.flags
.idau_region_valid
;
36 sum
+= tt_val
.flags
.idau_region
;
41 void *test_address_range(void *p
) {
42 // CHECK: define {{.*}} ptr @test_address_range
43 return cmse_check_address_range(p
, 128, CMSE_MPU_UNPRIV
45 | CMSE_MPU_READWRITE
);
46 // CHECK: call i32 @llvm.arm.cmse.tt
47 // CHECK: call i32 @llvm.arm.cmse.ttt
48 // CHECK: call i32 @llvm.arm.cmse.tta
49 // CHECK: call i32 @llvm.arm.cmse.ttat
56 void *test_pointed_object(void *p
) {
57 // CHECK: define {{.*}} ptr @test_pointed_object
58 Point
*pt
= (Point
*)p
;
59 cmse_check_pointed_object(pt
, CMSE_NONSECURE
62 // CHECK: call i32 @llvm.arm.cmse.tt
63 // CHECK: call i32 @llvm.arm.cmse.ttt
64 // CHECK: call i32 @llvm.arm.cmse.tta
65 // CHECK: call i32 @llvm.arm.cmse.ttat