[clang] 12fbd2d - [Driver][test] Clean up and improve some -mtune tests

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 14:38:02 PDT 2022


Author: Fangrui Song
Date: 2022-07-22T14:37:58-07:00
New Revision: 12fbd2d377e396ad61bce56d71c98a1eb1bebfa9

URL: https://github.com/llvm/llvm-project/commit/12fbd2d377e396ad61bce56d71c98a1eb1bebfa9
DIFF: https://github.com/llvm/llvm-project/commit/12fbd2d377e396ad61bce56d71c98a1eb1bebfa9.diff

LOG: [Driver][test] Clean up and improve some -mtune tests

Note: we should test CHECK-NOT: "-tune-cpu" instead of CHECK-NOT: "-tune-cpu" "generic"

Added: 
    

Modified: 
    clang/test/Driver/aarch64-march.c
    clang/test/Driver/aarch64-mtune.c
    clang/test/Driver/x86-mtune.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/aarch64-march.c b/clang/test/Driver/aarch64-march.c
index 3a278be6ce976..59be5836b39dc 100644
--- a/clang/test/Driver/aarch64-march.c
+++ b/clang/test/Driver/aarch64-march.c
@@ -1,31 +1,31 @@
-// RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-V8A %s
-// RUN: %clang -target aarch64 -march=armv8-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-V8A %s
+// RUN: %clang --target=aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-V8A %s
+// RUN: %clang --target=aarch64 -march=armv8-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-V8A %s
 // GENERIC-V8A: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8a"
 
-// RUN: %clang -target aarch64 -march=armv8-r -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-V8R %s
+// RUN: %clang --target=aarch64 -march=armv8-r -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-V8R %s
 // GENERIC-V8R: "-cc1"{{.*}} "-triple" "aarch64{{(--)?}}"{{.*}} "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8r"
 
-// RUN: %clang -target aarch64 -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
-// RUN: %clang -target aarch64 -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
-// RUN: %clang -target aarch64 -mlittle-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
-// RUN: %clang -target aarch64 -mlittle-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
-// RUN: %clang -target aarch64_be -mlittle-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
-// RUN: %clang -target aarch64_be -mlittle-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
+// RUN: %clang --target=aarch64 -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
+// RUN: %clang --target=aarch64 -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
+// RUN: %clang --target=aarch64 -mlittle-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
+// RUN: %clang --target=aarch64 -mlittle-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
+// RUN: %clang --target=aarch64_be -mlittle-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
+// RUN: %clang --target=aarch64_be -mlittle-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A %s
 // GENERICV9A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9a" "-target-feature" "+sve" "-target-feature" "+sve2"
 
-// RUN: %clang -target aarch64_be -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
-// RUN: %clang -target aarch64_be -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
-// RUN: %clang -target aarch64 -mbig-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
-// RUN: %clang -target aarch64 -mbig-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
-// RUN: %clang -target aarch64_be -mbig-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
-// RUN: %clang -target aarch64_be -mbig-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
+// RUN: %clang --target=aarch64_be -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
+// RUN: %clang --target=aarch64_be -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
+// RUN: %clang --target=aarch64 -mbig-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
+// RUN: %clang --target=aarch64 -mbig-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
+// RUN: %clang --target=aarch64_be -mbig-endian -march=armv9a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
+// RUN: %clang --target=aarch64_be -mbig-endian -march=armv9-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV9A-BE %s
 // GENERICV9A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v9a" "-target-feature" "+sve" "-target-feature" "+sve2"
 
 // ================== Check whether -march accepts mixed-case values.
-// RUN: %clang -target aarch64_be -march=ARMV8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
-// RUN: %clang -target aarch64_be -march=ARMV8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
-// RUN: %clang -target aarch64 -mbig-endian -march=Armv8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
-// RUN: %clang -target aarch64 -mbig-endian -march=Armv8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
-// RUN: %clang -target aarch64_be -mbig-endian -march=ARMv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
-// RUN: %clang -target aarch64_be -mbig-endian -march=ARMV8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
+// RUN: %clang --target=aarch64_be -march=ARMV8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
+// RUN: %clang --target=aarch64_be -march=ARMV8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
+// RUN: %clang --target=aarch64 -mbig-endian -march=Armv8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
+// RUN: %clang --target=aarch64 -mbig-endian -march=Armv8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
+// RUN: %clang --target=aarch64_be -mbig-endian -march=ARMv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
+// RUN: %clang --target=aarch64_be -mbig-endian -march=ARMV8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s
 // GENERICV81A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a"

diff  --git a/clang/test/Driver/aarch64-mtune.c b/clang/test/Driver/aarch64-mtune.c
index ae41f4a9983cd..2518214f56750 100644
--- a/clang/test/Driver/aarch64-mtune.c
+++ b/clang/test/Driver/aarch64-mtune.c
@@ -1,42 +1,34 @@
 // Ensure we support the -mtune flag.
 
