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:]]
50 __attribute__ ((target("branch-protection=pac-ret+pc")))
52 // CHECK: define{{.*}} void @pauthlr() #[[#PAUTHLR:]]
54 __attribute__ ((target("branch-protection=pac-ret+pc+b-key")))
55 void pauthlr_bkey() {}
56 // CHECK: define{{.*}} void @pauthlr_bkey() #[[#PAUTHLR_BKEY:]]
58 __attribute__ ((target("branch-protection=pac-ret+pc+leaf")))
59 void pauthlr_leaf() {}
60 // CHECK: define{{.*}} void @pauthlr_leaf() #[[#PAUTHLR_LEAF:]]
62 __attribute__ ((target("branch-protection=pac-ret+pc+bti")))
64 // CHECK: define{{.*}} void @pauthlr_bti() #[[#PAUTHLR_BTI:]]
66 __attribute__ ((target("branch-protection=gcs")))
68 // CHECK: define{{.*}} void @gcs() #[[#GCS:]]
70 // CHECK-DAG: attributes #[[#NONE]] = { {{.*}} "branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}} "sign-return-address"="none"
72 // CHECK-DAG: attributes #[[#STD]] = { {{.*}} "branch-target-enforcement"="true" "guarded-control-stack"="true" {{.*}} "sign-return-address"="non-leaf" "sign-return-address-key"="a_key"
74 // CHECK-DAG: attributes #[[#BTI]] = { {{.*}} "branch-target-enforcement"="true" "guarded-control-stack"="false" {{.*}} "sign-return-address"="none"
76 // CHECK-DAG: attributes #[[#PAC]] = { {{.*}} "branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}} "sign-return-address"="non-leaf" "sign-return-address-key"="a_key"
78 // CHECK-DAG: attributes #[[#PACLEAF]] = { {{.*}} "branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}}"sign-return-address"="all" "sign-return-address-key"="a_key"
80 // CHECK-DAG: attributes #[[#PACBKEY]] = { {{.*}}"branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}} "sign-return-address"="non-leaf" "sign-return-address-key"="b_key"
82 // CHECK-DAG: attributes #[[#PACBKEYLEAF]] = { {{.*}} "branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}}"sign-return-address"="all" "sign-return-address-key"="b_key"
84 // CHECK-DAG: attributes #[[#BTIPACLEAF]] = { {{.*}}"branch-target-enforcement"="true" "guarded-control-stack"="false" {{.*}} "sign-return-address"="all" "sign-return-address-key"="a_key"
87 // CHECK-DAG: attributes #[[#PAUTHLR]] = { {{.*}}"branch-protection-pauth-lr"="true" {{.*}}"branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}}"sign-return-address"="non-leaf" "sign-return-address-key"="a_key"
89 // CHECK-DAG: attributes #[[#PAUTHLR_BKEY]] = { {{.*}}"branch-protection-pauth-lr"="true" {{.*}}"branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}}"sign-return-address"="non-leaf" "sign-return-address-key"="b_key"
91 // CHECK-DAG: attributes #[[#PAUTHLR_LEAF]] = { {{.*}}"branch-protection-pauth-lr"="true" {{.*}}"branch-target-enforcement"="false" "guarded-control-stack"="false" {{.*}}"sign-return-address"="all" "sign-return-address-key"="a_key"
93 // CHECK-DAG: attributes #[[#PAUTHLR_BTI]] = { {{.*}}"branch-protection-pauth-lr"="true" {{.*}}"branch-target-enforcement"="true" "guarded-control-stack"="false" {{.*}}"sign-return-address"="non-leaf" "sign-return-address-key"="a_key"
95 // CHECK-DAG: attributes #[[#GCS]] = { {{.*}}"branch-target-enforcement"="false" "guarded-control-stack"="true" {{.*}} "sign-return-address"="none"