1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64 -emit-llvm -target-cpu generic -target-feature +v8.5a %s -o - \
3 // RUN: | FileCheck %s --check-prefix=CHECK
5 __attribute__ ((target("branch-protection=none")))
7 // CHECK: define{{.*}} void @none() #[[#NONE:]]
9 __attribute__ ((target("branch-protection=standard")))
11 // CHECK: define{{.*}} void @std() #[[#STD:]]
13 __attribute__ ((target("branch-protection=bti")))
15 // CHECK: define{{.*}} void @btionly() #[[#BTI:]]
17 __attribute__ ((target("branch-protection=pac-ret")))
19 // CHECK: define{{.*}} void @paconly() #[[#PAC:]]
21 __attribute__ ((target("branch-protection=pac-ret+bti")))
23 // CHECK: define{{.*}} void @pacbti0() #[[#PACBTI:]]
25 __attribute__ ((target("branch-protection=bti+pac-ret")))
27 // CHECK: define{{.*}} void @pacbti1() #[[#PACBTI]]
29 __attribute__ ((target("branch-protection=pac-ret+leaf")))
31 // CHECK: define{{.*}} void @leaf() #[[#PACLEAF:]]
33 __attribute__ ((target("branch-protection=pac-ret+b-key")))
35 // CHECK: define{{.*}} void @bkey() #[[#PACBKEY:]]
37 __attribute__ ((target("branch-protection=pac-ret+b-key+leaf")))
39 // CHECK: define{{.*}} void @bkeyleaf0() #[[#PACBKEYLEAF:]]
41 __attribute__ ((target("branch-protection=pac-ret+leaf+b-key")))
43 // CHECK: define{{.*}} void @bkeyleaf1() #[[#PACBKEYLEAF]]
45 __attribute__ ((target("branch-protection=pac-ret+leaf+bti")))
47 // CHECK: define{{.*}} void @btileaf() #[[#BTIPACLEAF:]]
49 // CHECK-DAG: attributes #[[#NONE]] = { {{.*}} "branch-target-enforcement"="false" {{.*}} "sign-return-address"="none"
51 // CHECK-DAG: attributes #[[#STD]] = { {{.*}} "branch-target-enforcement"="true" {{.*}} "sign-return-address"="non-leaf" "sign-return-address-key"="a_key"
53 // CHECK-DAG: attributes #[[#BTI]] = { {{.*}} "branch-target-enforcement"="true" {{.*}} "sign-return-address"="none"
55 // CHECK-DAG: attributes #[[#PAC]] = { {{.*}} "branch-target-enforcement"="false" {{.*}} "sign-return-address"="non-leaf" "sign-return-address-key"="a_key"
57 // CHECK-DAG: attributes #[[#PACLEAF]] = { {{.*}} "branch-target-enforcement"="false" {{.*}}"sign-return-address"="all" "sign-return-address-key"="a_key"
59 // CHECK-DAG: attributes #[[#PACBKEY]] = { {{.*}}"branch-target-enforcement"="false" {{.*}} "sign-return-address"="non-leaf" "sign-return-address-key"="b_key"
61 // CHECK-DAG: attributes #[[#PACBKEYLEAF]] = { {{.*}} "branch-target-enforcement"="false" {{.*}}"sign-return-address"="all" "sign-return-address-key"="b_key"
63 // CHECK-DAG: attributes #[[#BTIPACLEAF]] = { {{.*}}"branch-target-enforcement"="true" {{.*}} "sign-return-address"="all" "sign-return-address-key"="a_key"