This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fold (fadd x, (vselect c, y, -1.0)) into (vselect c, (fadd x, y), x)
ClosedPublic

Authored by dmgreen on Nov 10 2021, 10:37 AM.

Details

Summary

This is similar to D113574, but as a DAG combine, not tablegen patterns. Doing the fold as a DAG combine allows the fadd to be folded with a fmul, finally producing a predicated vfma. It performs the same fold of fadd(x, vselect(p, y, -0.0)) to vselect p, (fadd x, y), x) using -0.0 as the identity value of a fadd.

Diff Detail

Event Timeline

dmgreen created this revision.Nov 10 2021, 10:37 AM
dmgreen requested review of this revision.Nov 10 2021, 10:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2021, 10:37 AM
samtebbs accepted this revision.Nov 15 2021, 2:11 AM

LGTM with one request

llvm/lib/Target/ARM/ARMISelLowering.cpp
16418

The -1.0 in the comment should be -0.0.

This revision is now accepted and ready to land.Nov 15 2021, 2:11 AM
This revision was landed with ongoing or failed builds.Nov 24 2021, 2:41 AM
This revision was automatically updated to reflect the committed changes.