From 30354ebb003375b1f112bd491bb61d54d5f37f22 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Mon, 31 Oct 2016 14:38:05 +0000 Subject: [PATCH] [SystemZ] Add -march=archX aliases For compatibility with other compilers on the platform, allow specifying levels of the z/Architecture instead of model names with -march. In particular, the following aliases are now supported: -march=arch8 equals -march=z10 -march=arch9 equals -march=z196 -march=arch10 equals -march=zEC12 -march=arch11 equals -march=z13 This parallels the equivalent (and prerequisite) LLVM change in r285577. llvm-svn: 285578 --- clang/lib/Basic/Targets.cpp | 8 ++++++-- clang/test/CodeGen/systemz-abi-vector.c | 2 ++ clang/test/CodeGen/systemz-abi.c | 2 ++ clang/test/CodeGen/target-data.c | 2 ++ clang/test/Driver/systemz-march.c | 10 ++++++++++ clang/test/Preprocessor/predefined-arch-macros.c | 3 +++ 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 9355f3b..64c7dbe 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -6941,9 +6941,13 @@ public: CPU = Name; bool CPUKnown = llvm::StringSwitch(Name) .Case("z10", true) + .Case("arch8", true) .Case("z196", true) + .Case("arch9", true) .Case("zEC12", true) + .Case("arch10", true) .Case("z13", true) + .Case("arch11", true) .Default(false); return CPUKnown; @@ -6952,9 +6956,9 @@ public: initFeatureMap(llvm::StringMap &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector &FeaturesVec) const override { - if (CPU == "zEC12") + if (CPU == "zEC12" || CPU == "arch10") Features["transactional-execution"] = true; - if (CPU == "z13") { + if (CPU == "z13" || CPU == "arch11") { Features["transactional-execution"] = true; Features["vector"] = true; } diff --git a/clang/test/CodeGen/systemz-abi-vector.c b/clang/test/CodeGen/systemz-abi-vector.c index 1d1f302..455e3bb 100644 --- a/clang/test/CodeGen/systemz-abi-vector.c +++ b/clang/test/CodeGen/systemz-abi-vector.c @@ -4,6 +4,8 @@ // RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 \ // RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s +// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \ +// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s // Vector types diff --git a/clang/test/CodeGen/systemz-abi.c b/clang/test/CodeGen/systemz-abi.c index 375d02a..17fdb9e 100644 --- a/clang/test/CodeGen/systemz-abi.c +++ b/clang/test/CodeGen/systemz-abi.c @@ -4,6 +4,8 @@ // RUN: -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 \ // RUN: -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \ +// RUN: -emit-llvm -o - %s | FileCheck %s // Scalar types diff --git a/clang/test/CodeGen/target-data.c b/clang/test/CodeGen/target-data.c index c12ad2c..63a85b5 100644 --- a/clang/test/CodeGen/target-data.c +++ b/clang/test/CodeGen/target-data.c @@ -169,6 +169,8 @@ // RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -o - -emit-llvm %s | \ // RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR +// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch11 -o - -emit-llvm %s | \ +// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR // SYSTEMZ-VECTOR: target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64" // RUN: %clang_cc1 -triple msp430-unknown -o - -emit-llvm %s | \ diff --git a/clang/test/Driver/systemz-march.c b/clang/test/Driver/systemz-march.c index ffc126f..a5df1f4 100644 --- a/clang/test/Driver/systemz-march.c +++ b/clang/test/Driver/systemz-march.c @@ -2,12 +2,22 @@ // RUN: not %clang -target s390x -S -emit-llvm -march=z9 %s -o - 2>&1 | FileCheck --check-prefix=CHECK-Z9 %s // RUN: %clang -target s390x -### -S -emit-llvm -march=z10 %s 2>&1 | FileCheck --check-prefix=CHECK-Z10 %s +// RUN: %clang -target s390x -### -S -emit-llvm -march=arch8 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH8 %s // RUN: %clang -target s390x -### -S -emit-llvm -march=z196 %s 2>&1 | FileCheck --check-prefix=CHECK-Z196 %s +// RUN: %clang -target s390x -### -S -emit-llvm -march=arch9 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH9 %s // RUN: %clang -target s390x -### -S -emit-llvm -march=zEC12 %s 2>&1 | FileCheck --check-prefix=CHECK-ZEC12 %s +// RUN: %clang -target s390x -### -S -emit-llvm -march=arch10 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH10 %s +// RUN: %clang -target s390x -### -S -emit-llvm -march=z13 %s 2>&1 | FileCheck --check-prefix=CHECK-Z13 %s +// RUN: %clang -target s390x -### -S -emit-llvm -march=arch11 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH11 %s // CHECK-Z9: error: unknown target CPU 'z9' // CHECK-Z10: "-target-cpu" "z10" +// CHECK-ARCH8: "-target-cpu" "arch8" // CHECK-Z196: "-target-cpu" "z196" +// CHECK-ARCH9: "-target-cpu" "arch9" // CHECK-ZEC12: "-target-cpu" "zEC12" +// CHECK-ARCH10: "-target-cpu" "arch10" +// CHECK-Z13: "-target-cpu" "z13" +// CHECK-ARCH11: "-target-cpu" "arch11" int x; diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index dcb03b1..51b587e 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -1969,6 +1969,9 @@ // RUN: %clang -march=zEC12 -E -dM %s -o - 2>&1 \ // RUN: -target s390x-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_ZEC12 +// RUN: %clang -march=arch10 -E -dM %s -o - 2>&1 \ +// RUN: -target s390x-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_ZEC12 // // CHECK_SYSTEMZ_ZEC12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 // CHECK_SYSTEMZ_ZEC12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 -- 2.7.4