1 // Ensure we support the -mtune flag.
2 
3 // Default mtune should be generic.
4 // RUN: %clang -target x86_64-unknown-unknown -c -### %s 2>&1 \
5 // RUN:   | FileCheck %s -check-prefix=notune
6 // notune: "-tune-cpu" "generic"
7 
8 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=generic 2>&1 \
9 // RUN:   | FileCheck %s -check-prefix=generic
10 // generic: "-tune-cpu" "generic"
11 
12 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=nocona 2>&1 \
13 // RUN:   | FileCheck %s -check-prefix=nocona
14 // nocona: "-tune-cpu" "nocona"
15 
16 // Unlike march we allow 32-bit only cpus with mtune.
17 
18 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=i686 2>&1 \
19 // RUN:   | FileCheck %s -check-prefix=i686
20 // i686: "-tune-cpu" "i686"
21 
22 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=pentium4 2>&1 \
23 // RUN:   | FileCheck %s -check-prefix=pentium4
24 // pentium4: "-tune-cpu" "pentium4"
25 
26 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=athlon 2>&1 \
27 // RUN:   | FileCheck %s -check-prefix=athlon
28 // athlon: "-tune-cpu" "athlon"
29 
30 // Check interaction between march and mtune.
31 
32 // -march should remove default mtune generic.
33 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=core2 2>&1 \
34 // RUN:   | FileCheck %s -check-prefix=marchcore2
35 // marchcore2: "-target-cpu" "core2"
36 // marchcore2-NOT: "-tune-cpu"
37 
38 // -march should remove default mtune generic.
39 // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=core2 -mtune=nehalem 2>&1 \
40 // RUN:   | FileCheck %s -check-prefix=marchmtune
41 // marchmtune: "-target-cpu" "core2"
42 // mmarchmtune: "-tune-cpu" "nehalem"
43 
44 // RUN: not %clang %s -target x86_64 -E -mtune=x86-64-v2 2>&1 | FileCheck %s --check-prefix=INVALID
45 // RUN: not %clang %s -target x86_64 -E -mtune=x86-64-v3 2>&1 | FileCheck %s --check-prefix=INVALID
46 // RUN: not %clang %s -target x86_64 -E -mtune=x86-64-v4 2>&1 | FileCheck %s --check-prefix=INVALID
47 // INVALID: error: unknown target CPU '{{.*}}'
48