code: def test_tir_int8_const_fold():
      """Behavior check: folding i8 operation match platform i8 arithmetic"""
  
      @T.prim_func
      def imm_multiply(x: T.int8, y: T.int8) -> T.int8:
          T.evaluate(T.ret(x * y, dtype="int8"))
  
      @T.prim_func
      def imm_add(x: T.int8, y: T.int8) -> T.int8:
          T.evaluate(T.ret(x + y, dtype="int8"))
  
      @T.prim_func
      def imm_sub(x: T.int8, y: T.int8) -> T.int8:
          T.evaluate(T.ret(x - y, dtype="int8"))
  
      @T.prim_func
      def imm_truncdiv(x: T.int8, y: T.int8) -> T.int8:
          T.evaluate(T.ret(T.truncdiv(x, y), dtype="int8"))
  
      @T.prim_func
      def imm_floordiv(x: T.int8, y: T.int8) -> T.int8:
          T.evaluate(T.ret(T.floordiv(x, y), dtype="int8"))
  
      fmul = tvm.build(imm_multiply, target="llvm")
      fadd = tvm.build(imm_add, target="llvm")
      fsub = tvm.build(imm_sub, target="llvm")
      ffloordiv = tvm.build(imm_floordiv, target="llvm")
      ftruncdiv = tvm.build(imm_truncdiv, target="llvm")
  
      # overflow
      check_tir_const_fold(
          "int8", lambda x, y: x + y, fadd, 127, 1, -128
      )
      check_tir_const_fold(
          "int8", lambda x, y: x * y, fmul, 127, 127, 1
      )
  
      # divide by zero
      with pytest.raises(tvm.TVMError):
          check_tir_const_fold(
              "int8", lambda x, y: tir.floordiv(x, y), ffloordiv, 1, 0
          )
      with pytest.raises(tvm.TVMError):
          check_tir_const_fold(
              "int8", lambda x, y: tir.truncdiv(x, y), ftruncdiv, 1, 0
          )
  
      # i8 mod folding is not implemented
      assert not isinstance(
          tir.floormod(tir.const(7, "int8"), tir.const(3, "int8")),
          tir.IntImm,
      )
      assert not isinstance(
          tir.truncmod(tir.const(7, "int8"), tir.const(3, "int8")),
          tir.IntImm,
      )
  
      # randomized check
      check_tir_const_fold("int8", lambda x, y: x * y, fmul)
      check_tir_const_fold("int8", lambda x, y: x + y, fadd)
      check_tir_const_fold("int8", lambda x, y: x - y, fsub)
      check_tir_const_fold(
          "int8",
          lambda x, y: tir.floordiv(x, y),
          ffloordiv,
          y_range=(1, np.iinfo("int8").max),
      )
      check_tir_const_fold(
          "int8",
          lambda x, y: tir.truncdiv(x, y),
          ftruncdiv,
          y_range=(1, np.iinfo("int8").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 13 for calling a global function with example usage: test_tir_int8_const_fold() without return types