This is an archive of the discontinued LLVM Phabricator instance.

[mips] Fix how compiler fuse instructions to fmadd/fmsub
ClosedPublic

Authored by abeserminji on Apr 25 2018, 6:40 AM.

Details

Summary

When no -fp-contract option is provided (default behavior), compiler is fusing fmul and fadd/fsub into fmadd/fmsub.
GCC does not do that, so this patch makes LLVM behave like GCC.

Also, this patch makes LLVM take care of -fp-contract=fast option which enables fusing.

Diff Detail

Event Timeline

abeserminji created this revision.Apr 25 2018, 6:40 AM
sdardis added inline comments.Apr 25 2018, 7:00 AM
lib/Target/Mips/MipsInstrInfo.td
252–254

Add an adjective like 'FPOP_FUSION_FAST' which uses this predicate in the AdditionalPredicates field of PredicateControl.

lib/Target/Mips/MipsMSAInstrInfo.td
3138

Use the new adjective here instead of Requires<[..]>.

test/CodeGen/Mips/fp-contract.ll
10

Can you try simplifiying the test case here? There's a lot of meta data that shouldn't have an effect.

Also, add a short comment explaining the test case's purpose.

abeserminji marked 3 inline comments as done.

Comments resolved.

LGTM.

lib/Target/Mips/MipsInstrInfo.td
253

You can drop the parentheses here, they're spurious.

abeserminji updated this revision to Diff 144325.EditedApr 27 2018, 6:26 AM
abeserminji marked an inline comment as done.

Comments resolved.
Rebase before commit.
Fixed one failing test.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 27 2018, 6:34 AM
This revision was automatically updated to reflect the committed changes.