[flang] Fix crash in HLFIR generation (#118399)
[llvm-project.git] / clang / test / CodeGen / arm-cmse-attr.c
blob6322a82dfa4627b460fccc647b3a4cd9c468208f
1 // RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -O1 -emit-llvm %s -o - 2>&1 | \
2 // RUN: FileCheck %s --check-prefix=CHECK-NOSE --check-prefix=CHECK
3 // RUN: %clang_cc1 -triple thumbebv8m.base-none-eabi -O1 -emit-llvm %s -o - 2>&1 | \
4 // RUN: FileCheck %s --check-prefix=CHECK-NOSE --check-prefix=CHECK
5 // RUN: %clang_cc1 -triple thumbv8m.base-none-eabi -mcmse -O1 -emit-llvm %s -o - 2>&1 | \
6 // RUN: FileCheck %s --check-prefix=CHECK-SE --check-prefix=CHECK
7 // RUN: %clang_cc1 -triple thumbebv8m.base-none-eabi -mcmse -O1 -emit-llvm %s -o - 2>&1 | \
8 // RUN: FileCheck %s --check-prefix=CHECK-SE --check-prefix=CHECK
10 typedef void (*callback_t)(void) __attribute__((cmse_nonsecure_call));
11 typedef void callback2_t(void) __attribute__((cmse_nonsecure_call));
13 void f1(callback_t fptr)
15 fptr();
18 void f2(callback2_t *fptr)
20 fptr();
23 void f3(void) __attribute__((cmse_nonsecure_entry));
24 void f3(void)
28 void f4(void) __attribute__((cmse_nonsecure_entry))
32 // CHECK: define{{.*}} void @f1(ptr nocapture noundef readonly %fptr) {{[^#]*}}#0 {
33 // CHECK: call void %fptr() #2
34 // CHECK: define{{.*}} void @f2(ptr nocapture noundef readonly %fptr) {{[^#]*}}#0 {
35 // CHECK: call void %fptr() #2
36 // CHECK: define{{.*}} void @f3() {{[^#]*}}#1 {
37 // CHECK: define{{.*}} void @f4() {{[^#]*}}#1 {
39 // CHECK-NOSE-NOT: cmse_nonsecure_entry
40 // CHECK-NOSE-NOT: cmse_nonsecure_call
41 // CHECK-SE: attributes #0 = { nounwind
42 // CHECK-SE: attributes #1 = { {{.*}} "cmse_nonsecure_entry"
43 // CHECK-SE: attributes #2 = { {{.*}} "cmse_nonsecure_call"