brintos

brintos / llvm-project-archived public Read only

0
0
Text · 520 B · d5b9e6c Raw
22 lines · python
1# RUN: %PYTHON %s | FileCheck %s2 3from mlir.ir import *4import mlir.dialects.spirv as spirv5 6 7def run(f):8    print("\nTEST:", f.__name__)9    f()10 11 12# CHECK-LABEL: TEST: testConstantOp13@run14def 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 : i3221        print(module)22