xref: /llvm-project/flang/test/Driver/target-cpu-features.f90 (revision 6ff41e860fdb69bb9e234e003255aae9accff79a)
1! Test that -mcpu/march are used and that the -target-cpu and -target-features
2! are also added to the fc1 command.
3
4! RUN: %flang --target=aarch64-linux-gnu -mcpu=cortex-a57 -c %s -### 2>&1 \
5! RUN: | FileCheck %s -check-prefix=CHECK-A57
6
7! RUN: %flang --target=aarch64-linux-gnu -mcpu=cortex-a76 -c %s -### 2>&1 \
8! RUN: | FileCheck %s -check-prefix=CHECK-A76
9
10! RUN: %flang --target=aarch64-linux-gnu -march=armv9 -c %s -### 2>&1 \
11! RUN: | FileCheck %s -check-prefix=CHECK-ARMV9
12
13! Negative test. ARM cpu with x86 target.
14! RUN: not %flang --target=x86_64-linux-gnu -mcpu=cortex-a57 -c %s -### 2>&1 \
15! RUN: | FileCheck %s -check-prefix=CHECK-NO-A57
16
17! RUN: %flang --target=x86_64-linux-gnu -march=skylake -c %s -### 2>&1 \
18! RUN: | FileCheck %s -check-prefix=CHECK-SKYLAKE
19
20! RUN: %flang --target=x86_64-linux-gnu -mapx-features=egpr -c %s -### 2>&1 \
21! RUN: | FileCheck %s -check-prefix=CHECK-APX
22
23! RUN: %flang --target=x86_64-linux-gnu -mno-apx-features=ccmp -c %s -### 2>&1 \
24! RUN: | FileCheck %s -check-prefix=CHECK-NO-APX
25
26! RUN: %flang --target=x86_64-linux-gnu -mevex512 -c %s -### 2>&1 \
27! RUN: | FileCheck %s -check-prefix=CHECK-EVEX512
28
29! RUN: %flang --target=x86_64-linux-gnu -mno-evex512 -c %s -### 2>&1 \
30! RUN: | FileCheck %s -check-prefix=CHECK-NO-EVEX512
31
32! RUN: %flang --target=x86_64h-linux-gnu -c %s -### 2>&1 \
33! RUN: | FileCheck %s -check-prefix=CHECK-X86_64H
34
35! RUN: %flang --target=riscv64-linux-gnu -c %s -### 2>&1 \
36! RUN: | FileCheck %s -check-prefix=CHECK-RV64
37
38! RUN: %flang --target=amdgcn-amd-amdhsa -mcpu=gfx908 -nogpulib -c %s -### 2>&1 \
39! RUN: | FileCheck %s -check-prefix=CHECK-AMDGPU
40
41! RUN: %flang --target=r600-unknown-unknown -mcpu=cayman -nogpulib -c %s -### 2>&1 \
42! RUN: | FileCheck %s -check-prefix=CHECK-AMDGPU-R600
43
44! RUN: %flang --target=loongarch64-linux-gnu -c %s -### 2>&1 \
45! RUN: | FileCheck %s -check-prefix=CHECK-LOONGARCH64
46
47! CHECK-A57: "-fc1" "-triple" "aarch64-unknown-linux-gnu"
48! CHECK-A57-SAME: "-target-cpu" "cortex-a57"
49! CHECK-A57-SAME: "-target-feature" "+v8a" "-target-feature" "+aes" "-target-feature" "+crc" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+perfmon" "-target-feature" "+sha2
50
51! CHECK-A76: "-fc1" "-triple" "aarch64-unknown-linux-gnu"
52! CHECK-A76-SAME: "-target-cpu" "cortex-a76"
53! CHECK-A76-SAME: "-target-feature" "+v8.2a" "-target-feature" "+aes" "-target-feature" "+crc" "-target-feature" "+dotprod" "-target-feature" "+fp-armv8" "-target-feature" "+fullfp16" "-target-feature" "+lse" "-target-feature" "+neon" "-target-feature" "+perfmon" "-target-feature" "+ras" "-target-feature" "+rcpc" "-target-feature" "+rdm" "-target-feature" "+sha2" "-target-feature" "+ssbs"
54
55! CHECK-ARMV9: "-fc1" "-triple" "aarch64-unknown-linux-gnu"
56! CHECK-ARMV9-SAME: "-target-cpu" "generic"
57! CHECK-ARMV9-SAME: "-target-feature" "+v9a"
58! CHECK-ARMV9-SAME: "-target-feature" "+sve"
59! CHECK-ARMV9-SAME: "-target-feature" "+sve2"
60
61! CHECK-NO-A57: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
62! CHECK-NO-A57-NOT: cortex-a57
63! CHECK-NO-A57-SAME: "-target-cpu" "x86-64"
64! CHECK-NO-A57-NOT: cortex-a57
65
66! CHECK-SKYLAKE: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
67! CHECK-SKYLAKE-SAME: "-target-cpu" "skylake"
68
69! CHECK-APX: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
70! CHECK-APX-SAME: "-target-feature" "+egpr"
71
72! CHECK-NO-APX: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
73! CHECK-NO-APX-SAME: "-target-feature" "-ccmp"
74
75! CHECK-EVEX512: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
76! CHECK-EVEX512-SAME: "-target-feature" "+evex512"
77
78! CHECK-NO-EVEX512: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
79! CHECK-NO-EVEX512-SAME: "-target-feature" "-evex512"
80
81! CHECK-X86_64H: "-fc1" "-triple" "x86_64h-unknown-linux-gnu"
82! CHECK-X86_64H-SAME: "-target-cpu" "x86-64" "-target-feature" "-rdrnd" "-target-feature" "-aes" "-target-feature" "-pclmul" "-target-feature" "-rtm" "-target-feature" "-fsgsbase"
83
84! CHECK-RV64: "-fc1" "-triple" "riscv64-unknown-linux-gnu"
85! CHECK-RV64-SAME: "-target-cpu" "generic-rv64" "-target-feature" "+m" "-target-feature" "+a" "-target-feature" "+f" "-target-feature" "+d" "-target-feature" "+c"
86
87! CHECK-AMDGPU: "-fc1" "-triple" "amdgcn-amd-amdhsa"
88! CHECK-AMDGPU-SAME: "-target-cpu" "gfx908"
89
90! CHECK-AMDGPU-R600: "-fc1" "-triple" "r600-unknown-unknown"
91! CHECK-AMDGPU-R600-SAME: "-target-cpu" "cayman"
92
93! CHECK-LOONGARCH64: "-fc1" "-triple" "loongarch64-unknown-linux-gnu"
94! CHECK-LOONGARCH64-SAME: "-target-cpu" "loongarch64" "-target-feature" "+lsx" "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d" "-target-feature" "+ual"
95