This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fill in FP16 FMA patterns
ClosedPublic

Authored by dmgreen on Jan 3 2020, 3:40 AM.

Details

Summary

This adds fp16 variants of all the fma patterns in the ARM backend.

Diff Detail

Event Timeline

dmgreen created this revision.Jan 3 2020, 3:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2020, 3:40 AM
samparker added inline comments.Jan 3 2020, 5:40 AM
llvm/lib/Target/ARM/ARMInstrVFP.td
2215

Do you think it would be worth doing some canonicalisation somewhere? With two fnegs I'm assuming this pattern is more expensive than the others if not caught.

dmgreen marked an inline comment as done.Jan 3 2020, 7:53 AM
dmgreen added inline comments.
llvm/lib/Target/ARM/ARMInstrVFP.td
2215

I gave this a go, but it appears that the opposite is sometimes true. AMDGPU has instructions that look like v_fma_f32 v0, -v0, v1, -v1, where each of the operands can be inverted for free. If we inverted the whole thing, then we would need to add reverse patterns. RISCV seems to have some cases with fnmadd.s that are made worse too.

samparker accepted this revision.Jan 3 2020, 8:08 AM

Ok, fair enough, thanks for trying.

This revision is now accepted and ready to land.Jan 3 2020, 8:08 AM
This revision was automatically updated to reflect the committed changes.