1// Test that different values of -Wa,-mcpu/mfpu/march/mhwdiv pick correct ARM target-feature(s).
2// Complete tests about -mcpu/mfpu/march/mhwdiv on other files.
3
4// CHECK-DUP-CPU: warning: argument unused during compilation: '-mcpu=cortex-a8'
5// CHECK-DUP-FPU: warning: argument unused during compilation: '-mfpu=vfpv3'
6// CHECK-DUP-ARCH: warning: argument unused during compilation: '-march=armv7'
7// CHECK-DUP-HDIV: warning: argument unused during compilation: '-mhwdiv=arm'
8
9// CHECK: "cc1as"
10// ================================================================= CPU
11// RUN: %clang -target arm-linux-gnueabi -Wa,-mcpu=cortex-a15 -c %s -### 2>&1 \
12// RUN:   | FileCheck -check-prefix=CHECK-CPU %s
13// CHECK-CPU: "-target-cpu" "cortex-a15"
14
15// RUN: %clang -target arm -Wa,-mcpu=bogus -c %s -### 2>&1 \
16// RUN:   | FileCheck -check-prefix=CHECK-BOGUS-CPU %s
17// CHECK-BOGUS-CPU: error: {{.*}} does not support '-Wa,-mcpu=bogus'
18
19// RUN: %clang -target arm -mcpu=cortex-a8 -Wa,-mcpu=cortex-a15 -c %s -### 2>&1 \
20// RUN:   | FileCheck -check-prefix=CHECK-DUP-CPU %s
21// CHECK-DUP-CPU: "-target-cpu" "cortex-a15"
22
23// ================================================================= FPU
24// RUN: %clang -target arm-linux-eabi -Wa,-mfpu=neon -c %s -### 2>&1 \
25// RUN:   | FileCheck --check-prefix=CHECK-NEON %s
26// CHECK-NEON: "-target-feature" "+neon"
27
28// RUN: %clang -target arm-linux-eabi -Wa,-mfpu=bogus -c %s -### 2>&1 \
29// RUN:   | FileCheck --check-prefix=CHECK-BOGUS-FPU %s
30// CHECK-BOGUS-FPU: error: {{.*}} does not support '-Wa,-mfpu=bogus'
31
32// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 -Wa,-mfpu=neon -c %s -### 2>&1 \
33// RUN:   | FileCheck -check-prefix=CHECK-DUP-FPU %s
34// CHECK-DUP-FPU: "-target-feature" "+neon"
35
36// ================================================================= Arch
37// Arch validation only for now, in case we're passing to an external asm
38
39// RUN: %clang -target arm -Wa,-march=armbogusv6 -c %s -### 2>&1 \
40// RUN:   | FileCheck -check-prefix=CHECK-BOGUS-ARCH %s
41// CHECK-BOGUS-ARCH: error: {{.*}} does not support '-Wa,-march=armbogusv6'
42
43// RUN: %clang -target arm -march=armv7 -Wa,-march=armv6 -c %s -### 2>&1 \
44// RUN:   | FileCheck -check-prefix=CHECK-DUP-ARCH %s
45
46// ================================================================= HD Div
47// RUN: %clang -target arm -Wa,-mhwdiv=arm -c %s -### 2>&1 \
48// RUN:   | FileCheck --check-prefix=CHECK-ARM %s
49// CHECK-ARM: "-target-feature" "+hwdiv-arm"
50// CHECK-ARM: "-target-feature" "-hwdiv"
51
52// RUN: %clang -target arm -Wa,-mhwdiv=thumb -c %s -### 2>&1 \
53// RUN:   | FileCheck --check-prefix=CHECK-THUMB %s
54// CHECK-THUMB: "-target-feature" "-hwdiv-arm"
55// CHECK-THUMB: "-target-feature" "+hwdiv"
56
57// RUN: %clang -target arm -Wa,-mhwdiv=bogus -c %s -### 2>&1 \
58// RUN:   | FileCheck --check-prefix=CHECK-BOGUS-HDIV %s
59// CHECK-BOGUS-HDIV: error: {{.*}} does not support '-Wa,-mhwdiv=bogus'
60
61// RUN: %clang -target arm -mhwdiv=arm -Wa,-mhwdiv=thumb -c %s -### 2>&1 \
62// RUN:   | FileCheck --check-prefix=CHECK-DUP-HDIV %s
63// CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
64// CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
65
66// ========================================================== Triple
67// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
68// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \
69// RUN:   | FileCheck -check-prefix=CHECK-A-PROFILE %s
70// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}"
71
72// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
73// RUN:   | FileCheck -check-prefix=CHECK-R-PROFILE %s
74// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
75
76// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
77// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
78// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \
79// RUN:   | FileCheck -check-prefix=CHECK-M-PROFILE %s
80// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"
81
82