[clang] 8f8bbf9 - [test] Clean up ppc-features.cpp and improve tests
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 24 11:59:23 PST 2020
Author: Fangrui Song
Date: 2020-11-24T11:59:15-08:00
New Revision: 8f8bbf98dae1c513b70614a9640b861e6e240b5f
URL: https://github.com/llvm/llvm-project/commit/8f8bbf98dae1c513b70614a9640b861e6e240b5f
DIFF: https://github.com/llvm/llvm-project/commit/8f8bbf98dae1c513b70614a9640b861e6e240b5f.diff
LOG: [test] Clean up ppc-features.cpp and improve tests
And add ppc-cpus.cpp for -mcpu= specific tests.
Added:
clang/test/Driver/ppc-cpus.c
Modified:
clang/test/Driver/ppc-features.cpp
Removed:
################################################################################
diff --git a/clang/test/Driver/ppc-cpus.c b/clang/test/Driver/ppc-cpus.c
new file mode 100644
index 000000000000..9f23d86e41ef
--- /dev/null
+++ b/clang/test/Driver/ppc-cpus.c
@@ -0,0 +1,21 @@
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=ppc64 2>&1 | FileCheck --check-prefix=MCPU_PPC64 %s
+// MCPU_PPC64: "-target-cpu" "ppc64"
+
+/// We cannot check much for -mcpu=native, but it should be replaced by a CPU name.
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=native 2>&1 | FileCheck --check-prefix=MCPU_NATIVE %s
+// MCPU_NATIVE-NOT: "-target-cpu" "native"
+
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=7400 2>&1 | FileCheck --check-prefix=MCPU_7400 %s
+// MCPU_7400: "-target-cpu" "7400"
+
+/// The following -mcpu= have their own -target-cpu values.
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=G4 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=7450 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=G4+ 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=970 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=G5 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=pwr6 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=pwr7 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+// RUN: %clang -### -c -target powerpc64 %s -mcpu=pwr8 2>&1 | FileCheck %s --check-prefix=NO_PPC64
+
+// NO_PPC64-NOT: "-target-cpu" "ppc64"
diff --git a/clang/test/Driver/ppc-features.cpp b/clang/test/Driver/ppc-features.cpp
index a1affba61ee4..de176c9d5942 100644
--- a/clang/test/Driver/ppc-features.cpp
+++ b/clang/test/Driver/ppc-features.cpp
@@ -1,3 +1,9 @@
+/// Check default CC1 and linker options for ppc32.
+// RUN: %clang -### -target powerpc-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefix=PPC32 %s
+// PPC32: "-mfloat-abi" "hard"
+
+// PPC32: "-m" "elf32ppclinux"
+
// check -msoft-float option for ppc32
// RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT %s
// CHECK-SOFTFLOAT: "-target-feature" "-hard-float"
@@ -30,6 +36,15 @@
// RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=x -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ERRMSG %s
// CHECK-ERRMSG: error: invalid float ABI '-mfloat-abi=x'
+
+/// Check default CC1 and linker options for ppc64.
+// RUN: %clang -### -target powerpc64le-unknown-linux-gnu %s 2>&1 | FileCheck --check-prefix=PPC64 %s
+// RUN: %clang -### -target powerpc64-unknown-linux-gnu %s 2>&1 | FileCheck -check-prefix=PPC64BE %s
+// PPC64: "-mfloat-abi" "hard"
+
+// PPC64: "-m" "elf64lppc"
+// PPC64BE: "-m" "elf64ppc"
+
// check -msoft-float option for ppc64
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT64 %s
// CHECK-SOFTFLOAT64: "-target-feature" "-hard-float"
@@ -48,53 +63,11 @@
// Check that -mno-altivec correctly disables the altivec target feature on powerpc.
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-1 %s
-// CHECK-1: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-2 %s
-// CHECK-2: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-3 %s
-// CHECK-3: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-4 %s
-// CHECK-4: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-5 %s
-// CHECK-5-NOT: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-6 %s
-// CHECK-6-NOT: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=7400 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-7 %s
-// CHECK-7: "-target-feature" "-altivec"
+// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=ALTIVEC %s
+// ALTIVEC: "-target-feature" "+altivec"
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=g4 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-8 %s
-// CHECK-8: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=7450 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-9 %s
-// CHECK-9: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=g4+ -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-10 %s
-// CHECK-10: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=970 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-11 %s
-// CHECK-11: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=g5 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-12 %s
-// CHECK-12: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=pwr6 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-13 %s
-// CHECK-13: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=pwr7 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-14 %s
-// CHECK-14: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=pwr8 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-15 %s
-// CHECK-15: "-target-feature" "-altivec"
-
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -mcpu=ppc64 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-16 %s
-// CHECK-16: "-target-feature" "-altivec"
+// RUN: %clang -### -c -target powerpc64-unknown-linux-gnu %s -maltivec -mno-altivec 2>&1 | FileCheck --check-prefix=NO_ALTIVEC %s
+// NO_ALTIVEC: "-target-feature" "-altivec"
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-qpx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOQPX %s
// CHECK-NOQPX: "-target-feature" "-qpx"
@@ -190,13 +163,6 @@
// CHECK_LE_AS_ARGS: "-mlittle-endian"
// CHECK_LE_AS_ARGS: "-mpower8"
-// linker features
-// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_BE_LD_ARGS %s
-// CHECK_BE_LD_ARGS: "elf64ppc"
-
-// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_LE_LD_ARGS %s
-// CHECK_LE_LD_ARGS: "elf64lppc"
-
// OpenMP features
// RUN: %clang -target powerpc-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
More information about the cfe-commits
mailing list