[PATCH] D120481: [AArch64] Try to re-use extended operand for SETCC with v16i8 operands.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 24 06:52:52 PST 2022
fhahn created this revision.
fhahn added reviewers: t.p.northover, ab, dmgreen, paquette.
Herald added subscribers: hiraditya, kristof.beyls.
fhahn requested review of this revision.
Herald added a project: LLVM.
Try to re-use an already extended operand for SetCC with v16i8 operands
feeding na extended select. Doing so avoids requiring another full
extension of the SET_CC result when lowering the select.
This improves lowering for certain extend/cmp/select patterns operating
on v16i8, by replacing 6 instructions for the extra extension with 4
separate selects.
This improves the generated code for loops like the one below in
combination with D96522 <https://reviews.llvm.org/D96522>.
int foo(uint8_t *p, int N) {
unsigned long long sum = 0;
for (int i = 0; i < N ; i++, p++) {
unsigned int v = *p;
sum += (v < 127) ? v : 256 - v;
}
return sum;
}
https://clang.godbolt.org/z/Wco866MjY
On the AArch64 cores I have access to, the patch improves performance of
the vector loop by ~10%.
This could be generalized per follow-ups, but the initial version
targets one of the more important cases in combination with D96522 <https://reviews.llvm.org/D96522>.
Alive2 model:
- unsigned: https://alive2.llvm.org/ce/z/iEwLU3
- signed: https://alive2.llvm.org/ce/z/aMBega
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120481
Files:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/vselect-ext.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120481.411110.patch
Type: text/x-patch
Size: 5843 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220224/81a91169/attachment.bin>
More information about the llvm-commits
mailing list