Skip to content

Commit 41681a5

Browse files
author
Jeroen Ketema
committed
[ARM] Do not scale vext with a factor
The vext pseudo-instruction takes the number of elements that need to be extracted, not the number of bytes. Hence, use the number of elements directly instead of scaling them with a factor. Reviewers: Silviu Baranga, James Molloy (not reflected in the differential revision) Differential Revision: http://reviews.llvm.org/D12974 llvm-svn: 248208
1 parent 8abf7c8 commit 41681a5

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5515,13 +5515,6 @@ SDValue ARMTargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
55155515
return SDValue();
55165516
}
55175517

5518-
/// getExtFactor - Determine the adjustment factor for the position when
5519-
/// generating an "extract from vector registers" instruction.
5520-
static unsigned getExtFactor(SDValue &V) {
5521-
EVT EltType = V.getValueType().getVectorElementType();
5522-
return EltType.getSizeInBits() / 8;
5523-
}
5524-
55255518
// Gather data to see if the operation can be modelled as a
55265519
// shuffle in combination with VEXTs.
55275520
SDValue ARMTargetLowering::ReconstructShuffle(SDValue Op,
@@ -5652,11 +5645,10 @@ SDValue ARMTargetLowering::ReconstructShuffle(SDValue Op,
56525645
SDValue VEXTSrc2 =
56535646
DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, DestVT, Src.ShuffleVec,
56545647
DAG.getConstant(NumSrcElts, dl, MVT::i32));
5655-
unsigned Imm = Src.MinElt * getExtFactor(VEXTSrc1);
56565648

56575649
Src.ShuffleVec = DAG.getNode(ARMISD::VEXT, dl, DestVT, VEXTSrc1,
56585650
VEXTSrc2,
5659-
DAG.getConstant(Imm, dl, MVT::i32));
5651+
DAG.getConstant(Src.MinElt, dl, MVT::i32));
56605652
Src.WindowBase = -Src.MinElt;
56615653
}
56625654
}

llvm/test/CodeGen/ARM/vzip.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,14 @@ entry:
305305
store <4 x i32> %0, <4 x i32>* %B
306306
ret void
307307
}
308+
309+
define void @vzip_vext_factor(<8 x i16>* %A, <4 x i16>* %B) {
310+
entry:
311+
; CHECK-LABEL: vzip_vext_factor
312+
; CHECK: vext.16 d16, d16, d17, #3
313+
; CHECK: vzip
314+
%tmp1 = load <8 x i16>, <8 x i16>* %A
315+
%0 = shufflevector <8 x i16> %tmp1, <8 x i16> undef, <4 x i32> <i32 4, i32 4, i32 5, i32 3>
316+
store <4 x i16> %0, <4 x i16>* %B
317+
ret void
318+
}

0 commit comments

Comments
 (0)