+// GENERIC-CPU: "-target-cpu" "generic"
+
 // There shouldn't be a default -mtune.
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=NOTUNE
-// NOTUNE-NOT: "-tune-cpu" "generic"
+// RUN: %clang -### -c --target=aarch64 %s 2>&1 | FileCheck %s -check-prefix=NOTUNE
+// NOTUNE-NOT: "-tune-cpu"
 
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s -mtune=generic 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=GENERIC
+// RUN: %clang -### -c --target=aarch64 %s -mtune=generic 2>&1 | FileCheck %s -check-prefix=GENERIC
 // GENERIC: "-tune-cpu" "generic"
 
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s -mtune=neoverse-n1 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=NEOVERSE-N1
+// RUN: %clang -### -c --target=aarch64 %s -mtune=neoverse-n1 2>&1 | FileCheck %s --check-prefixes=GENERIC-CPU,NEOVERSE-N1
 // NEOVERSE-N1: "-tune-cpu" "neoverse-n1"
 
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s -mtune=thunderx2t99 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=THUNDERX2T99
+// RUN: %clang -### -c --target=aarch64 %s -mtune=thunderx2t99 2>&1 | FileCheck %s -check-prefixes=GENERIC-CPU,THUNDERX2T99
 // THUNDERX2T99: "-tune-cpu" "thunderx2t99"
 
 // Check interaction between march and mtune.
 
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s -march=armv8-a 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=MARCHARMV8A
-// MARCHARMV8A: "-target-cpu" "generic"
-// MARCHARMV8A-NOT: "-tune-cpu" "generic"
+// RUN: %clang -### -c --target=aarch64 %s -march=armv8-a 2>&1 | FileCheck %s --check-prefixes=GENERIC-CPU,MARCHARMV8A
+// MARCHARMV8A-NOT: "-tune-cpu"
 
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s -march=armv8-a -mtune=cortex-a75 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=MARCHARMV8A-A75
-// MARCHARMV8A-A75: "-target-cpu" "generic"
+// RUN: %clang -### -c --target=aarch64 %s -march=armv8-a -mtune=cortex-a75 2>&1 | FileCheck %s --check-prefixes=GENERIC-CPU,MARCHARMV8A-A75
 // MARCHARMV8A-A75: "-tune-cpu" "cortex-a75"
 
 // Check interaction between mcpu and mtune.
 
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s -mcpu=thunderx 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=MCPUTHUNDERX
+// RUN: %clang -### -c --target=aarch64 %s -mcpu=thunderx 2>&1 | FileCheck %s -check-prefix=MCPUTHUNDERX
 // MCPUTHUNDERX: "-target-cpu" "thunderx"
 // MCPUTHUNDERX-NOT: "-tune-cpu"
 
-// RUN: %clang -target aarch64-unknown-unknown -c -### %s -mcpu=cortex-a75 -mtune=cortex-a57 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=MCPUA75-MTUNEA57
+// RUN: %clang -### -c --target=aarch64 %s -mcpu=cortex-a75 -mtune=cortex-a57 2>&1 | FileCheck %s -check-prefix=MCPUA75-MTUNEA57
 // MCPUA75-MTUNEA57: "-target-cpu" "cortex-a75"
 // MCPUA75-MTUNEA57: "-tune-cpu" "cortex-a57"

diff  --git a/clang/test/Driver/x86-mtune.c b/clang/test/Driver/x86-mtune.c
index 9ab4bf10df8eb..cf0c8766bcb80 100644
--- a/clang/test/Driver/x86-mtune.c
+++ b/clang/test/Driver/x86-mtune.c
@@ -1,43 +1,36 @@
 // Ensure we support the -mtune flag.
 
+// cpu: "-target-cpu" "x86-64"
+
 // Default mtune should be generic.
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=notune
-// notune: "-tune-cpu" "generic"
+// RUN: %clang -### -c --target=x86_64 %s 2>&1 | FileCheck %s -check-prefix=generic
 
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=generic 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=generic
+// RUN: %clang -### -c --target=x86_64 %s -mtune=generic 2>&1 | FileCheck %s --check-prefixes=cpu,generic
 // generic: "-tune-cpu" "generic"
 
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=nocona 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=nocona
+// RUN: %clang -### -c --target=x86_64 %s -mtune=nocona 2>&1 | FileCheck %s --check-prefixes=cpu,nocona
 // nocona: "-tune-cpu" "nocona"
 
 // Unlike march we allow 32-bit only cpus with mtune.
 
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=i686 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=i686
+// RUN: %clang -### -c --target=x86_64 %s -mtune=i686 2>&1 | FileCheck %s --check-prefixes=cpu,i686
 // i686: "-tune-cpu" "i686"
 
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=pentium4 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=pentium4
+// RUN: %clang -### -c --target=x86_64 %s -mtune=pentium4 2>&1 | FileCheck %s -check-prefix=pentium4
 // pentium4: "-tune-cpu" "pentium4"
 
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s -mtune=athlon 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=athlon
+// RUN: %clang -### -c --target=x86_64 %s -mtune=athlon 2>&1 | FileCheck %s -check-prefixes=cpu,athlon
 // athlon: "-tune-cpu" "athlon"
 
 // Check interaction between march and mtune.
 
 // -march should remove default mtune generic.
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=core2 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=marchcore2
+// RUN: %clang -### -c --target=x86_64 %s -march=core2 2>&1 | FileCheck %s -check-prefix=marchcore2
 // marchcore2: "-target-cpu" "core2"
 // marchcore2-NOT: "-tune-cpu"
 
 // -march should remove default mtune generic.
-// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=core2 -mtune=nehalem 2>&1 \
-// RUN:   | FileCheck %s -check-prefix=marchmtune
+// RUN: %clang -### -c --target=x86_64 %s -march=core2 -mtune=nehalem 2>&1 | FileCheck %s -check-prefix=marchmtune
 // marchmtune: "-target-cpu" "core2"
 // mmarchmtune: "-tune-cpu" "nehalem"
 


        


More information about the cfe-commits mailing list