| 1 |
// Check the priority between -mcpu, -mtune and -march |
| 2 |
|
| 3 |
// sifive-e76 is rv32imafc and sifive-e31 is rv32imac |
| 4 |
|
| 5 |
// -mcpu, -mtune and -march are not given, pipeline model and arch ext. use |
| 6 |
// default setting. |
| 7 |
// RUN: %clang --target=riscv32-elf -### -c %s 2>&1 \ |
| 8 |
// RUN: | FileCheck -check-prefix=CHECK-DEFAULT %s |
| 9 |
// CHECK-DEFAULT: "-target-cpu" "generic-rv32" |
| 10 |
// CHECK-DEFAULT: "-target-feature" "+m" "-target-feature" "+a" |
| 11 |
// CHECK-DEFAULT: "-target-feature" "+c" |
| 12 |
|
| 13 |
// -mtune is given, pipeline model take from -mtune, arch ext. use |
| 14 |
// default setting. |
| 15 |
// RUN: %clang --target=riscv32 -mtune=sifive-e76 -### -c %s 2>&1 \ |
| 16 |
// RUN: | FileCheck -check-prefix=MTUNE-E76 %s |
| 17 |
// MTUNE-E76: "-target-feature" "+m" "-target-feature" "+a" |
| 18 |
// MTUNE-E76: "-target-feature" "+c" |
| 19 |
// MTUNE-E76: "-target-feature" "-f" |
| 20 |
// MTUNE-E76: "-tune-cpu" "sifive-e76" |
| 21 |
|
| 22 |
// -march is given, arch ext. take from -march, pipeline model use |
| 23 |
// default setting. |
| 24 |
// RUN: %clang --target=riscv32 -### -c %s -march=rv32imafdc 2>&1 \ |
| 25 |
// RUN: | FileCheck -check-prefix=MARCH-RV32IMAFDC %s |
| 26 |
// MARCH-RV32IMAFDC: "-target-cpu" "generic-rv32" |
| 27 |
// MARCH-RV32IMAFDC: "-target-feature" "+m" "-target-feature" "+a" |
| 28 |
// MARCH-RV32IMAFDC: "-target-feature" "+f" "-target-feature" "+d" |
| 29 |
// MARCH-RV32IMAFDC: "-target-feature" "+c" |
| 30 |
|
| 31 |
// -mcpu is given, pipeline model and arch ext. from -mcpu. |
| 32 |
// RUN: %clang --target=riscv32 -### -c %s -mcpu=sifive-e76 2>&1 \ |
| 33 |
// RUN: | FileCheck -check-prefix=MCPU-E76 %s |
| 34 |
// MCPU-E76: "-target-cpu" "sifive-e76" |
| 35 |
// MCPU-E76: "-target-feature" "+m" "-target-feature" "+a" |
| 36 |
// MCPU-E76: "-target-feature" "+f" "-target-feature" "+c" |
| 37 |
|
| 38 |
// -mcpu and -mtune are given, so pipeline model take from -mtune, and arch ext. |
| 39 |
// take from -mcpu since -march is not given. |
| 40 |
// RUN: %clang --target=riscv32 -### -c %s -mcpu=sifive-e76 -mtune=sifive-e31 2>&1 \ |
| 41 |
// RUN: | FileCheck -check-prefix=MCPU-E76-MTUNE-E31 %s |
| 42 |
// MCPU-E76-MTUNE-E31: "-target-cpu" "sifive-e76" |
| 43 |
// MCPU-E76-MTUNE-E31: "-target-feature" "+m" "-target-feature" "+a" |
| 44 |
// MCPU-E76-MTUNE-E31: "-target-feature" "+f" "-target-feature" "+c" |
| 45 |
// MCPU-E76-MTUNE-E31: "-tune-cpu" "sifive-e31" |
| 46 |
|
| 47 |
// RUN: %clang --target=riscv32 -### -c %s -mtune=sifive-e76 -mcpu=sifive-e31 2>&1 \ |
| 48 |
// RUN: | FileCheck -check-prefix=MTUNE-E76-MCPU-E31 %s |
| 49 |
// MTUNE-E76-MCPU-E31: "-target-cpu" "sifive-e31" |
| 50 |
// MTUNE-E76-MCPU-E31: "-target-feature" "+m" "-target-feature" "+a" |
| 51 |
// MTUNE-E76-MCPU-E31: "-target-feature" "+c" |
| 52 |
// MTUNE-E76-MCPU-E31: "-target-feature" "-f" |
| 53 |
// MTUNE-E76-MCPU-E31: "-tune-cpu" "sifive-e76" |
| 54 |
|
| 55 |
// -mcpu and -march are given, so pipeline model take from -mcpu since -mtune is |
| 56 |
// not given, and arch ext. take from -march. |
| 57 |
// RUN: %clang --target=riscv32 -### -c %s -mcpu=sifive-e31 -march=rv32ic 2>&1 \ |
| 58 |
// RUN: | FileCheck -check-prefix=MCPU-E31-MARCH-RV32I %s |
| 59 |
// MCPU-E31-MARCH-RV32I: "-target-cpu" "sifive-e31" |
| 60 |
// MCPU-E31-MARCH-RV32I: "-target-feature" "+c" |
| 61 |
// MCPU-E31-MARCH-RV32I: "-target-feature" "-a" |
| 62 |
// MCPU-E31-MARCH-RV32I: "-target-feature" "-f" |
| 63 |
// MCPU-E31-MARCH-RV32I: "-target-feature" "-m" |
| 64 |
|
| 65 |
// -mcpu, -march and -mtune are given, so pipeline model take from -mtune |
| 66 |
// and arch ext. take from -march, -mcpu is unused. |
| 67 |
// RUN: %clang --target=riscv32 -### -c %s -mcpu=sifive-e31 -mtune=sifive-e76 -march=rv32ic 2>&1 \ |
| 68 |
// RUN: | FileCheck -check-prefix=MCPU-E31-MTUNE-E76-MARCH-RV32I %s |
| 69 |
// MCPU-E31-MTUNE-E76-MARCH-RV32I: "-target-cpu" "sifive-e31" |
| 70 |
// MCPU-E31-MTUNE-E76-MARCH-RV32I: "-target-feature" "+c" |
| 71 |
// MCPU-E31-MTUNE-E76-MARCH-RV32I: "-target-feature" "-a" |
| 72 |
// MCPU-E31-MTUNE-E76-MARCH-RV32I: "-target-feature" "-f" |
| 73 |
// MCPU-E31-MTUNE-E76-MARCH-RV32I: "-target-feature" "-m" |
| 74 |
// MCPU-E31-MTUNE-E76-MARCH-RV32I: "-tune-cpu" "sifive-e76" |