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

The clang/LLVM returns bad results for specific code optimizations #127

Closed
shinjich opened this issue Jul 11, 2021 · 1 comment · Fixed by #183
Closed

The clang/LLVM returns bad results for specific code optimizations #127

shinjich opened this issue Jul 11, 2021 · 1 comment · Fixed by #183
Labels
complier Issue related to compiler codegen

Comments

@shinjich
Copy link
Contributor

The clang/LLVM + /Ox + /fp:fast + XMVectorRound built for SSE/SSE2 generated the bad results. XMVectorRound are used in trigonometric functions such as XMVectorSinCos, etc.

Repro code:
https://github.com/shinjich/directxmathtest/tree/master/VerifyRounding
The reproduction code compares the results of standard library, original XMVectorSinCos and modified version of XMVectorSinCos.

Results compiled and executed with..
/Ox /fp:fast (Bad results)
https://github.com/shinjich/directxmathtest/blob/master/VerifyRounding/_Result_fp_fast.txt
/Ox /fp:precise (Good results)
https://github.com/shinjich/directxmathtest/blob/master/VerifyRounding/_Result_fp_precise.txt
/Ox /fp:fast + SVML (Good results)
https://github.com/shinjich/directxmathtest/blob/master/VerifyRounding/_Result_fp_fast_SVML.txt

This issue was not seen with VC.

@walbourn
Copy link
Member

walbourn commented Feb 2, 2024

The issue here is that #pragma float_control was not in place for clang as it is for MSVC, but more importantly this pragma on clang doesn't work correctly for SSE instrinsics :(

llvm/llvm-project#55713

Therefore the recommendation is going to be to NOT use /fp:fast for clang until this is resolved.

@walbourn walbourn unpinned this issue Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complier Issue related to compiler codegen
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants