Skip to content

Use builtins instead of shims in FloatingPointTypes. #3454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 14, 2016
Merged
2 changes: 1 addition & 1 deletion lib/SIL/SILVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3263,7 +3263,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
assert(F->isAvailableExternally() &&
"external declaration of internal SILFunction not allowed");
assert(!hasSharedVisibility(F->getLinkage()) &&
"external declarations of SILFunctions with shared visibility is not "
"external declaration of SILFunction with shared visibility is not "
"allowed");
// If F is an external declaration, there is nothing further to do,
// return.
Expand Down
12 changes: 6 additions & 6 deletions stdlib/public/SwiftShims/LibcShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,35 +84,35 @@ __swift_uint32_t
_swift_stdlib_cxx11_mt19937_uniform(__swift_uint32_t upper_bound);

// Math library functions
SWIFT_RUNTIME_STDLIB_INLINE
SWIFT_RUNTIME_STDLIB_INTERFACE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should need any attributes at all on these functions.

static inline float _swift_stdlib_remainderf(float x, float y) {
return __builtin_remainderf(x, y);
}

SWIFT_RUNTIME_STDLIB_INLINE
SWIFT_RUNTIME_STDLIB_INTERFACE
static inline float _swift_stdlib_sqrtf(float x) {
return __builtin_sqrtf(x);
}

SWIFT_RUNTIME_STDLIB_INLINE
SWIFT_RUNTIME_STDLIB_INTERFACE
static inline double _swift_stdlib_remainder(double x, double y) {
return __builtin_remainder(x, y);
}

SWIFT_RUNTIME_STDLIB_INLINE
SWIFT_RUNTIME_STDLIB_INTERFACE
static inline double _swift_stdlib_sqrt(double x) {
return __builtin_sqrt(x);
}

// TODO: Remove horrible workaround when importer does Float80 <-> long double.
#if (defined __i386__ || defined __x86_64__) && !defined _MSC_VER
SWIFT_RUNTIME_STDLIB_INLINE
SWIFT_RUNTIME_STDLIB_INTERFACE
static inline void _swift_stdlib_remainderl(void *x, const void *y) {
long double *ptr = (long double *)x;
*ptr = __builtin_remainderl(*ptr, *(const long double *)y);
}

SWIFT_RUNTIME_STDLIB_INLINE
SWIFT_RUNTIME_STDLIB_INTERFACE
static inline void _swift_stdlib_sqrtl(void *x) {
long double *ptr = (long double *)x;
*ptr = __builtin_sqrtl(*ptr);
Expand Down
10 changes: 0 additions & 10 deletions stdlib/public/SwiftShims/Visibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,4 @@
/// resilience we may be able to make this hidden.
#define SWIFT_RUNTIME_STDLIB_INTERFACE SWIFT_RUNTIME_EXPORT

/// Attribute for stdlib stdlib inline interfaces.
///
/// Since these are static inline, there's no need for them to be exported, and
/// in fact they shouldn't be.
#if __MACH__ || __ELF__
# define SWIFT_RUNTIME_STDLIB_INLINE __attribute__((__visibility__("hidden")))
#else
# define SWIFT_RUNTIME_STDLIB_INLINE /* nothing?? */
#endif

#endif
1 change: 0 additions & 1 deletion stdlib/public/stubs/LibcShims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <random>
#include <type_traits>
#include <cmath>
#if defined(_MSC_VER)
#include <io.h>
#else
Expand Down