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

Avoid using simd_fmin/simd_fmax for AVX float min/max comparisons #1155

Merged
merged 1 commit into from
May 9, 2021

Conversation

thomcc
Copy link
Member

@thomcc thomcc commented May 9, 2021

These were not following the documented (albeit peculiar) semantics for the AVX intrinsics — the differences are around NaN and -0.0.

It was also causing suboptimal codegen, as LLVM needed to, for example, follow a vminps with vcmpunordps + vblendvps to implement the llvm.minnum semantics. (This is why I noticed it)

The text quoted inside the tests is from the architecture manual (volume 2B) https://software.intel.com/content/dam/develop/external/us/en/documents-tps/253667-sdm-vol-2b.pdf. Essentially the same text can be found on websites like https://www.felixcloutier.com/x86/minps.

Somewhat surprisingly (or, it's surprising we'd get it right in one place, wrong in the other), we got this right for SSE min/max, so no change needed there.

@rust-highfive
Copy link

r? @Amanieu

(rust-highfive has picked a reviewer for you, use r? to override)

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.

3 participants