Fix up more SSE implementations for nontrapping-fp#22931
Fix up more SSE implementations for nontrapping-fp#22931dschuff merged 3 commits intoemscripten-core:mainfrom
Conversation
Fixes lto2.test_sse1 and test_sse2 with checks similar to
system/include/compat/xmmintrin.h
Outdated
| 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) |
There was a problem hiding this comment.
Can these comparisons be made against x to avoid the cast here?
Is the cast needed?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
And we can't compare against x (at least like it's written here) because an int is always <= INT_MAX
There was a problem hiding this comment.
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.
sbc100
left a comment
There was a problem hiding this comment.
Can you add the test you are fixing to test-core3 in circleci config?
Fixes lto2.test_sse1 and test_sse2 with checks similar to #22911 and #22893