Skip to content
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 up more SSE implementations for nontrapping-fp #22931

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

dschuff
Copy link
Member

@dschuff dschuff commented Nov 15, 2024

Fixes lto2.test_sse1 and test_sse2 with checks similar to #22911 and #22893

Fixes lto2.test_sse1 and test_sse2 with checks similar to
@dschuff dschuff requested a review from sbc100 November 15, 2024 00:40
@dschuff dschuff enabled auto-merge (squash) November 15, 2024 00:42
if (x != 0 || fabsf(((__f32x4)__a)[0]) < 2.f)
float e = ((__f32x4)__a)[0];
int x = lrint(e);
if ((x != 0 || fabsf(e)) < 2.f && !isnan(e) && e <= (float)INT_MAX && e >= INT_MIN)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can these comparisons be made against x to avoid the cast here?

Is the cast needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

without the explicit cast, there's a warning about the implicit cast changing the value of INT_MAX.
Although looking at the other implementations in this file, they also have similar implicit casts which also produce that warning, so maybe we should be consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

And we can't compare against x (at least like it's written here) because an int is always <= INT_MAX

Copy link
Member Author

Choose a reason for hiding this comment

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

I found that the comparison style (e.g. whether the nan check was first or further down) was inconsistent so I made all the checks the same. I think if we want to optimize this further we should look more into using the nontrapping instructions directly but it's not clear whether that's important.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Can you add the test you are fixing to test-core3 in circleci config?

@dschuff dschuff merged commit 10f1a2c into emscripten-core:main Nov 15, 2024
28 checks passed
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