-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Use [u]int64 -> FloatingPoint conversions even on 32b targets #70541
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
Use [u]int64 -> FloatingPoint conversions even on 32b targets #70541
Conversation
…tforms. This means that we'll end up going int32 -> int64 -> float/double sometiems, but LLVM knows how to optimize away the intermediate conversion so we end up with just a normal 32b->float conversion as desired, and we get much, much better performance on oddball platforms like arm64_32.
@swift-ci test |
@swift-ci please benchmark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 2 me! Standard library is the gift that keeps on giving!
@glessard the CI bencharks only test targets where there's no difference at all from this change, sadly. |
With integer conversions, there's no chance of a difference in rounding, correct? I remember that we had a bunch of platform-specific problems around NSNumber bridging when changing one of these initializers, but I'm pretty sure that was a float-to-float conversion. |
@swift-ci smoke test linux |
The only way we'd see a change here is if the generic conversion routine had a bug that we'd now avoid, which could be a hassle but also a change we'd want to make. We're reasonably confident that this isn't the case for standard library types, but the input space is too large to test exhaustively, so we can't be certain. |
…tforms. (swiftlang#70541) This means that we'll end up going int32 -> int64 -> float/double sometiems, but LLVM knows how to optimize away the intermediate conversion so we end up with just a normal 32b->float conversion as desired, and we get much, much better performance on oddball platforms like arm64_32.
…tforms. (swiftlang#70541) This means that we'll end up going int32 -> int64 -> float/double sometiems, but LLVM knows how to optimize away the intermediate conversion so we end up with just a normal 32b->float conversion as desired, and we get much, much better performance on oddball platforms like arm64_32.
This means that we'll end up going int32 -> int64 -> float/double sometimes, but LLVM knows how to optimize away the intermediate conversion so we end up with just a normal 32b->float conversion as desired, and we get much, much better performance on oddball platforms like arm64_32.