This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Add a tablegen pattern for UZP1.
ClosedPublic

Authored by labrinea on Dec 9 2021, 2:25 AM.

Details

Summary

Converts concat_vectors(V64 (trunc V128), V64 (trunc V128)) and concat_vectors(V32 (trunc V64), V32 (trunc V64)), which would otherwise be lowered as xtn followed by xtn2, to uzp1.

Diff Detail

Event Timeline

labrinea created this revision.Dec 9 2021, 2:25 AM
labrinea requested review of this revision.Dec 9 2021, 2:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2021, 2:25 AM
labrinea updated this revision to Diff 393090.Dec 9 2021, 3:00 AM

Rebased and adjusted one more test (LLVM :: CodeGen/AArch64/fpclamptosat_vec.ll).

dmgreen accepted this revision.Dec 10 2021, 1:14 AM

LGTM. Less instructions is almost always good.

This revision is now accepted and ready to land.Dec 10 2021, 1:14 AM
SjoerdMeijer added inline comments.Dec 10 2021, 1:27 AM
llvm/lib/Target/AArch64/AArch64InstrInfo.td
5291

I was wondering if we also need patterns that work on V64 values/regs, so that we get the uzp1 .8b variants?

labrinea updated this revision to Diff 393888.Dec 13 2021, 7:24 AM
labrinea edited the summary of this revision. (Show Details)

Added patterns for V64.

labrinea marked an inline comment as done.Dec 13 2021, 7:24 AM
dmgreen added inline comments.Dec 14 2021, 12:56 AM
llvm/lib/Target/AArch64/AArch64InstrInfo.td
5291

Does this pattern and the one below work? I think illegal types don't get this far through lowering, and tablegen often balks at them.

labrinea marked an inline comment as done.Dec 14 2021, 1:44 AM
labrinea added inline comments.
llvm/lib/Target/AArch64/AArch64InstrInfo.td
5291

Yes they do. I have added tests for them in llvm/test/CodeGen/AArch64/concat_vector-truncate-combine.ll. However, the pattern for the 2s variant didn't work (v1i64 --> v2i32).

dmgreen added inline comments.Dec 14 2021, 2:00 AM
llvm/lib/Target/AArch64/AArch64InstrInfo.td
5291

OK. These two already seem to produce the single instruction, without the need for this patch:
https://godbolt.org/z/15Yh1a4bv

I'm not sure if they are actually doing much.

This revision was landed with ongoing or failed builds.Dec 14 2021, 3:56 AM
This revision was automatically updated to reflect the committed changes.
labrinea marked an inline comment as done.