// RUN: mlir-opt %s -convert-linalg-to-loops -convert-scf-to-cf -expand-strided-metadata -lower-affine -convert-arith-to-llvm -finalize-memref-to-llvm -convert-func-to-llvm -reconcile-unrealized-casts | \ // RUN: mlir-cpu-runner -O3 -e main -entry-point-result=void \ // RUN: -shared-libs=%mlir_runner_utils \ // RUN: | FileCheck %s func.func private @printMemrefF32(memref<*xf32>) func.func @main() { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %f0 = arith.constant 0.0 : f32 %f1 = arith.constant 1.0 : f32 %f2 = arith.constant 2.0 : f32 %f3 = arith.constant 3.0 : f32 %A = memref.alloc(%c2, %c2) : memref memref.store %f0, %A[%c0, %c0] : memref memref.store %f1, %A[%c0, %c1] : memref memref.store %f2, %A[%c1, %c0] : memref memref.store %f3, %A[%c1, %c1] : memref %B = memref.subview %A[%c1, 0][1, %c2][1, 1] : memref to memref> %C = memref.subview %A[0, %c1][%c2, 1][1, 1] : memref to memref> %A_ = memref.cast %A : memref to memref<*xf32> call @printMemrefF32(%A_) : (memref<*xf32>) -> () %B_ = memref.cast %B : memref> to memref<*xf32> call @printMemrefF32(%B_) : (memref<*xf32>) -> () %C_ = memref.cast %C : memref> to memref<*xf32> call @printMemrefF32(%C_) : (memref<*xf32>) -> () memref.dealloc %A : memref return } // CHECK: Unranked Memref base@ = {{.*}} rank = 2 offset = 0 sizes = [2, 2] strides = [2, 1] data = // CHECK-NEXT: [ // CHECK-SAME: [0, 1], // CHECK-NEXT: [2, 3] // CHECK-SAME: ] // CHECK: [2, 3] // CHECK: [1, 3]