diff options
author | Tim Northover <tnorthover@apple.com> | 2014-07-15 10:00:26 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-07-15 10:00:26 +0000 |
commit | e4b8e138e151414a9de7357935c3c7f0b00964a7 (patch) | |
tree | 60157c42b55ab930ab8c989104e4e493d2659692 /llvm/lib | |
parent | 47c4d101e00953aefb071625c68f3d9ab8373e4a (diff) | |
download | bcm5719-llvm-e4b8e138e151414a9de7357935c3c7f0b00964a7.tar.gz bcm5719-llvm-e4b8e138e151414a9de7357935c3c7f0b00964a7.zip |
AArch64: fall back to generic code for out of range extract/insert.
rdar://problem/17624784
llvm-svn: 213059
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 07ff0938ed2..7b77c59ed11 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -5584,11 +5584,12 @@ SDValue AArch64TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const { assert(Op.getOpcode() == ISD::INSERT_VECTOR_ELT && "Unknown opcode!"); - // Check for non-constant lane. - if (!isa<ConstantSDNode>(Op.getOperand(2))) + // Check for non-constant or out of range lane. + EVT VT = Op.getOperand(0).getValueType(); + ConstantSDNode *CI = dyn_cast<ConstantSDNode>(Op.getOperand(2)); + if (!CI || CI->getZExtValue() >= VT.getVectorNumElements()) return SDValue(); - EVT VT = Op.getOperand(0).getValueType(); // Insertion/extraction are legal for V128 types. if (VT == MVT::v16i8 || VT == MVT::v8i16 || VT == MVT::v4i32 || @@ -5616,11 +5617,12 @@ AArch64TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const { assert(Op.getOpcode() == ISD::EXTRACT_VECTOR_ELT && "Unknown opcode!"); - // Check for non-constant lane. - if (!isa<ConstantSDNode>(Op.getOperand(1))) + // Check for non-constant or out of range lane. + EVT VT = Op.getOperand(0).getValueType(); + ConstantSDNode *CI = dyn_cast<ConstantSDNode>(Op.getOperand(1)); + if (!CI || CI->getZExtValue() >= VT.getVectorNumElements()) return SDValue(); - EVT VT = Op.getOperand(0).getValueType(); // Insertion/extraction are legal for V128 types. if (VT == MVT::v16i8 || VT == MVT::v8i16 || VT == MVT::v4i32 || |