2020-06-14 05:43:10 +08:00
|
|
|
# RUN: %PYTHON %s | npcomp-opt -split-input-file | FileCheck %s --dump-input=fail
|
|
|
|
|
|
|
|
# Subset of constant tests which verify against a GenericTarget32.
|
|
|
|
|
2020-06-29 07:52:25 +08:00
|
|
|
from npcomp.compiler import test_config
|
2020-06-14 05:43:10 +08:00
|
|
|
from npcomp.compiler.target import *
|
|
|
|
|
2020-06-29 07:52:25 +08:00
|
|
|
import_global = test_config.create_import_dump_decorator(
|
|
|
|
target_factory=GenericTarget32)
|
2020-06-14 05:43:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
# 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
|