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

Use IEEE 754-2019 definition of min/max #193

Open
calebzulawski opened this issue Nov 15, 2021 · 9 comments
Open

Use IEEE 754-2019 definition of min/max #193

calebzulawski opened this issue Nov 15, 2021 · 9 comments

Comments

@calebzulawski
Copy link
Member

This doesn't match the existing scalar min/max, but it appears that it would optimize much better.

@programmerjake
Copy link
Member

interestingly, x86's SIMD min/max are based on C's a < b ? a : b, where if either a or b is NaN, then b is returned. This includes returning a SNaN if b is a SNaN, and also includes returning b if a and b are zero (of any combination of signs).

https://www.felixcloutier.com/x86/maxps

@calebzulawski
Copy link
Member Author

Are you suggesting that this is still incompatible with the 2019 standard?

@programmerjake
Copy link
Member

Are you suggesting that this is still incompatible with the 2019 standard?

yes. x86 min/max is incompatible with IEEE 754-2008 or 2019.

@calebzulawski
Copy link
Member Author

I see.

Do you have any idea what the vrageps mentioned here is? https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/minNum_maxNum_Removal_Demotion_v3.pdf

@programmerjake
Copy link
Member

Do you have any idea what the vrageps mentioned here is? https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/minNum_maxNum_Removal_Demotion_v3.pdf

idk. I wasn't able to find them in the current version of intel's software development manual, so I'm guessing they're proposed instructions that weren't actually implemented, so intel later removed them.

@workingjubilee
Copy link
Member

Is this about rust-lang/rust#91079 ?

@calebzulawski
Copy link
Member Author

I didn't know about that issue, but yes it appears to be the same.

@programmerjake
Copy link
Member

programmerjake commented Jan 10, 2022

portable-simd's current min/max is incompatible with ieee minimum/maximum functions because it doesn't correctly handle signed zeros, it's compatible with minnum/maxnum afaict.

@calebzulawski
Copy link
Member Author

That's how the scalar min/max is named, too.

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

No branches or pull requests

3 participants