microsoft / DirectXMath

DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps
https://walbourn.github.io/introducing-directxmath/
MIT License
1.52k stars 234 forks source link

extensions: fix FMA4 detection #99

Closed Mixaill closed 4 years ago

Mixaill commented 4 years ago

According to AMD specs (https://www.amd.com/system/files/TechDocs/25481.pdf (page 20)), for FMA4 detection we should use 16th bit of ECX register in 8000_0001 function.

It fixes crash on Zen2 CPUs, which do not support FMA4.

walbourn commented 4 years ago

Fixed in this commit.

Thanks for finding this one!

walbourn commented 4 years ago

I had it correct in this blog post, but it was pretty much always wrong in the DirectXMathFMA4.h header :(