[clang] 3f88311 - [Driver] Rearrange some Apple version testing (#94514)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 11 04:51:25 PDT 2024


Author: Paul T Robinson
Date: 2024-06-11T07:51:21-04:00
New Revision: 3f883111243c4abfc06670190771b9cafc092bd8

URL: https://github.com/llvm/llvm-project/commit/3f883111243c4abfc06670190771b9cafc092bd8
DIFF: https://github.com/llvm/llvm-project/commit/3f883111243c4abfc06670190771b9cafc092bd8.diff

LOG: [Driver] Rearrange some Apple version testing (#94514)

There were four tests in Driver that actually tested bits of Driver and
bits of CodeGen, and therefore had target restrictions. Rework those
four tests into one Driver test (with no target restrictions) and two
target-specific CodeGen tests.

Added: 
    clang/test/Driver/apple-os-triples.c
    llvm/test/CodeGen/ARM/apple-version-min.ll
    llvm/test/CodeGen/X86/apple-version-min.ll

Modified: 
    

Removed: 
    clang/test/Driver/appletvos-version-min.c
    clang/test/Driver/driverkit-version-min.c
    clang/test/Driver/ios-version-min.c
    clang/test/Driver/watchos-version-min.c


################################################################################
diff  --git a/clang/test/Driver/apple-os-triples.c b/clang/test/Driver/apple-os-triples.c
new file mode 100644
index 0000000000000..7664d3bc19fca
--- /dev/null
+++ b/clang/test/Driver/apple-os-triples.c
@@ -0,0 +1,31 @@
+// Test triple manipulations.
+
+// RUN: %clang -### -c %s \
+// RUN:   --target=i386-apple-darwin10 -mappletvsimulator-version-min=9.0 -arch x86_64 2>&1 | \
+// RUN:   FileCheck %s -DARCH=x86_64 -DOS=tvos9.0.0-simulator
+// RUN: %clang -### -c %s \
+// RUN:   --target=armv7s-apple-darwin10 -mappletvos-version-min=9.0 -arch arm64 2>&1 | \
+// RUN:   FileCheck %s -DARCH=arm64 -DOS=tvos9.0.0
+// RUN: env TVOS_DEPLOYMENT_TARGET=9.0 %clang -### -c %s \
+// RUN:   -isysroot SDKs/MacOSX10.9.sdk -target i386-apple-darwin10  -arch x86_64 2>&1 | \
+// RUN:   FileCheck %s -DARCH=x86_64 -DOS=tvos9.0.0
+
+// RUN: %clang -### -c %s \
+// RUN:   --target=x86_64-apple-driverkit19.0 2>&1 | \
+// RUN:   FileCheck %s -DARCH=x86_64 -DOS=driverkit19.0.0
+
+// RUN: %clang -### -c %s \
+// RUN:   --target=i386-apple-darwin10 -miphonesimulator-version-min=7.0 -arch i386 2>&1 | \
+// RUN:   FileCheck %s -DARCH=i386 -DOS=ios7.0.0-simulator
+// RUN: %clang -### -c %s \
+// RUN:   --target=armv7s-apple-darwin10 -miphoneos-version-min=7.0 -arch armv7s 2>&1 | \
+// RUN:   FileCheck %s -DARCH=thumbv7s -DOS=ios7.0.0
+
+// RUN: %clang -### -c %s \
+// RUN:   --target=i386-apple-darwin10 -mwatchsimulator-version-min=2.0 -arch i386 2>&1 | \
+// RUN:   FileCheck %s -DARCH=i386 -DOS=watchos2.0.0-simulator
+// RUN: %clang -### -c %s \
+// RUN:   --target=armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k 2>&1 | \
+// RUN:   FileCheck %s -DARCH=thumbv7k -DOS=watchos2.0.0
+
+// CHECK: "-cc1" "-triple" "[[ARCH]]-apple-[[OS]]"

diff  --git a/clang/test/Driver/appletvos-version-min.c b/clang/test/Driver/appletvos-version-min.c
deleted file mode 100644
index 7cbb2001a3ec2..0000000000000
--- a/clang/test/Driver/appletvos-version-min.c
+++ /dev/null
@@ -1,8 +0,0 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: aarch64-registered-target
-// RUN: %clang -target i386-apple-darwin10 -mappletvsimulator-version-min=9.0 -arch x86_64 -S -o - %s | FileCheck %s
-// RUN: %clang -target armv7s-apple-darwin10 -mappletvos-version-min=9.0 -arch arm64 -S -o - %s | FileCheck %s
-// RUN: env TVOS_DEPLOYMENT_TARGET=9.0 %clang -isysroot SDKs/MacOSX10.9.sdk -target i386-apple-darwin10  -arch x86_64 -S -o - %s | FileCheck %s
-
-int main() { return 0; }
-// CHECK: .tvos_version_min 9, 0

diff  --git a/clang/test/Driver/driverkit-version-min.c b/clang/test/Driver/driverkit-version-min.c
deleted file mode 100644
index 9966152f11ce8..0000000000000
--- a/clang/test/Driver/driverkit-version-min.c
+++ /dev/null
@@ -1,5 +0,0 @@
-// REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-apple-driverkit19.0 -S -o - %s | FileCheck %s
-
-int main() { return 0; }
-// CHECK: .build_version driverkit, 19, 0

diff  --git a/clang/test/Driver/ios-version-min.c b/clang/test/Driver/ios-version-min.c
deleted file mode 100644
index aa536cf7827b3..0000000000000
--- a/clang/test/Driver/ios-version-min.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: arm-registered-target
-// RUN: %clang -target i386-apple-darwin10 -miphonesimulator-version-min=7.0 -arch i386 -S -o - %s | FileCheck %s
-// RUN: %clang -target armv7s-apple-darwin10 -miphoneos-version-min=7.0 -arch armv7s -S -o - %s | FileCheck %s
-
-int main() { return 0; }
-// CHECK: .ios_version_min 7, 0

diff  --git a/clang/test/Driver/watchos-version-min.c b/clang/test/Driver/watchos-version-min.c
deleted file mode 100644
index 8f12285d4e473..0000000000000
--- a/clang/test/Driver/watchos-version-min.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: arm-registered-target
-// RUN: %clang -target i386-apple-darwin10 -mwatchsimulator-version-min=2.0 -arch i386 -S -o - %s | FileCheck %s
-// RUN: %clang -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -S -o - %s | FileCheck %s
-
-int main() { return 0; }
-// CHECK: .watchos_version_min 2, 0

diff  --git a/llvm/test/CodeGen/ARM/apple-version-min.ll b/llvm/test/CodeGen/ARM/apple-version-min.ll
new file mode 100644
index 0000000000000..6b4af21d74c00
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/apple-version-min.ll
@@ -0,0 +1,9 @@
+; Test emitting version_min directives.
+
+; RUN: llc %s -filetype=asm -o - --mtriple arm64-apple-tvos9.0.0 | FileCheck %s --check-prefix=TVOS
+; RUN: llc %s -filetype=asm -o - --mtriple thumbv7s-apple-ios7.0.0 | FileCheck %s --check-prefix=IOS
+; RUN: llc %s -filetype=asm -o - --mtriple thumbv7k-apple-watchos2.0.0 | FileCheck %s --check-prefix=WATCHOS
+
+; TVOS: .tvos_version_min 9, 0
+; IOS: .ios_version_min 7, 0
+; WATCHOS: .watchos_version_min 2, 0

diff  --git a/llvm/test/CodeGen/X86/apple-version-min.ll b/llvm/test/CodeGen/X86/apple-version-min.ll
new file mode 100644
index 0000000000000..fde10ac3b4248
--- /dev/null
+++ b/llvm/test/CodeGen/X86/apple-version-min.ll
@@ -0,0 +1,12 @@
+; Test emitting version_min directives.
+
+; RUN: llc %s -filetype=asm -o - --mtriple x86_64-apple-tvos9.0.0-simulator | FileCheck %s --check-prefix=TVOS
+; RUN: llc %s -filetype=asm -o - --mtriple x86_64-apple-tvos9.0.0 | FileCheck %s --check-prefix=TVOS
+; RUN: llc %s -filetype=asm -o - --mtriple x86_64-apple-driverkit19.0.0 | FileCheck %s --check-prefix=DRIVERKIT
+; RUN: llc %s -filetype=asm -o - --mtriple i386-apple-ios7.0.0-simulator | FileCheck %s --check-prefix=IOS
+; RUN: llc %s -filetype=asm -o - --mtriple i386-apple-watchos2.0.0-simulator | FileCheck %s --check-prefix=WATCHOS
+
+; TVOS: .tvos_version_min 9, 0
+; DRIVERKIT: .build_version driverkit, 19, 0
+; IOS: .ios_version_min 7, 0
+; WATCHOS: .watchos_version_min 2, 0


        


More information about the cfe-commits mailing list