-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix FixedPointConversion validation test #21912
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
Fix FixedPointConversion validation test #21912
Conversation
- Use lit.cfg's %target-ptrsize instead of nested gyb template; faster, cleaner, and provides correct line-directive output. - Fp/integer comparisons were using Python string/int comparison, undefined in Python 2 and illegal in 3, preventing large number of tests from being generated at all. Replace with actual numeric comparisons. - Work around edge case where inability of Python to represent `Int64.min` exactly in fp (insufficient precision) caused incorrect test failure. - Fix inverted assertion in tests for `.init(exactly:)` returning non-nil. - Respect "round-towards-zero then check range" behavior of truncating `.init(_:)` initializers, prevents incorrect failures at extreme ranges of int types.
@swift-ci please test |
Build failed |
@gwynne I think that @stephentyrone should take a look at this as well. Once he is cool with the changes, I am happy to look at the python part. |
I'm working on clearing up the failure on Linux; I solved the same issue for |
@swift-ci please test |
@stephentyrone Would very much appreciate your eyes on this one; the one test failure I'm getting on Linux only pops up in the Release version of the test, works as expected in Debug:
There must be a reason the |
I'm running the individual test in question via: ~/swift/swift$ ../llvm/utils/lit/lit.py -a ../build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/validation-test-linux-x86_64/ --filter='stdlib/FixedPointConversion_Release.*' |
@gwynne Can you post the assembly generated by a swift source file containing the following compiled with your swift build and -O? public func foo(_ x: Float80) -> UInt { return UInt(x) } |
Build failed |
funcfoo_Debug.s.txt See attached |
@gwynne Thanks. I've been swamped the past few days, but I'll take a look this weekend. |
@stephentyrone Ping 😅 |
@gwynne: I didn’t see this fix before, and I ended up fixing part of what you fix here in #23220. It mostly deals with the floating to integer conversions. It would be good to merge both solutions. I think your solution is missing some pieces like using Tell me how you want to coordinate on this. |
@drodriguez I would suggest you integrate this PR into yours (to me the most critical change is getting rid of the unnecessary |
@gwynne @drodriguez Ping me once you two decide how to handle the overlapping PRs and I'll review and merge them. |
Looks like we took #23220. Closing this out. Thanks y'all! |
The
FixedPointConversion
validation test appears to have been completely hosted for quite some time. The following changes are made to restore it to (hopefully) intended operation:lit.cfg
's%target-ptrsize
substitution instead of nestinggyb
templates; this is faster, cleaner, and provides correctline-directive
output.Int64.min
exactly in floating-point due to insufficient precision resulted in thegyb
logic choosing the wrong test logic, causing a spurious test failure..init(exactly:)
returns non-nil
but was being checked fornil
..init(_:)
initializers; prevents incorrect test failures at the extreme ranges of large integer types.