Add further i64 VM tests (#4856)

diff --git a/iree/vm/test/BUILD b/iree/vm/test/BUILD
index a826400..ac52126 100644
--- a/iree/vm/test/BUILD
+++ b/iree/vm/test/BUILD
@@ -37,11 +37,14 @@
         ":arithmetic_ops.vmfb",
         ":arithmetic_ops_i64.vmfb",
         ":assignment_ops.vmfb",
+        ":assignment_ops_i64.vmfb",
         ":comparison_ops.vmfb",
         ":control_flow_ops.vmfb",
         ":conversion_ops.vmfb",
+        ":conversion_ops_i64.vmfb",
         ":list_ops.vmfb",
         ":shift_ops.vmfb",
+        ":shift_ops_i64.vmfb",
     ],
     cc_file_output = "all_bytecode_modules.cc",
     cpp_namespace = "iree::vm::test",
@@ -68,6 +71,12 @@
 )
 
 iree_bytecode_module(
+    name = "assignment_ops_i64",
+    src = "assignment_ops_i64.mlir",
+    flags = ["-iree-vm-ir-to-bytecode-module"],
+)
+
+iree_bytecode_module(
     name = "comparison_ops",
     src = "comparison_ops.mlir",
     flags = ["-iree-vm-ir-to-bytecode-module"],
@@ -86,6 +95,12 @@
 )
 
 iree_bytecode_module(
+    name = "conversion_ops_i64",
+    src = "conversion_ops_i64.mlir",
+    flags = ["-iree-vm-ir-to-bytecode-module"],
+)
+
+iree_bytecode_module(
     name = "list_ops",
     src = "list_ops.mlir",
     cc_namespace = "iree::vm::test",
@@ -98,3 +113,10 @@
     cc_namespace = "iree::vm::test",
     flags = ["-iree-vm-ir-to-bytecode-module"],
 )
+
+iree_bytecode_module(
+    name = "shift_ops_i64",
+    src = "shift_ops_i64.mlir",
+    cc_namespace = "iree::vm::test",
+    flags = ["-iree-vm-ir-to-bytecode-module"],
+)
diff --git a/iree/vm/test/CMakeLists.txt b/iree/vm/test/CMakeLists.txt
index 3351bd3..a6546c6 100644
--- a/iree/vm/test/CMakeLists.txt
+++ b/iree/vm/test/CMakeLists.txt
@@ -25,11 +25,14 @@
     "arithmetic_ops.vmfb"
     "arithmetic_ops_i64.vmfb"
     "assignment_ops.vmfb"
+    "assignment_ops_i64.vmfb"
     "comparison_ops.vmfb"
     "control_flow_ops.vmfb"
     "conversion_ops.vmfb"
+    "conversion_ops_i64.vmfb"
     "list_ops.vmfb"
     "shift_ops.vmfb"
+    "shift_ops_i64.vmfb"
   CC_FILE_OUTPUT
     "all_bytecode_modules.cc"
   H_FILE_OUTPUT
