xref: /llvm-project/mlir/test/python/dialects/spirv_dialect.py (revision 2292fd0129362865d07777329fa38850d7a642a3)
1# RUN: %PYTHON %s | FileCheck %s
2
3from mlir.ir import *
4import mlir.dialects.spirv as spirv
5
6
7def run(f):
8    print("\nTEST:", f.__name__)
9    f()
10
11
12# CHECK-LABEL: TEST: testConstantOp
13@run
14def testConstantOps():
15    with Context() as ctx, Location.unknown():
16        module = Module.create()
17        with InsertionPoint(module.body):
18            i32 = IntegerType.get_signless(32)
19            spirv.ConstantOp(value=IntegerAttr.get(i32, 42), constant=i32)
20        # CHECK: spirv.Constant 42 : i32
21        print(module)
22