Skip to content

Simplify and optimize fdim #442

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 2 commits into from
Jan 14, 2025
Merged

Simplify and optimize fdim #442

merged 2 commits into from
Jan 14, 2025

Conversation

quaternic
Copy link
Contributor

@quaternic quaternic commented Jan 14, 2025

The cases with NaN arguments can be handled by the same x - y expression, and this generates much better code:
https://godbolt.org/z/r6sa6o5ov

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Great find! Looks like it needs a format run.

@tgross35 tgross35 enabled auto-merge (squash) January 14, 2025 01:41
@tgross35
Copy link
Contributor

This eliminates a couple of libcalls for f16 and f128 as well https://godbolt.org/z/cf6e3jY9G

@tgross35 tgross35 merged commit 2b8045a into rust-lang:master Jan 14, 2025
35 checks passed
@github-actions github-actions bot mentioned this pull request Jan 14, 2025
@quaternic
Copy link
Contributor Author

From your godbolt I noticed I had posted a link with incorrect code (x < y instead of x <= y). Updated the OP with the correct version of each comparison. (But the comparison looks essentially the same.)

@quaternic quaternic deleted the fdim_opt branch January 14, 2025 02:01
tgross35 pushed a commit that referenced this pull request Apr 18, 2025
The cases with NaN arguments can be handled by the same x - y
expression, and this generates much better code: https://godbolt.org/z/f3rnT8jx4.
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.

2 participants