This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add isel patterns to match vmacc/vmadd/vnmsub/vnmsac from add/sub and mul.
ClosedPublic

Authored by craig.topper on Jun 11 2021, 5:24 PM.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 11 2021, 5:24 PM
craig.topper requested review of this revision.Jun 11 2021, 5:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2021, 5:24 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
frasercrmck added inline comments.Jun 18 2021, 2:59 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
491

Comment here needs updating for the right opcodes

llvm/test/CodeGen/RISCV/rvv/stepvector.ll
492 ↗(On Diff #351600)

Seems like this test is regressing. Is there a one-use check that may help here?

Limit to cases where mul has a single use. There may be a better heuristic here,
but this is a simple starting point.

frasercrmck accepted this revision.Jun 21 2021, 2:06 AM

LGTM, cheers!

This revision is now accepted and ready to land.Jun 21 2021, 2:06 AM
This revision was landed with ongoing or failed builds.Jun 21 2021, 11:29 AM
This revision was automatically updated to reflect the committed changes.
eopXD added a subscriber: eopXD.Jan 15 2022, 12:14 AM
eopXD added inline comments.
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
480

I am not familiar with SD Patterns and the TableGen syntax, so I may be wrong.

According to v-spec:

vmacc.vv vd, vs1, vs2, vm    # vd[i] = +(vs1[i] * vs2[i]) + vd[i]

Shouldn't $rs1 be multiplying with $rs2 here?

craig.topper added inline comments.Jan 15 2022, 12:20 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
480

Aren't these patterns for

vmadd.vv vd, vs1, vs2, vm # vd[i] = (vs1[i] * vd[i]) + vs2[i]
eopXD added inline comments.Jan 15 2022, 12:23 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
480

Ah I see. You are correct.
Thank you for answering!