This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Canonicalize SIGN_EXTEND to VSELECT
AbandonedPublic

Authored by NicolaLancellotti on Oct 26 2022, 9:10 AM.

Details

Summary

This patch canonicalizes SIGN_EXTEND to VSELECT to allow sext to transform into a predicated instruction like add, sub or mul.

Diff Detail

Event Timeline

NicolaLancellotti requested review of this revision.Oct 26 2022, 9:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2022, 9:10 AM

I know you might be busy. When you have time, can you review this patch, please?

To add some extra context @NicolaLancellotti wrote this as an extension to D135596. It requires a lot more changes though, and my feeling is that we might be playing whack-a-mole with generic combines that all assume sext's. As we had the patch I suggested putting it up to see what others thought. So.. what do others think?

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
5418

I don't think this is limited to scalable vectors?

5421

Could this use isConstantSplatVectorAllOnes?

5431

Could this be part of the if condition?

Sorry for the delay, but it's likely to be later in the week if not next week before I'll have enough time to review properly.

RKSimon added inline comments.Nov 7 2022, 6:12 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
5418

indeed - I'd like to see what effect this has on other targets for fixed vectors (where we have a lot more test coverage e.g. AVX512)

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
5561

DAG.getAllOnesConstant ?

18364

!SplatVal.isAllOnes()

llvm/test/CodeGen/AArch64/predicated-add-sub-mul.ll
224

please can you pre-commit these tests with current (trunk) codegen and then rebase the patch to show the codegen diff

NicolaLancellotti abandoned this revision.Nov 28 2022, 3:25 AM