diff --git a/clang/test/Driver/woa-crypto.c b/clang/test/Driver/woa-crypto.c new file mode 100644 --- /dev/null +++ b/clang/test/Driver/woa-crypto.c @@ -0,0 +1,6 @@ +// RUN: %clang -target arm-windows-msvc -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target arm-windows-msvc -march=armv8-a+crypto -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-CRYPTO + +// CHECK-DEFAULT: "-target-cpu" "cortex-a9" +// CHECK-CRYPTO: "-target-cpu" "generic" +// CHECK-CRYPTO: "-target-feature" "+crypto" diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -1716,7 +1716,9 @@ break; case llvm::Triple::Win32: // FIXME: this is invalid for WindowsCE - return "cortex-a9"; + if (ARM::parseArchVersion(MArch) <= 7) + return "cortex-a9"; + break; case llvm::Triple::IOS: case llvm::Triple::MacOSX: case llvm::Triple::TvOS: diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp --- a/llvm/unittests/ADT/TripleTest.cpp +++ b/llvm/unittests/ADT/TripleTest.cpp @@ -1511,6 +1511,7 @@ { llvm::Triple Triple("arm--win32"); EXPECT_EQ("cortex-a9", Triple.getARMCPUForArch()); + EXPECT_EQ("generic", Triple.getARMCPUForArch("armv8-a")); } // Some alternative architectures {