[PATCH] D102494: [Clang, Driver] Default to Darwin_libsystem_m veclib on iOS based targets.
Florian Hahn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 14 06:27:55 PDT 2021
fhahn created this revision.
fhahn added reviewers: jroelofs, ab, scanon, arphaman.
fhahn requested review of this revision.
Herald added a project: clang.
Building on D102489 <https://reviews.llvm.org/D102489>, default to Darwin_libsystem_m veclib on iOS based
targets.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102494
Files:
clang/lib/Driver/ToolChains/Darwin.cpp
clang/test/Driver/darwin-veclib-default.c
Index: clang/test/Driver/darwin-veclib-default.c
===================================================================
--- /dev/null
+++ clang/test/Driver/darwin-veclib-default.c
@@ -0,0 +1,24 @@
+// Check default vector library options on Darwin platforms.
+
+// RUN: %clang -target x86_64-apple-darwin -S -### %s -arch x86_64 2>&1 | \
+// RUN: FileCheck --check-prefix CHECK-MACOS %s
+
+// CHECK-MACOS: "-cc1"
+// CHECK-MACOS-NOT: -fveclib
+
+// RUN: %clang -target arm64-apple-darwinos -S -### %s -arch arm64 2>&1 | \
+// RUN: FileCheck --check-prefix CHECK-IOS-DEFAULT %s
+
+// RUN: %clang -target arm64-apple-ios -S -### %s -arch arm64 2>&1 | \
+// RUN: FileCheck --check-prefix CHECK-IOS-DEFAULT %s
+
+// CHECK-IOS-DEFAULT: "-cc1"
+// CHECK-IOS-DEFAULT: "-fveclib=Darwin_libsystem_m"
+
+// RUN: %clang -target arm64-apple-ios -S -### %s -arch arm64 -fveclib=Accelerate 2>&1 | \
+// RUN: FileCheck --check-prefix CHECK-IOS-ACCELERATE %s
+
+// CHECK-IOS-ACCELERATE: "-cc1"
+// CHECK-IOS-ACCELERATE-NOT: "-fveclib=Darwin_libsystem_m"
+// CHECK-IOS-ACCELERATE: "-fveclib=Accelerate"
+// CHECK-IOS-ACCELERATE-NOT: "-fveclib=Darwin_libsystem_m"
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2486,6 +2486,11 @@
options::OPT_fvisibility_inlines_hidden_static_local_var,
options::OPT_fno_visibility_inlines_hidden_static_local_var))
CC1Args.push_back("-fvisibility-inlines-hidden-static-local-var");
+
+ // If no vector library is specified by the user, default to
+ // Darwin_libsystem_m for iOS based targets.
+ if (isTargetIOSBased() && !DriverArgs.hasArgNoClaim(options::OPT_fveclib))
+ CC1Args.push_back("-fveclib=Darwin_libsystem_m");
}
DerivedArgList *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102494.345425.patch
Type: text/x-patch
Size: 1858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210514/2550f527/attachment.bin>
More information about the cfe-commits
mailing list