@@ -72,6 +75,16 @@
 
 iree_bytecode_module(
   NAME
+    assignment_ops_i64
+  SRC
+    "assignment_ops_i64.mlir"
+  FLAGS
+    "-iree-vm-ir-to-bytecode-module"
+  PUBLIC
+)
+
+iree_bytecode_module(
+  NAME
     comparison_ops
   SRC
     "comparison_ops.mlir"
@@ -102,6 +115,16 @@
 
 iree_bytecode_module(
   NAME
+    conversion_ops_i64
+  SRC
+    "conversion_ops_i64.mlir"
+  FLAGS
+    "-iree-vm-ir-to-bytecode-module"
+  PUBLIC
+)
+
+iree_bytecode_module(
+  NAME
     list_ops
   SRC
     "list_ops.mlir"
@@ -123,3 +146,15 @@
     "-iree-vm-ir-to-bytecode-module"
   PUBLIC
 )
+
+iree_bytecode_module(
+  NAME
+    shift_ops_i64
+  SRC
+    "shift_ops_i64.mlir"
+  CC_NAMESPACE
+    "iree::vm::test"
+  FLAGS
+    "-iree-vm-ir-to-bytecode-module"
+  PUBLIC
+)
diff --git a/iree/vm/test/assignment_ops_i64.mlir b/iree/vm/test/assignment_ops_i64.mlir
new file mode 100644
index 0000000..895efb0
--- /dev/null
+++ b/iree/vm/test/assignment_ops_i64.mlir
@@ -0,0 +1,25 @@
+vm.module @assignment_ops_i64 {
+
+  //===--------------------------------------------------------------------===//
+  // ExtI64: Conditional assignment
+  //===--------------------------------------------------------------------===//
+
+  // TODO: The CModuleTarget enforces exports to be ordered.
+  vm.export @test_select_i64
+
+  vm.func @test_select_i64() {
+    %c0 = vm.const.i32 0 : i32
+    %c0dno = iree.do_not_optimize(%c0) : i32
+    %c1 = vm.const.i32 1 : i32
+    %c1dno = iree.do_not_optimize(%c1) : i32
+    %c2 = vm.const.i64 0 : i64
+    %c2dno = iree.do_not_optimize(%c2) : i64
+    %c3 = vm.const.i64 1 : i64
+    %c3dno = iree.do_not_optimize(%c3) : i64
+    %v1 = vm.select.i64 %c0dno, %c2dno, %c3dno : i64
+    vm.check.eq %v1, %c3, "0 ? 0 : 1 = 1" : i64
+    %v2 = vm.select.i64 %c1dno, %c2dno, %c3dno : i64
+    vm.check.eq %v2, %c2, "1 ? 0 : 1 = 0" : i64
+    vm.return
+  }
+}
diff --git a/iree/vm/test/conversion_ops_i64.mlir b/iree/vm/test/conversion_ops_i64.mlir
new file mode 100644
index 0000000..6d420c9
--- /dev/null
+++ b/iree/vm/test/conversion_ops_i64.mlir
@@ -0,0 +1,17 @@
+vm.module @conversion_ops_i64 {
+
+  //===----------------------------------------------------------------------===//
+  // ExtI64: Casting and type conversion/emulation
+  //===----------------------------------------------------------------------===//
+
+  vm.export @test_trunc_i64_i32
+
+  vm.func @test_trunc_i64_i32() {
+    %c1 = vm.const.i64 9223372036854775807 : i64
+    %c1dno = iree.do_not_optimize(%c1) : i64
+    %v = vm.trunc.i64.i32 %c1dno : i64 -> i32
+    %c2 = vm.const.i32 4294967295 : i32
+    vm.check.eq %v, %c2, "truncate unsigned i64 to unsigned i32" : i32
+    vm.return
+  }
+}
diff --git a/iree/vm/test/shift_ops_i64.mlir b/iree/vm/test/shift_ops_i64.mlir
new file mode 100644
index 0000000..04da8af
--- /dev/null
+++ b/iree/vm/test/shift_ops_i64.mlir
@@ -0,0 +1,36 @@
+vm.module @shift_ops_i64 {
+
+  //===--------------------------------------------------------------------===//
+  // ExtI64: Native bitwise shifts and rotates
+  //===--------------------------------------------------------------------===//
+
+  vm.export @test_shl_i64
+  vm.func @test_shl_i64() {
+    %c1 = vm.const.i64 1 : i64
+    %c1dno = iree.do_not_optimize(%c1) : i64
+    %v = vm.shl.i64 %c1dno, 2 : i64
+    %c2 = vm.const.i64 4 : i64
+    vm.check.eq %v, %c2, "1<<2=4" : i64
+    vm.return
+  }
+
+  vm.export @test_shr_i64s
+  vm.func @test_shr_i64s() {
+    %c1 = vm.const.i64 -1 : i64
+    %c1dno = iree.do_not_optimize(%c1) : i64
+    %v = vm.shr.i64.s %c1dno, 2 : i64
+    %c2 = vm.const.i64 -1 : i64
+    vm.check.eq %v, %c2, "-1>>-1=-1" : i64
+    vm.return
+  }
+
+  vm.export @test_shr_i64u
+  vm.func @test_shr_i64u() {
+    %c1 = vm.const.i64 4 : i64
+    %c1dno = iree.do_not_optimize(%c1) : i64
+    %v = vm.shr.i64.u %c1dno, 2 : i64
+    %c2 = vm.const.i64 1 : i64
+    vm.check.eq %v, %c2, "4>>2=1" : i64
+    vm.return
+  }
+}