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).
7 import mlir
.dialects
.builtin
as builtin
8 import mlir
.dialects
.math
as mlir_math
11 print("\nTEST:", f
.__name
__)
14 # CHECK-LABEL: TEST: testMathOps
17 with
Context() as ctx
, Location
.unknown():
18 module
= Module
.create()
19 with
InsertionPoint(module
.body
):
20 @builtin.FuncOp
.from_py_func(F32Type
.get())
22 return mlir_math
.SqrtOp(arg
)
24 # CHECK-LABEL: func @emit_sqrt(
25 # CHECK-SAME: %[[ARG:.*]]: f32) -> f32 {
26 # CHECK: math.sqrt %[[ARG]] : f32