[PATCH] D13466: [AArch64] Implement vector splitting on UADDV.
Charlie Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 09:55:09 PDT 2015
chatur01 updated this revision to Diff 36634.
chatur01 added a comment.
Thanks Jun, that was a mistake.
http://reviews.llvm.org/D13466
Files:
lib/Target/AArch64/AArch64ISelLowering.cpp
test/CodeGen/AArch64/aarch64-addv.ll
Index: test/CodeGen/AArch64/aarch64-addv.ll
===================================================================
--- test/CodeGen/AArch64/aarch64-addv.ll
+++ test/CodeGen/AArch64/aarch64-addv.ll
@@ -51,3 +51,27 @@
%r = extractelement <2 x i64> %bin.rdx0, i32 0
ret i64 %r
}
+
+define i32 @PR25056(i8* noalias nocapture readonly %arg1, i8* noalias nocapture readonly %arg2) {
+; CHECK-LABEL: PR25056
+; CHECK: addv {{s[0-9]+}}, {{v[0-9]+}}.4s
+entry:
+ %0 = bitcast i8* %arg1 to <8 x i8>*
+ %1 = load <8 x i8>, <8 x i8>* %0, align 1
+ %2 = zext <8 x i8> %1 to <8 x i32>
+ %3 = bitcast i8* %arg2 to <8 x i8>*
+ %4 = load <8 x i8>, <8 x i8>* %3, align 1
+ %5 = zext <8 x i8> %4 to <8 x i32>
+ %6 = sub nsw <8 x i32> %2, %5
+ %7 = icmp slt <8 x i32> %6, zeroinitializer
+ %8 = sub nsw <8 x i32> zeroinitializer, %6
+ %9 = select <8 x i1> %7, <8 x i32> %8, <8 x i32> %6
+ %rdx.shuf = shufflevector <8 x i32> %9, <8 x i32> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
+ %bin.rdx = add <8 x i32> %9, %rdx.shuf
+ %rdx.shuf1 = shufflevector <8 x i32> %bin.rdx, <8 x i32> undef, <8 x i32> <i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
+ %bin.rdx2 = add <8 x i32> %bin.rdx, %rdx.shuf1
+ %rdx.shuf3 = shufflevector <8 x i32> %bin.rdx2, <8 x i32> undef, <8 x i32> <i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
+ %bin.rdx4 = add <8 x i32> %bin.rdx2, %rdx.shuf3
+ %10 = extractelement <8 x i32> %bin.rdx4, i32 0
+ ret i32 %10
+}
Index: lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- lib/Target/AArch64/AArch64ISelLowering.cpp
+++ lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -9600,14 +9600,30 @@
Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, MVT::i16, Op));
}
+static void ReplaceUADDVResults(SDNode *N, SmallVectorImpl<SDValue> &Results,
+ SelectionDAG &DAG) {
+ EVT LoVT, HiVT;
+ SDValue Lo, Hi;
+ SDLoc dl(N);
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+ std::tie(LoVT, HiVT) = DAG.GetSplitDestVTs(N->getValueType(0));
+ std::tie(Lo, Hi) = DAG.SplitVectorOperand(N, 0);
+ SDValue ResultAdd = DAG.getNode(ISD::ADD, dl, LoVT, Lo, Hi);
+ SDValue SplitUADDV = DAG.getNode(AArch64ISD::UADDV, dl, LoVT, ResultAdd);
+ Results.push_back(SplitUADDV);
+}
+
void AArch64TargetLowering::ReplaceNodeResults(
SDNode *N, SmallVectorImpl<SDValue> &Results, SelectionDAG &DAG) const {
switch (N->getOpcode()) {
default:
llvm_unreachable("Don't know how to custom expand this");
case ISD::BITCAST:
ReplaceBITCASTResults(N, Results, DAG);
return;
+ case AArch64ISD::UADDV:
+ ReplaceUADDVResults(N, Results, DAG);
+ return;
case ISD::FP_TO_UINT:
case ISD::FP_TO_SINT:
assert(N->getValueType(0) == MVT::i128 && "unexpected illegal conversion");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13466.36634.patch
Type: text/x-patch
Size: 2937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151006/0dfc02a0/attachment.bin>
More information about the llvm-commits
mailing list