torch-mlir/test/Python/Compiler/constants32.py

26 lines
616 B
Python

# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
# Subset of constant tests which verify against a GenericTarget32.
from npcomp.compiler import test_config
from npcomp.compiler.target import *
import_global = test_config.create_import_dump_decorator(
target_factory=GenericTarget32)
# CHECK-LABEL: func @integer_constants
@import_global
def integer_constants():
# CHECK: %[[A:.*]] = constant 100 : i32
a = 100
return a
# CHECK-LABEL: func @float_constants
@import_global
def float_constants():
# CHECK: %[[A:.*]] = constant 2.200000e+00 : f32
a = 2.2
return a