Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -7252,12 +7252,22 @@ CmdArgs.push_back("-Av9a"); NeedsKPIC = true; } else if (getToolChain().getArch() == llvm::Triple::arm || - getToolChain().getArch() == llvm::Triple::armeb) { - StringRef MArch = getToolChain().getArchName(); - if (MArch == "armv7" || MArch == "armv7a" || MArch == "armv7-a") + getToolChain().getArch() == llvm::Triple::armeb || + getToolChain().getArch() == llvm::Triple::thumb || + getToolChain().getArch() == llvm::Triple::thumbeb) { + StringRef Arch = getToolChain().getArchName(); + if (Arch.startswith("arm")) + Arch = Arch.drop_front(3); + else { + assert(Arch.startswith("thumb")); + Arch = Arch.drop_front(5); + } + if (Arch.startswith("eb")) + Arch = Arch.drop_front(2); + + if (Arch == "v7" || Arch == "v7a" || Arch == "v7-a") CmdArgs.push_back("-mfpu=neon"); - if (MArch == "armv8" || MArch == "armv8a" || MArch == "armv8-a" || - MArch == "armebv8" || MArch == "armebv8a" || MArch == "armebv8-a") + if (Arch == "v8" || Arch == "v8a" || Arch == "v8-a") CmdArgs.push_back("-mfpu=crypto-neon-fp-armv8"); StringRef ARMFloatABI = tools::arm::getARMFloatABI( Index: test/Driver/linux-as.c =================================================================== --- test/Driver/linux-as.c +++ test/Driver/linux-as.c @@ -25,16 +25,61 @@ // RUN: | FileCheck -check-prefix=CHECK-ARM-ALL %s // CHECK-ARM-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armv7-a" "-mcpu=cortex-a8" "-mfpu=neon" // +// RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armebv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARMEB-ALL %s +// CHECK-ARMEB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// +// RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMB-ALL %s +// CHECK-THUMB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=thumbv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// +// RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbebv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMBEB-ALL %s +// CHECK-THUMBEB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=thumbebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// // RUN: %clang -target armv7-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-TARGET %s // CHECK-ARM-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" // +// RUN: %clang -target armebv7-linux -mcpu=cortex-a8 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARMEB-TARGET %s +// CHECK-ARMEB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// +// RUN: %clang -target thumbv7-linux -mcpu=cortex-a8 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMB-TARGET %s +// CHECK-THUMB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// +// RUN: %clang -target thumbebv7-linux -mcpu=cortex-a8 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMBEB-TARGET %s +// CHECK-THUMBEB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// // RUN: %clang -target armv8-linux -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-TARGET-V8 %s // CHECK-ARM-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" // +// RUN: %clang -target armebv8-linux -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARMEB-TARGET-V8 %s +// CHECK-ARMEB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// +// RUN: %clang -target thumbv8-linux -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMB-TARGET-V8 %s +// CHECK-THUMB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// +// RUN: %clang -target thumbebv8-linux -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMBEB-TARGET-V8 %s +// CHECK-THUMBEB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// // RUN: %clang -target arm-linux -mfloat-abi=hard -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-MFLOAT-ABI %s