1 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
2 // RUN: -march=rv32i_zicfilp1p0 -fcf-protection=branch \
3 // RUN: -mcf-branch-label-scheme=unlabeled -S -emit-llvm %s -o - | FileCheck \
4 // RUN: --check-prefixes=BRANCH-PROT-FLAG,UNLABELED-FLAG %s
6 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
7 // RUN: -march=rv32i_zicfilp1p0 -fcf-protection=branch \
8 // RUN: -mcf-branch-label-scheme=func-sig -S -emit-llvm %s -o - | FileCheck \
9 // RUN: --check-prefixes=BRANCH-PROT-FLAG,FUNC-SIG-FLAG %s
11 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
12 // RUN: -march=rv32i_zicfilp1p0 -mcf-branch-label-scheme=unlabeled -S \
13 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
14 // RUN: --check-prefixes=NO-FLAG,UNLABELED-SCHEME-UNUSED %s
16 // RUN: %clang --target=riscv32 -menable-experimental-extensions \
17 // RUN: -march=rv32i_zicfilp1p0 -mcf-branch-label-scheme=func-sig -S \
18 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
19 // RUN: --check-prefixes=NO-FLAG,FUNC-SIG-SCHEME-UNUSED %s
21 // RUN: %clang --target=riscv32 -fcf-protection=branch \
22 // RUN: -mcf-branch-label-scheme=unlabeled -S -emit-llvm %s -o - | FileCheck \
23 // RUN: --check-prefixes=BRANCH-PROT-FLAG,UNLABELED-FLAG %s
25 // RUN: %clang --target=riscv32 -fcf-protection=branch \
26 // RUN: -mcf-branch-label-scheme=func-sig -S -emit-llvm %s -o - | FileCheck \
27 // RUN: --check-prefixes=BRANCH-PROT-FLAG,FUNC-SIG-FLAG %s
29 // RUN: %clang --target=riscv32 -mcf-branch-label-scheme=unlabeled -S \
30 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
31 // RUN: --check-prefixes=NO-FLAG,UNLABELED-SCHEME-UNUSED %s
33 // RUN: %clang --target=riscv32 -mcf-branch-label-scheme=func-sig -S \
34 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
35 // RUN: --check-prefixes=NO-FLAG,FUNC-SIG-SCHEME-UNUSED %s
37 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
38 // RUN: -march=rv64i_zicfilp1p0 -fcf-protection=branch \
39 // RUN: -mcf-branch-label-scheme=unlabeled -S -emit-llvm %s -o - | FileCheck \
40 // RUN: --check-prefixes=BRANCH-PROT-FLAG,UNLABELED-FLAG %s
42 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
43 // RUN: -march=rv64i_zicfilp1p0 -fcf-protection=branch \
44 // RUN: -mcf-branch-label-scheme=func-sig -S -emit-llvm %s -o - | FileCheck \
45 // RUN: --check-prefixes=BRANCH-PROT-FLAG,FUNC-SIG-FLAG %s
47 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
48 // RUN: -march=rv64i_zicfilp1p0 -mcf-branch-label-scheme=unlabeled -S \
49 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
50 // RUN: --check-prefixes=NO-FLAG,UNLABELED-SCHEME-UNUSED %s
52 // RUN: %clang --target=riscv64 -menable-experimental-extensions \
53 // RUN: -march=rv64i_zicfilp1p0 -mcf-branch-label-scheme=func-sig -S \
54 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
55 // RUN: --check-prefixes=NO-FLAG,FUNC-SIG-SCHEME-UNUSED %s
57 // RUN: %clang --target=riscv64 -fcf-protection=branch \
58 // RUN: -mcf-branch-label-scheme=unlabeled -S -emit-llvm %s -o - | FileCheck \
59 // RUN: --check-prefixes=BRANCH-PROT-FLAG,UNLABELED-FLAG %s
61 // RUN: %clang --target=riscv64 -fcf-protection=branch \
62 // RUN: -mcf-branch-label-scheme=func-sig -S -emit-llvm %s -o - | FileCheck \
63 // RUN: --check-prefixes=BRANCH-PROT-FLAG,FUNC-SIG-FLAG %s
65 // RUN: %clang --target=riscv64 -mcf-branch-label-scheme=unlabeled -S \
66 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
67 // RUN: --check-prefixes=NO-FLAG,UNLABELED-SCHEME-UNUSED %s
69 // RUN: %clang --target=riscv64 -mcf-branch-label-scheme=func-sig -S \
70 // RUN: -emit-llvm %s -o - 2>&1 | FileCheck \
71 // RUN: --check-prefixes=NO-FLAG,FUNC-SIG-SCHEME-UNUSED %s
73 // Default -mcf-branch-label-scheme is func-sig
74 // RUN: %clang --target=riscv32 -fcf-protection=branch -S -emit-llvm %s -o - \
75 // RUN: | FileCheck --check-prefixes=BRANCH-PROT-FLAG,FUNC-SIG-FLAG %s
77 // Default -mcf-branch-label-scheme is func-sig
78 // RUN: %clang --target=riscv64 -fcf-protection=branch -S -emit-llvm %s -o - \
79 // RUN: | FileCheck --check-prefixes=BRANCH-PROT-FLAG,FUNC-SIG-FLAG %s
81 // UNLABELED-SCHEME-UNUSED: warning: argument unused during compilation:
82 // UNLABELED-SCHEME-UNUSED-SAME: '-mcf-branch-label-scheme=unlabeled'
83 // FUNC-SIG-SCHEME-UNUSED: warning: argument unused during compilation:
84 // FUNC-SIG-SCHEME-UNUSED-SAME: '-mcf-branch-label-scheme=func-sig'
86 // BRANCH-PROT-FLAG-DAG: [[P_FLAG:![0-9]+]] = !{i32 8, !"cf-protection-branch", i32 1}
87 // UNLABELED-FLAG-DAG: [[S_FLAG:![0-9]+]] = !{i32 1, !"cf-branch-label-scheme", !"unlabeled"}
88 // FUNC-SIG-FLAG-DAG: [[S_FLAG:![0-9]+]] = !{i32 1, !"cf-branch-label-scheme", !"func-sig"}
89 // BRANCH-PROT-FLAG-DAG: !llvm.module.flags = !{{[{].*}}[[P_FLAG]]{{.*, }}[[S_FLAG]]{{(,.+)?[}]}}
90 // NO-FLAG-NOT: !{i32 8, !"cf-protection-branch", i32 1}
91 // NO-FLAG-NOT: !{i32 8, !"cf-branch-label-scheme", !"unlabeled"}
92 // NO-FLAG-NOT: !{i32 8, !"cf-branch-label-scheme", !"func-sig"}
94 int main() { return 0; }