This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Use CreateFNeg in buildFMulAdd
ClosedPublic

Authored by craig.topper on Dec 30 2019, 11:46 AM.

Details

Summary

We have an fneg instruction now and should use it instead of the fsub -0.0 idiom. Looks like we had no test that showed that we handled the negation cases here so I've added new tests.

Diff Detail

Event Timeline

craig.topper created this revision.Dec 30 2019, 11:46 AM
craig.topper marked an inline comment as done.
craig.topper added inline comments.
clang/lib/CodeGen/CGExprScalar.cpp
3350

I removed the 'else' here because logically it didn't make sense that whether we looked at negAdd should be dependent on negMul being false. The assert at the beginning of the function still assures they are mutex. But the code shouldn't need that assumption.

rjmccall added inline comments.Dec 30 2019, 12:50 PM
clang/lib/CodeGen/CGExprScalar.cpp
3350

Fine by me, although it's not clear why the assertion's restriction is required, then.

rjmccall accepted this revision.Dec 30 2019, 12:50 PM
This revision is now accepted and ready to land.Dec 30 2019, 12:50 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 30 2019, 1:38 PM