From b4ad59239d068065b021f587b8bd67776fec71a6 Mon Sep 17 00:00:00 2001 From: Ahmed Bougacha Date: Thu, 15 Dec 2016 18:14:27 +0000 Subject: [PATCH] [Driver] Bump default x86 cpu to Penryn when targeting macosx10.12+. 10.12 dropped support for all pre-Penryn Macs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289839 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 5 +++++ test/Driver/clang-translation.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 8f1f341c7b..dbe8cfb340 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2015,6 +2015,11 @@ static const char *getX86TargetCPU(const ArgList &Args, if (Triple.isOSDarwin()) { if (Triple.getArchName() == "x86_64h") return "core-avx2"; + // macosx10.12 drops support for all pre-Penryn Macs. + // Simulators can still run on 10.11 though, like Xcode. + if (Triple.isMacOSX() && !Triple.isOSVersionLT(10, 12)) + return "penryn"; + // The oldest x86_64 Macs have core2/Merom; the oldest x86 Macs have Yonah. return Is64Bit ? "core2" : "yonah"; } diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index cc3cd1b58b..7c7b2f05f1 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -11,19 +11,36 @@ // I386: "hidden" // I386: "-o" // I386: clang-translation + // RUN: %clang -target i386-apple-darwin9 -### -S %s -o %t.s 2>&1 | \ // RUN: FileCheck -check-prefix=YONAH %s +// RUN: %clang -target i386-apple-macosx10.11 -### -S %s -o %t.s 2>&1 | \ +// RUN: FileCheck -check-prefix=YONAH %s // YONAH: "-target-cpu" // YONAH: "yonah" + // RUN: %clang -target x86_64-apple-darwin9 -### -S %s -o %t.s 2>&1 | \ // RUN: FileCheck -check-prefix=CORE2 %s +// RUN: %clang -target x86_64-apple-macosx10.11 -### -S %s -o %t.s 2>&1 | \ +// RUN: FileCheck -check-prefix=CORE2 %s // CORE2: "-target-cpu" // CORE2: "core2" + // RUN: %clang -target x86_64h-apple-darwin -### -S %s -o %t.s 2>&1 | \ // RUN: FileCheck -check-prefix=AVX2 %s +// RUN: %clang -target x86_64h-apple-macosx10.12 -### -S %s -o %t.s 2>&1 | \ +// RUN: FileCheck -check-prefix=AVX2 %s // AVX2: "-target-cpu" // AVX2: "core-avx2" +// RUN: %clang -target i386-apple-macosx10.12 -### -S %s -o %t.s 2>&1 | \ +// RUN: FileCheck -check-prefix=PENRYN %s +// RUN: %clang -target x86_64-apple-macosx10.12 -### -S %s -o %t.s 2>&1 | \ +// RUN: FileCheck -check-prefix=PENRYN %s +// PENRYN: "-target-cpu" +// PENRYN: "penryn" + + // RUN: %clang -target x86_64-apple-darwin10 -### -S %s -arch armv7 2>&1 | \ // RUN: FileCheck -check-prefix=ARMV7_DEFAULT %s // ARMV7_DEFAULT: clang -- 2.40.0