This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Map DestructiveTernaryCommWithRev intrinsics to pesudo instructions
AbandonedPublic

Authored by lizhijin on Jan 19 2023, 9:20 AM.

Details

Summary

This patch maps DestructiveTernaryCommWithRev intrinsics to pesudo intructions. This makes it easier to choose whether to generate fmla/fmls/fnmla/fnmls or fmad/fmsb/fnmad/fnmsb which reduces the generation of mov instructions when computing is intensive.

Diff Detail

Event Timeline

lizhijin created this revision.Jan 19 2023, 9:20 AM
lizhijin requested review of this revision.Jan 19 2023, 9:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 9:20 AM
Allen added inline comments.Jan 19 2023, 5:04 PM
llvm/test/CodeGen/AArch64/sve-intrinsic-fmla-fmad.ll
32 ↗(On Diff #490545)

nit: Expect multiple small cases for different instructions

Allen added a comment.Jan 27 2023, 7:59 PM

pre-merge checks fail

lizhijin updated this revision to Diff 493003.Jan 28 2023, 7:31 AM
lizhijin edited the summary of this revision. (Show Details)

ping

llvm/test/CodeGen/AArch64/sve-intrinsic-fmla-fmad.ll
32 ↗(On Diff #490545)

Modified.

sdesmalen added inline comments.Feb 3 2023, 8:06 AM
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
660

The intrinsics are defined to always merge into the first source operand, so passing this to a pseudo node which assumes the inactive lanes are undef doesn't seem entirely right.

Hi @lizhijin, I don't think this patch makes much sense because at the code generation layer we already have pseudo instructions to allow better FMLA/FMAD usage based on what the register allocate chooses to do. I suspect the problem you care about is due to how the C/C++ builtins are lowered for things like svmla_x? which currently overly restricts code generation. I've created a patch series that ends with D143767 that I believe fulfils the intent of what you wanted to achieve. Please let me know if I've misunderstood the issue you wanted to solve.

NOTE: D143767 can be extend to integer MLAs but there's ongoing work on the code generation side (D142656) before that can be done.
Matt added a subscriber: Matt.Mar 8 2023, 11:09 AM
lizhijin abandoned this revision.Mar 8 2023, 5:21 PM
paulwalker-arm added a comment.EditedMar 16 2023, 3:52 AM

To prevent some duplication of effort I just wanted to update my previous comment and say all the dependent patches have now landed and I'm planning to add _u intrinsics/builtins for the integer MLA instructions soon.