File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -778,6 +778,12 @@ importer::addCommonInvocationArguments(
778
778
// Enable double wide atomic intrinsics on every x86_64 target.
779
779
// (This is the default on Darwin, but not so on other platforms.)
780
780
invocationArgStrs.push_back (" -mcx16" );
781
+ // Enable the FC16/CVT16 extensions which provide half prevision floating
782
+ // point support on x86_64. This bumps the minimum requirement of the CPU
783
+ // to ~Haswell, however, Windows 10 (at least as of 1709) requires
784
+ // ~Broadwell. At this point, the complexity of supporting an older release
785
+ // no longer is justified.
786
+ invocationArgStrs.push_back (" -mf16c" );
781
787
}
782
788
783
789
if (!importerOpts.Optimization .empty ()) {
Original file line number Diff line number Diff line change @@ -288,6 +288,18 @@ function(_add_target_variant_c_compile_flags)
288
288
endif ()
289
289
endif ()
290
290
291
+ # Avoid the need for the FP16 truncation and extension routines from
292
+ # compiler-rt by assuming that we have hardware capable of performing
293
+ # half-precision floating point conversions. This was announced circa 2007,
294
+ # and is standard with ~Nahelem (~2013).
295
+ if (CFLAGS_ARCH STREQUAL x86_64 )
296
+ if (SWIFT_COMPILER_IS_MSVC_LIKE )
297
+ list (APPEND result /clang:-mf16c )
298
+ else ()
299
+ list (APPEND result -mf16c )
300
+ endif ()
301
+ endif ()
302
+
291
303
if (CFLAGS_ENABLE_ASSERTIONS )
292
304
list (APPEND result "-UNDEBUG" )
293
305
else ()
Original file line number Diff line number Diff line change 29
29
30
30
// Android NDK <r21 do not provide `__aeabi_d2h` in the compiler runtime,
31
31
// provide shims in that case.
32
- #if (defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && defined(__ARM_EABI__)) || \
33
- ((defined(__i386__) || defined(__i686__) || defined(__x86_64__)) && !defined(__APPLE__) && !defined(__linux__))
32
+ #if (defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && defined(__ARM_EABI__))
34
33
35
34
#include " swift/shims/Visibility.h"
36
35
@@ -156,4 +155,4 @@ SWIFT_RUNTIME_EXPORT unsigned short __aeabi_d2h(double d) {
156
155
}
157
156
#endif
158
157
159
- #endif // defined(__x86_64__ ) && ! defined(__APPLE__ )
158
+ #endif // defined(__ANDROID__ ) && defined(__ARM_ARCH_7A__) && defined(__ARM_EABI__ )
You can’t perform that action at this time.
0 commit comments