[VPlan] Check VPWidenIntrinsicSC in VPRecipeWithIRFlags::classof.
[llvm-project.git] / mlir / test / python / dialects / math_dialect.py
blob3d402c54a11e3676e2bf03d77c0f010f8cc2027a
1 # RUN: %PYTHON %s | FileCheck %s
3 # Naming this file with a `_dialect` suffix to avoid a naming conflict with
4 # python package's math module (coming in from random.py).
6 from mlir.ir import *
7 import mlir.dialects.func as func
8 import mlir.dialects.math as mlir_math
11 def run(f):
12 print("\nTEST:", f.__name__)
13 f()
16 # CHECK-LABEL: TEST: testMathOps
17 @run
18 def testMathOps():
19 with Context() as ctx, Location.unknown():
20 module = Module.create()
21 with InsertionPoint(module.body):
23 @func.FuncOp.from_py_func(F32Type.get())
24 def emit_sqrt(arg):
25 return mlir_math.SqrtOp(arg)
27 # CHECK-LABEL: func @emit_sqrt(
28 # CHECK-SAME: %[[ARG:.*]]: f32) -> f32 {
29 # CHECK: math.sqrt %[[ARG]] : f32
30 # CHECK: return
31 # CHECK: }
32 print(module)