code: def test_tir_floatimm_const_fold():
      """Behavior check: folding fp32 match platform f32 arithmetic"""
  
      @T.prim_func
      def float_imm_multiply(
          x: T.float32, y: T.float32, z: T.Buffer((), "float32")
      ):
          z[()] = x * y
  
      @T.prim_func
      def float_imm_add(
          x: T.float32, y: T.float32, z: T.Buffer((), "float32")
      ):
          z[()] = x + y
  
      @T.prim_func
      def float_imm_sub(
          x: T.float32, y: T.float32, z: T.Buffer((), "float32")
      ):
          z[()] = x - y
  
      @T.prim_func
      def float_imm_div(
          x: T.float32, y: T.float32, z: T.Buffer((), "float32")
      ):
          z[()] = x / y
  
      def __wrap_build(f):
          lib = tvm.build(f, target="llvm")
          z = tvm.nd.array(np.zeros([]).astype("float32"))
  
          def _func(x, y):
              lib(x, y, z)
              return z.numpy()
  
          return _func
  
      fmul = __wrap_build(float_imm_multiply)
      fadd = __wrap_build(float_imm_add)
      fsub = __wrap_build(float_imm_sub)
      fdiv = __wrap_build(float_imm_div)
  
      # overflow
      check_tir_const_fold(
          "float32", lambda x, y: x * y, fmul, 3.0e30, 3.0e30, np.inf
      )
      check_tir_const_fold(
          "float32", lambda x, y: x * y, fmul, 3.0e30, -3.0e30, -np.inf
      )
      check_tir_const_fold(
          "float32", lambda x, y: x / y, fdiv, 3.0e30, 3.0e-30, np.inf
      )
  
      # divide by zero
      with pytest.raises(tvm.TVMError):
          check_tir_const_fold(
              "float32", lambda x, y: x / y, fdiv, 1.0, 0.0
          )
  
      # nan and inf
      check_tir_const_fold(
          "float32", lambda x, y: x + y, fadd, 1.0, np.nan, np.nan
      )
      check_tir_const_fold(
          "float32", lambda x, y: x + y, fadd, 1.0, np.inf, np.inf
      )
      check_tir_const_fold(
          "float32", lambda x, y: x + y, fadd, 1.0, -np.inf, -np.inf
      )
  
      # randomized check
      check_tir_const_fold("float32", lambda x, y: x * y, fmul)
      check_tir_const_fold("float32", lambda x, y: x + y, fadd)
      check_tir_const_fold("float32", lambda x, y: x - y, fsub)
      check_tir_const_fold(
          "float32",
          lambda x, y: x / y,
          fdiv,
          y_range=(0.01, np.finfo("float32").max),
      )
  
imports: import math
  import random
  import numpy
  import tvm
  import tvm.testing
  import pytest
  from tvm import tir
  from tvm.script import tir
  import pytest
label_desc: Use image node_id 12 for calling a global function with example usage: test_tir_floatimm_const_fold() and returns: _func, z