1*8b7e85f4SStella Laurenzo# RUN: %PYTHON %s | FileCheck %s
2*8b7e85f4SStella Laurenzo# This is just a smoke test that the dialect is functional.
3*8b7e85f4SStella Laurenzo
4*8b7e85f4SStella Laurenzofrom mlir.ir import *
5*8b7e85f4SStella Laurenzofrom mlir.dialects import ml_program
6*8b7e85f4SStella Laurenzo
7*8b7e85f4SStella Laurenzo
8*8b7e85f4SStella Laurenzodef constructAndPrintInModule(f):
9*8b7e85f4SStella Laurenzo  print("\nTEST:", f.__name__)
10*8b7e85f4SStella Laurenzo  with Context(), Location.unknown():
11*8b7e85f4SStella Laurenzo    module = Module.create()
12*8b7e85f4SStella Laurenzo    with InsertionPoint(module.body):
13*8b7e85f4SStella Laurenzo      f()
14*8b7e85f4SStella Laurenzo    print(module)
15*8b7e85f4SStella Laurenzo  return f
16*8b7e85f4SStella Laurenzo
17*8b7e85f4SStella Laurenzo
18*8b7e85f4SStella Laurenzo# CHECK-LABEL: testFuncOp
19*8b7e85f4SStella Laurenzo@constructAndPrintInModule
20*8b7e85f4SStella Laurenzodef testFuncOp():
21*8b7e85f4SStella Laurenzo  # CHECK: ml_program.func @foobar(%arg0: si32) -> si32
22*8b7e85f4SStella Laurenzo  f = ml_program.FuncOp(
23*8b7e85f4SStella Laurenzo      name="foobar",
24*8b7e85f4SStella Laurenzo      type=([IntegerType.get_signed(32)], [IntegerType.get_signed(32)]))
25*8b7e85f4SStella Laurenzo  block = f.add_entry_block()
26*8b7e85f4SStella Laurenzo  with InsertionPoint(block):
27*8b7e85f4SStella Laurenzo    # CHECK: ml_program.return
28*8b7e85f4SStella Laurenzo    ml_program.ReturnOp([block.arguments[0]])
29