diff --git a/mlir/test/Dialect/Linalg/library-calls.mlir b/mlir/test/Dialect/Linalg/library-calls.mlir new file mode 100644 --- /dev/null +++ b/mlir/test/Dialect/Linalg/library-calls.mlir @@ -0,0 +1,24 @@ +// RUN: mlir-opt %s -convert-linalg-to-std | FileCheck %s + +func private @print_memref_f32(memref<*xf32>) + +// CHECK: func private @linalg_fill_f32_viewsxsxf32(f32, memref) attributes {llvm.emit_c_interface} +// CHECK: func private @linalg_matmul_viewsxsxf32_viewsxsxf32_viewsxsxf32(memref, memref, memref) attributes {llvm.emit_c_interface} + +func @matmul(%A: memref, %B: memref) -> (memref) { + %c0 = constant 0 : index + %c1 = constant 1 : index + %f0 = constant 0.0 : f32 + %x = memref.dim %A, %c0 : memref + %y = memref.dim %B, %c1 : memref + %C = memref.alloc(%x, %y) : memref + + // CHECK: call @linalg_fill_f32_viewsxsxf32({{.*}}) : (f32, memref) + linalg.fill(%f0, %C) : f32, memref + + // CHECK: call @linalg_matmul_viewsxsxf32_viewsxsxf32_viewsxsxf32({{.*}}) : (memref, memref, memref) -> () + linalg.matmul ins(%A, %B: memref, memref) + outs(%C: memref) + return %C : memref +} +