xref: /llvm-project/clang/test/Sema/arm-branch-protection.c (revision e765e0bc8ed06ebb186a9905227273517f0b7240)
1 // RUN: %clang_cc1 -triple thumbv6m -verify -fsyntax-only %s
2 
3 // expected-no-diagnostics
4 // Armv8.1-M.Main
f1(void)5 __attribute__((target("arch=cortex-m55,branch-protection=bti"))) void f1(void) {}
f2(void)6 __attribute__((target("arch=cortex-m55,branch-protection=pac-ret"))) void f2(void) {}
f3(void)7 __attribute__((target("arch=cortex-m55,branch-protection=bti+pac-ret"))) void f3(void) {}
f4(void)8 __attribute__((target("arch=cortex-m55,branch-protection=bti+pac-ret+leaf"))) void f4(void) {}
9 // Armv8-M.Main
f5(void)10 __attribute__((target("arch=cortex-m33,branch-protection=bti"))) void f5(void) {}
f6(void)11 __attribute__((target("arch=cortex-m33,branch-protection=pac-ret"))) void f6(void) {}
f7(void)12 __attribute__((target("arch=cortex-m33,branch-protection=bti+pac-ret"))) void f7(void) {}
f8(void)13 __attribute__((target("arch=cortex-m33,branch-protection=bti+pac-ret+leaf"))) void f8(void) {}
14 // Armv7-M
f9(void)15 __attribute__((target("arch=cortex-m3,branch-protection=bti"))) void f9(void) {}
f10(void)16 __attribute__((target("arch=cortex-m3,branch-protection=pac-ret"))) void f10(void) {}
f11(void)17 __attribute__((target("arch=cortex-m3,branch-protection=bti+pac-ret"))) void f11(void) {}
f12(void)18 __attribute__((target("arch=cortex-m3,branch-protection=bti+pac-ret+leaf"))) void f12(void) {}
19 // Armv7E-M
f13(void)20 __attribute__((target("arch=cortex-m4,branch-protection=bti"))) void f13(void) {}
f14(void)21 __attribute__((target("arch=cortex-m4,branch-protection=pac-ret"))) void f14(void) {}
f15(void)22 __attribute__((target("arch=cortex-m4,branch-protection=bti+pac-ret"))) void f15(void) {}
f16(void)23 __attribute__((target("arch=cortex-m4,branch-protection=bti+pac-ret+leaf"))) void f16(void) {}
24