105 lines · plain
1/// These tests make sure that options passed to the assembler2/// via -Wa or -Xassembler are applied correctly to assembler inputs.3/// Also we check that the same priority rules apply to compiler and4/// assembler options.5///6/// Note that the cortex-a8 is armv7-a, the cortex-a32 is armv8-a7/// and clang's default Arm architecture is armv4t.8 9/// Basic correctness check for how the options behave when passed to the compiler10// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv7-a %s 2>&1 | \11// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s12// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv7-a+crc %s 2>&1 | \13// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,EXT-CRC %s14 15/// -Wa/-Xassembler doesn't apply to non assembly files16// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7-a \17// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefix=TRIPLE-ARMV4 %s18// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7-a \19// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck --check-prefix=TRIPLE-ARMV4 %s20 21/// -Wa/-Xassembler does apply to assembler input22// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7-a %s 2>&1 | \23// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s24// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7-a+crc %s 2>&1 | \25// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,EXT-CRC %s26// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7-a %s 2>&1 | \27// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s28// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7-a+crc %s 2>&1 | \29// RUN: FileCheck --check-prefixes=TRIPLE-ARMV7,EXT-CRC %s30 31/// Check that arch name is still canonicalised32// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv7a %s 2>&1 | \33// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s34// RUN: %clang -target arm-linux-gnueabi -### -c -Xassembler -march=armv7 %s 2>&1 | \35// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s36 37/// march to compiler and assembler, we choose the one suited to the input file type38// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8-a -Wa,-march=armv7a %s 2>&1 | \39// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s40// 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 %s42 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 %s47// 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 %s49 50/// march to compiler and mcpu to assembler, we use the one that matches the file type51/// (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 %s54// 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 %s56 57/// march and mcpu to the compiler, mcpu wins58// 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 %s60/// not dependent on order61// 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 %s63/// or file type64// 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 %s66 67/// If we pass mcpu and march to the assembler then mcpu's arch wins68/// (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 %s71// 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 %s73// 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 %s75 76/// Last mcpu to assembler wins77// 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 %s79// 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 %s81// 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 %s83 84/// Last mcpu to compiler wins85// 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 %s87 88/// Last march to assembler wins89// RUN: %clang -target arm-linux-gnueabi -### -c -Wa,-march=armv8-a,-march=armv7-a %s 2>&1 | \90// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s91// 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 %s93// 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 %s95 96/// Last march to compiler wins97// RUN: %clang -target arm-linux-gnueabi -### -c -march=armv8-a -march=armv7-a %s 2>&1 | \98// RUN: FileCheck --check-prefix=TRIPLE-ARMV7 %s99 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"105