llvm.org GIT mirror llvm / fbb6311
AArch64: fall back to generic code for out of range extract/insert. rdar://problem/17624784 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213059 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Northover 6 years ago
2 changed file(s) with 27 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
55835583 SelectionDAG &DAG) const {
55845584 assert(Op.getOpcode() == ISD::INSERT_VECTOR_ELT && "Unknown opcode!");
55855585
5586 // Check for non-constant lane.
5587 if (!isa(Op.getOperand(2)))
5588 return SDValue();
5589
5586 // Check for non-constant or out of range lane.
55905587 EVT VT = Op.getOperand(0).getValueType();
5588 ConstantSDNode *CI = dyn_cast(Op.getOperand(2));
5589 if (!CI || CI->getZExtValue() >= VT.getVectorNumElements())
5590 return SDValue();
5591
55915592
55925593 // Insertion/extraction are legal for V128 types.
55935594 if (VT == MVT::v16i8 || VT == MVT::v8i16 || VT == MVT::v4i32 ||
56155616 SelectionDAG &DAG) const {
56165617 assert(Op.getOpcode() == ISD::EXTRACT_VECTOR_ELT && "Unknown opcode!");
56175618
5618 // Check for non-constant lane.
5619 if (!isa(Op.getOperand(1)))
5620 return SDValue();
5621
5619 // Check for non-constant or out of range lane.
56225620 EVT VT = Op.getOperand(0).getValueType();
5621 ConstantSDNode *CI = dyn_cast(Op.getOperand(1));
5622 if (!CI || CI->getZExtValue() >= VT.getVectorNumElements())
5623 return SDValue();
5624
56235625
56245626 // Insertion/extraction are legal for V128 types.
56255627 if (VT == MVT::v16i8 || VT == MVT::v8i16 || VT == MVT::v4i32 ||
100100 ret <1 x i64> %vset_lane
101101 }
102102
103 ; Undefined behaviour, so we really don't care what actually gets emitted, just
104 ; as long as we don't crash (since it could be dynamically unreachable).
105 define i32 @test_out_of_range_extract(<4 x i32> %vec) {
106 ; CHECK-LABEL: test_out_of_range_extract:
107 ; CHECK: ret
108 %elt = extractelement <4 x i32> %vec, i32 4
109 ret i32 %elt
110 }
111
112 ; Undefined behaviour, so we really don't care what actually gets emitted, just
113 ; as long as we don't crash (since it could be dynamically unreachable).
114 define void @test_out_of_range_insert(<4 x i32> %vec, i32 %elt) {
115 ; CHECK-LABEL: test_out_of_range_insert:
116 ; CHECK: ret
117 insertelement <4 x i32> %vec, i32 %elt, i32 4
118 ret void
119 }