This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add combination for fma and fneg on X86 under strict FP.
ClosedPublic

Authored by pengfei on Jan 15 2020, 9:55 PM.

Details

Summary

X86 has instructions to calculate fma and fneg at the same time. But we combine the fneg and fma only when fneg is the source operand under strict FP.

Event Timeline

pengfei created this revision.Jan 15 2020, 9:55 PM
pengfei updated this revision to Diff 238425.Jan 16 2020, 12:43 AM

Add FMA4 tests. Thanks @RKSimon.

Add to isNegatibleForFree/getNegatedExpression as well?

Add to isNegatibleForFree/getNegatedExpression as well?

We don't need to add them to isNegatibleForFree/getNegatedExpression. We won't negate any FMA results by negative FMA instructions under strict FP, because fneg(FMA) has different result from FNMA under some rounding mode.

Add to isNegatibleForFree/getNegatedExpression as well?

We don't need to add them to isNegatibleForFree/getNegatedExpression. We won't negate any FMA results by negative FMA instructions under strict FP, because fneg(FMA) has different result from FNMA under some rounding mode.

Thanks for confirming - no more comments from me.

Are we missing tests for the vector instructions?

pengfei updated this revision to Diff 240472.Jan 26 2020, 8:09 PM

Rebase and add vector instructions test.

This revision is now accepted and ready to land.Jan 27 2020, 10:33 PM
This revision was automatically updated to reflect the committed changes.