Skip to content

Commit 7b7b06f

Browse files
author
Charlie Turner
committedNov 9, 2015
[AArch64] Handle extract_subvector(..., 0) in ISel.
Summary: Lowering this pattern early to an `EXTRACT_SUBREG` was making it impossible to match larger patterns in tblgen that use `extract_subvector(..., 0)` as part of the their input pattern. It seems like there will exist somewhere a better way of specifying this pattern over all relevant register value types, but I didn't manage to find it. Reviewers: t.p.northover, jmolloy Subscribers: aemerson, llvm-commits, rengolin Differential Revision: http://reviews.llvm.org/D14207 llvm-svn: 252464
1 parent 4854d80 commit 7b7b06f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed
 

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

+5-18
Original file line numberDiff line numberDiff line change
@@ -6395,24 +6395,11 @@ SDValue AArch64TargetLowering::LowerEXTRACT_SUBVECTOR(SDValue Op,
63956395
unsigned Val = Cst->getZExtValue();
63966396

63976397
unsigned Size = Op.getValueType().getSizeInBits();
6398-
if (Val == 0) {
6399-
switch (Size) {
6400-
case 8:
6401-
return DAG.getTargetExtractSubreg(AArch64::bsub, dl, Op.getValueType(),
6402-
Op.getOperand(0));
6403-
case 16:
6404-
return DAG.getTargetExtractSubreg(AArch64::hsub, dl, Op.getValueType(),
6405-
Op.getOperand(0));
6406-
case 32:
6407-
return DAG.getTargetExtractSubreg(AArch64::ssub, dl, Op.getValueType(),
6408-
Op.getOperand(0));
6409-
case 64:
6410-
return DAG.getTargetExtractSubreg(AArch64::dsub, dl, Op.getValueType(),
6411-
Op.getOperand(0));
6412-
default:
6413-
llvm_unreachable("Unexpected vector type in extract_subvector!");
6414-
}
6415-
}
6398+
6399+
// This will get lowered to an appropriate EXTRACT_SUBREG in ISel.
6400+
if (Val == 0)
6401+
return Op;
6402+
64166403
// If this is extracting the upper 64-bits of a 128-bit vector, we match
64176404
// that directly.
64186405
if (Size == 64 && Val * VT.getVectorElementType().getSizeInBits() == 64)

‎llvm/lib/Target/AArch64/AArch64InstrInfo.td

+15
Original file line numberDiff line numberDiff line change
@@ -5788,6 +5788,21 @@ def : Pat<(v16i8 (bitconvert (v8f16 FPR128:$src))),
57885788
(v16i8 (REV16v16i8 FPR128:$src))>;
57895789
}
57905790

5791+
def : Pat<(v4i16 (extract_subvector V128:$Rn, (i64 0))),
5792+
(EXTRACT_SUBREG V128:$Rn, dsub)>;
5793+
def : Pat<(v8i8 (extract_subvector V128:$Rn, (i64 0))),
5794+
(EXTRACT_SUBREG V128:$Rn, dsub)>;
5795+
def : Pat<(v2f32 (extract_subvector V128:$Rn, (i64 0))),
5796+
(EXTRACT_SUBREG V128:$Rn, dsub)>;
5797+
def : Pat<(v4f16 (extract_subvector V128:$Rn, (i64 0))),
5798+
(EXTRACT_SUBREG V128:$Rn, dsub)>;
5799+
def : Pat<(v2i32 (extract_subvector V128:$Rn, (i64 0))),
5800+
(EXTRACT_SUBREG V128:$Rn, dsub)>;
5801+
def : Pat<(v1i64 (extract_subvector V128:$Rn, (i64 0))),
5802+
(EXTRACT_SUBREG V128:$Rn, dsub)>;
5803+
def : Pat<(v1f64 (extract_subvector V128:$Rn, (i64 0))),
5804+
(EXTRACT_SUBREG V128:$Rn, dsub)>;
5805+
57915806
def : Pat<(v8i8 (extract_subvector (v16i8 FPR128:$Rn), (i64 1))),
57925807
(EXTRACT_SUBREG (DUPv2i64lane FPR128:$Rn, 1), dsub)>;
57935808
def : Pat<(v4i16 (extract_subvector (v8i16 FPR128:$Rn), (i64 1))),

0 commit comments

Comments
 (0)
Please sign in to comment.