Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / riscv-features.c
blob851a7c0507eb3a393f188b726a551abb451987f6
1 // RUN: %clang --target=riscv32-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
2 // RUN: %clang --target=riscv64-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
3 // RUN: %clang --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
4 // RUN: %clang -mabi=lp64d --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
6 // CHECK: fno-signed-char
8 // RUN: %clang --target=riscv32-unknown-elf -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
10 // RUN: %clang --target=riscv32-unknown-elf -### %s -mrelax 2>&1 | FileCheck %s -check-prefix=RELAX
11 // RUN: %clang --target=riscv32-unknown-elf -### %s -mno-relax 2>&1 | FileCheck %s -check-prefix=NO-RELAX
13 // ANDROID: "-target-feature" "+v"
14 // ANDROID: "-target-feature" "+zba"
15 // ANDROID: "-target-feature" "+zbb"
16 // ANDROID: "-target-feature" "+zbs"
17 // RELAX: "-target-feature" "+relax"
18 // NO-RELAX: "-target-feature" "-relax"
19 // DEFAULT: "-target-feature" "+relax"
20 // DEFAULT-NOT: "-target-feature" "-relax"
22 // RUN: %clang --target=riscv32-unknown-elf -### %s -msave-restore 2>&1 | FileCheck %s -check-prefix=SAVE-RESTORE
23 // RUN: %clang --target=riscv32-unknown-elf -### %s -mno-save-restore 2>&1 | FileCheck %s -check-prefix=NO-SAVE-RESTORE
25 // SAVE-RESTORE: "-target-feature" "+save-restore"
26 // NO-SAVE-RESTORE: "-target-feature" "-save-restore"
27 // DEFAULT: "-target-feature" "-save-restore"
28 // DEFAULT-NOT: "-target-feature" "+save-restore"
30 // RUN: %clang --target=riscv32-unknown-elf -### %s -munaligned-access 2>&1 | FileCheck %s -check-prefix=UNALIGNED-SCALAR-MEM
31 // RUN: %clang --target=riscv32-unknown-elf -### %s -mno-unaligned-access 2>&1 | FileCheck %s -check-prefix=NO-UNALIGNED-SCALAR-MEM
32 // RUN: %clang --target=riscv32-unknown-elf -### %s -mno-strict-align 2>&1 | FileCheck %s -check-prefix=UNALIGNED-SCALAR-MEM
33 // RUN: %clang --target=riscv32-unknown-elf -### %s -mstrict-align 2>&1 | FileCheck %s -check-prefix=NO-UNALIGNED-SCALAR-MEM
34 // RUN: %clang --target=riscv32-unknown-elf -### %s -march=rv32gv -munaligned-access 2>&1 | FileCheck %s -check-prefix=UNALIGNED-VECTOR-MEM
35 // RUN: %clang --target=riscv32-unknown-elf -### %s -march=rv32gv -mno-unaligned-access 2>&1 | FileCheck %s -check-prefix=NO-UNALIGNED-VECTOR-MEM
36 // RUN: %clang --target=riscv32-unknown-elf -### %s -march=rv32gv -mno-strict-align 2>&1 | FileCheck %s -check-prefix=UNALIGNED-VECTOR-MEM
37 // RUN: %clang --target=riscv32-unknown-elf -### %s -march=rv32gv -mstrict-align 2>&1 | FileCheck %s -check-prefix=NO-UNALIGNED-VECTOR-MEM
39 // UNALIGNED-SCALAR-MEM: "-target-feature" "+unaligned-scalar-mem"
40 // NO-UNALIGNED-SCALAR-MEM: "-target-feature" "-unaligned-scalar-mem"
41 // UNALIGNED-VECTOR-MEM: "-target-feature" "+unaligned-vector-mem"
42 // NO-UNALIGNED-VECTOR-MEM: "-target-feature" "-unaligned-vector-mem"
44 // RUN: %clang --target=riscv32-linux -### %s -fsyntax-only 2>&1 \
45 // RUN: | FileCheck %s -check-prefix=DEFAULT-LINUX
46 // RUN: %clang --target=riscv64-linux -### %s -fsyntax-only 2>&1 \
47 // RUN: | FileCheck %s -check-prefix=DEFAULT-LINUX
49 // DEFAULT-LINUX: "-funwind-tables=2"
50 // DEFAULT-LINUX-SAME: "-target-feature" "+m"
51 // DEFAULT-LINUX-SAME: "-target-feature" "+a"
52 // DEFAULT-LINUX-SAME: "-target-feature" "+f"
53 // DEFAULT-LINUX-SAME: "-target-feature" "+d"
54 // DEFAULT-LINUX-SAME: "-target-feature" "+c"
56 // RUN: not %clang -c --target=riscv64-linux-gnu -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefix=ERR-SPLIT-DWARF
57 // RUN: not %clang -c --target=riscv64 -gsplit-dwarf=single %s 2>&1 | FileCheck %s --check-prefix=ERR-SPLIT-DWARF
58 // RUN: %clang -### -c --target=riscv64 -mno-relax -g -gsplit-dwarf %s 2>&1 | FileCheck %s --check-prefix=SPLIT-DWARF
60 // ERR-SPLIT-DWARF: error: -gsplit-dwarf{{.*}} is unsupported with RISC-V linker relaxation (-mrelax)
61 // SPLIT-DWARF: "-split-dwarf-file"