diff options
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 5 | ||||
-rw-r--r-- | clang/test/Driver/ppc-features.cpp | 6 | ||||
-rw-r--r-- | clang/test/Preprocessor/predefined-arch-macros.c | 18 |
3 files changed, 29 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index b3308878dbf..5ae808836a2 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -1488,6 +1488,11 @@ bool PPCTargetInfo::initFeatureMap( .Case("pwr8", true) .Case("pwr7", true) .Default(false); + Features["htm"] = llvm::StringSwitch<bool>(CPU) + .Case("ppc64le", true) + .Case("pwr9", true) + .Case("pwr8", true) + .Default(false); if (!ppcUserFeaturesCheck(Diags, FeaturesVec)) return false; diff --git a/clang/test/Driver/ppc-features.cpp b/clang/test/Driver/ppc-features.cpp index e32a51a8337..73a784f132d 100644 --- a/clang/test/Driver/ppc-features.cpp +++ b/clang/test/Driver/ppc-features.cpp @@ -151,6 +151,12 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-vsx -mvsx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-VSX %s // CHECK-VSX: "-target-feature" "+vsx" +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-htm -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOHTM %s +// CHECK-NOHTM: "-target-feature" "-htm" + +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-htm -mhtm -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-HTM %s +// CHECK-HTM: "-target-feature" "+htm" + // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-power8-vector -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOP8VECTOR %s // CHECK-NOP8VECTOR: "-target-feature" "-power8-vector" diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index 73d0be6caa3..b63b6ddff59 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -1984,6 +1984,24 @@ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_PPC_CRYPTO_M64 // // CHECK_PPC_CRYPTO_M64: #define __CRYPTO__ 1 + +// HTM is available on power8 or later which includes all of powerpc64le as an +// ABI choice. Test that, the cpus, and the option. +// RUN: %clang -mhtm -E -dM %s -o - 2>&1 \ +// RUN: -target powerpc64-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_PPC_HTM +// RUN: %clang -E -dM %s -o - 2>&1 \ +// RUN: -target powerpc64le-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_PPC_HTM +// RUN: %clang -mcpu=pwr8 -E -dM %s -o - 2>&1 \ +// RUN: -target powerpc64-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_PPC_HTM +// RUN: %clang -mcpu=pwr9 -E -dM %s -o - 2>&1 \ +// RUN: -target powerpc64-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_PPC_HTM +// +// CHECK_PPC_HTM: #define __HTM__ 1 + // // RUN: %clang -mcpu=ppc64 -E -dM %s -o - 2>&1 \ // RUN: -target powerpc64-unknown-unknown \ |