Skip to content

Go back to using static inline stubs for sqrt and remainder #6769

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 4 commits into from
Jan 13, 2017
Merged

Go back to using static inline stubs for sqrt and remainder #6769

merged 4 commits into from
Jan 13, 2017

Conversation

stephentyrone
Copy link
Contributor

@stephentyrone stephentyrone commented Jan 13, 2017

I originally planned to have these be static inline, but had to back that out due to SR-2089. That's resolved now though, so this should work, and allow constant folding through square root and remainder.
rdar://problem/30004033

@stephentyrone
Copy link
Contributor Author

@swift-ci Please test.

@jrose-apple
Copy link
Contributor

jrose-apple commented Jan 13, 2017

Can you add a test that shows the constant-folding does happen under -O?

@stephentyrone
Copy link
Contributor Author

stephentyrone commented Jan 13, 2017

@jrose-apple yes, but it'll need to wait until I'm on a machine where I can actually build and run tests =)

I'll take a look at it tomorrow.

@stephentyrone stephentyrone requested a review from moiseev January 13, 2017 16:51
@stephentyrone
Copy link
Contributor Author

@moiseev very straightforward, but please sanity-check.


public func test6( ) -> Double {
return sqrt(4)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess since we're worried about LLVM's sqrt, is it worth adding a test for sqrt(-1) not becoming undef or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the earlier CHECK-NOT llvm.sqrt probably covers us, but I can definitely add one.

@stephentyrone
Copy link
Contributor Author

@swift-ci Please test.

@moiseev
Copy link
Contributor

moiseev commented Jan 13, 2017

:shipit:

Copy link
Contributor

@moiseev moiseev left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@stephentyrone stephentyrone merged commit d89f8f4 into swiftlang:master Jan 13, 2017
@stephentyrone stephentyrone deleted the inline-sqrt branch January 13, 2017 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants