| 1 |
/// These tests make sure that options passed to the assembler |
| 2 |
/// via -Wa or -Xassembler are applied correctly to assembler inputs. |
| 3 |
/// Also we check that the same priority rules apply to compiler and |
| 4 |
/// assembler options. |
| 5 |
/// |
| 6 |
/// Note that the cortex-a8 is armv7-a, the cortex-a32 is armv8-a |
| 7 |
/// and clang's default Arm architecture is armv4t. |
| 8 |
|
| 9 |
/// Basic correctness check for how the options behave when passed to the compiler |
| 10 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv7-a %s 2>&1 | \ |
| 11 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 12 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv7-a+crc %s 2>&1 | \ |
| 13 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,EXT-CRC %s |
| 14 |
|
| 15 |
/// -Wa/-Xassembler doesn't apply to non assembly files |
| 16 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7-a \ |
| 17 |
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefix=TRIPLE-ARMV4 %s |
| 18 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7-a \ |
| 19 |
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefix=TRIPLE-ARMV4 %s |
| 20 |
|
| 21 |
/// -Wa/-Xassembler does apply to assembler input |
| 22 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7-a %s 2>&1 | \ |
| 23 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 24 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7-a+crc %s 2>&1 | \ |
| 25 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,EXT-CRC %s |
| 26 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7-a %s 2>&1 | \ |
| 27 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 28 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7-a+crc %s 2>&1 | \ |
| 29 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,EXT-CRC %s |
| 30 |
|
| 31 |
/// Check that arch name is still canonicalised |
| 32 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7a %s 2>&1 | \ |
| 33 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 34 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7 %s 2>&1 | \ |
| 35 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 36 |
|
| 37 |
/// march to compiler and assembler, we choose the one suited to the input file type |
| 38 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8-a -Wa,-march=armv7a %s 2>&1 | \ |
| 39 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 40 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv7-a -Wa,-march=armv8-a \ |
| 41 |
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 42 |
|
| 43 |
/// mcpu to compiler and march to assembler, we use the assembler's architecture for assembly files. |
| 44 |
/// We use the target CPU for both. |
| 45 |
// RUN: %clang -target arm-linux-gnueabi -### -c -mcpu=cortex-a8 -Wa,-march=armv8a %s 2>&1 | \ |
| 46 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV8,CPU-A8 %s |
| 47 |
// RUN: %clang -target arm-linux-gnueabi -### -c -mcpu=cortex-a8 -Wa,-march=armv8-a \ |
| 48 |
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 49 |
|
| 50 |
/// march to compiler and mcpu to assembler, we use the one that matches the file type |
| 51 |
/// (again both get the target-cpu option either way) |
| 52 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8a -Wa,-mcpu=cortex-a8 %s 2>&1 | \ |
| 53 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 54 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8a -Wa,-mcpu=cortex-a8 \ |
| 55 |
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefix=TRIPLE-ARMV8 %s |
| 56 |
|
| 57 |
/// march and mcpu to the compiler, mcpu wins |
| 58 |
// RUN: %clang -target arm-linux-gnueabi -### -c -mcpu=cortex-a8 -march=armv8-a %s 2>&1 | \ |
| 59 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 60 |
/// not dependent on order |
| 61 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8-a -mcpu=cortex-a8 %s 2>&1 | \ |
| 62 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 63 |
/// or file type |
| 64 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8a -mcpu=cortex-a8 \ |
| 65 |
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 66 |
|
| 67 |
/// If we pass mcpu and march to the assembler then mcpu's arch wins |
| 68 |
/// (matches the compiler behaviour) |
| 69 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-mcpu=cortex-a8 -Wa,-march=armv8-a %s 2>&1 | \ |
| 70 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 71 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-mcpu=cortex-a8,-march=armv8-a %s 2>&1 | \ |
| 72 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 73 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv8-a -Xassembler -mcpu=cortex-a8 \ |
| 74 |
// RUN: %s 2>&1 | FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 75 |
|
| 76 |
/// Last mcpu to assembler wins |
| 77 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-mcpu=cortex-a32,-mcpu=cortex-a8 %s 2>&1 | \ |
| 78 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 79 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-mcpu=cortex-a32 -Wa,-mcpu=cortex-a8 %s 2>&1 | \ |
| 80 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 --check-prefix=CPU-A8 %s |
| 81 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -mcpu=cortex-a32 -Xassembler -mcpu=cortex-a8 \ |
| 82 |
// RUN: %s 2>&1 | FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 83 |
|
| 84 |
/// Last mcpu to compiler wins |
| 85 |
// RUN: %clang -target arm-linux-gnueabi -### -c -mcpu=cortex-a32 -mcpu=cortex-a8 %s 2>&1 | \ |
| 86 |
// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,CPU-A8 %s |
| 87 |
|
| 88 |
/// Last march to assembler wins |
| 89 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv8-a,-march=armv7-a %s 2>&1 | \ |
| 90 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 91 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv8-a -Wa,-march=armv7-a %s 2>&1 | \ |
| 92 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 93 |
// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv8-a -Xassembler -march=armv7-a \ |
| 94 |
// RUN: %s 2>&1 | FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 95 |
|
| 96 |
/// Last march to compiler wins |
| 97 |
// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8-a -march=armv7-a %s 2>&1 | \ |
| 98 |
// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s |
| 99 |
|
| 100 |
// TRIPLE-ARMV4: "-triple" "armv4t-unknown-linux-gnueabi" |
| 101 |
// TRIPLE-ARMV7: "-triple" "armv7-unknown-linux-gnueabi" |
| 102 |
// TRIPLE-ARMV8: "-triple" "armv8a-unknown-linux-gnueabi" |
| 103 |
// CPU-A8: "-target-cpu" "cortex-a8" |
| 104 |
// EXT-CRC: "-target-feature" "+crc" |