This is an archive of the discontinued LLVM Phabricator instance.

[FPEnv] Fix complex operations in strictfp mode
ClosedPublic

Authored by sepavloff on Jan 14 2023, 7:43 AM.

Details

Summary

Operations on floating-point complex data had incorrect FP attributes
in strictfp mode, because IRBuilder object was not synchronized with AST
node attributes.

Diff Detail

Event Timeline

sepavloff created this revision.Jan 14 2023, 7:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2023, 7:43 AM
sepavloff requested review of this revision.Jan 14 2023, 7:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2023, 7:43 AM
kpn added a comment.Jan 17 2023, 8:13 AM

Are we testing _Complex multiply or subtraction anywhere? I have a vague memory of multiply not working correctly.

arsenm added a subscriber: arsenm.Jan 17 2023, 2:12 PM
arsenm added inline comments.
clang/test/CodeGen/complex-strictfp.c
8–10

So the tests are wrong but should no longer be fixed?

kpn added inline comments.Jan 17 2023, 3:53 PM
clang/test/CodeGen/complex-strictfp.c
8–10

The tests were wrong and are now correct. He left the comment to tell the future that if either "fpexcept.maytrap" or "round.tonearest" reappear then it means a regression in clang.

How about changing "all' to "any"? And change "wrong" to "clang bugs"? As in 'Any cases of "fpexcept.maytrap" in this test are clang bugs.'?

sepavloff updated this revision to Diff 490088.Jan 18 2023, 2:51 AM

Updated comment in test as proposed by Kevin

Are we testing _Complex multiply or subtraction anywhere? I have a vague memory of multiply not working correctly.

There is a test clang/test/CodeGen/complex-math.c that checks complex operations including subtraction and multiplication. The check for multiplication is not thorough however. And only default FP environment is checked.

IIRC spec2017 contains a test that uses C99 complex numbers. If there were issues, I think they would be reported.

sepavloff updated this revision to Diff 491397.Jan 23 2023, 8:39 AM

Use --implicit-check-not in test

rjmccall accepted this revision.Jan 23 2023, 4:40 PM

Seems right to me.

This revision is now accepted and ready to land.Jan 23 2023, 4:40 PM
This revision was landed with ongoing or failed builds.Jan 24 2023, 1:41 AM
This revision was automatically updated to reflect the committed changes.