return dest().getType().cast<VectorType>();
}
}];
+
+ let hasFolder = 1;
}
def Vector_OuterProductOp :
return success();
}
+OpFoldResult InsertStridedSliceOp::fold(ArrayRef<Attribute> operands) {
+ if (getSourceVectorType() == getDestVectorType())
+ return source();
+ return {};
+}
+
//===----------------------------------------------------------------------===//
// OuterProductOp
//===----------------------------------------------------------------------===//
// CHECK: return %[[v]] : vector<2xf32>
return %0 : vector<2xf32>
}
+
+// -----
+
+// CHECK-LABEL: func @insert_strided_slice_full_range
+// CHECK-SAME: %[[SOURCE:.+]]: vector<16x16xf16>, %{{.+}}: vector<16x16xf16>
+func @insert_strided_slice_full_range(%source: vector<16x16xf16>, %dest: vector<16x16xf16>) -> vector<16x16xf16> {
+ %0 = vector.insert_strided_slice %source, %dest {offsets = [0, 0], strides = [1, 1]} : vector<16x16xf16> into vector<16x16xf16>
+ // CHECK: return %[[SOURCE]]
+ return %0: vector<16x16xf16>
+}
}
// CHECK-LABEL: func @cast_away_insert_strided_slice_leading_one_dims_one_element
+// CHECK-SAME: %[[ARG0:.+]]: vector<1x1xf16>, %{{.+}}: vector<1x1x1xf16>
func @cast_away_insert_strided_slice_leading_one_dims_one_element(%arg0: vector<1x1xf16>, %arg1: vector<1x1x1xf16>) -> vector<1x1x1xf16> {
- // CHECK: vector.shape_cast %{{.+}} : vector<1x1xf16> to vector<1xf16>
- // CHECK: vector.shape_cast %{{.+}} : vector<1x1x1xf16> to vector<1xf16>
+ // CHECK: %[[CAST:.+]] = vector.shape_cast %[[ARG0]] : vector<1x1xf16> to vector<1x1x1xf16>
%0 = vector.insert_strided_slice %arg0, %arg1 {offsets = [0, 0, 0], strides = [1, 1]} : vector<1x1xf16> into vector<1x1x1xf16>
+ // CHECK: return %[[CAST]]
return %0: vector<1x1x1xf16>
}