;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. ;; RUN: foreach %s %t wasm-opt --legalize-js-interface-minimally -S -o - | filecheck %s (module ;; CHECK: (type $0 (func (result i64))) ;; CHECK: (type $1 (func (param i32))) ;; CHECK: (type $2 (func (result i32))) ;; CHECK: (type $3 (func (param i64))) ;; CHECK: (type $4 (func (param i32 i32))) ;; CHECK: (import "env" "imported" (func $imported (result i64))) (import "env" "imported" (func $imported (result i64))) (import "env" "invoke_vj" (func $invoke_vj (param i64))) ;; CHECK: (import "env" "setTempRet0" (func $setTempRet0 (param i32))) ;; CHECK: (import "env" "invoke_vj" (func $legalimport$invoke_vj (param i32 i32))) ;; CHECK: (export "func" (func $func)) (export "func" (func $func)) (export "dynCall_foo" (func $dyn)) ;; CHECK: (export "dynCall_foo" (func $legalstub$dyn)) ;; CHECK: (func $func (result i64) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (call $imported) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $legalfunc$invoke_vj ;; CHECK-NEXT: (i64.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $func (result i64) (drop (call $imported)) (call $invoke_vj (i64.const 0)) (unreachable) ) ;; CHECK: (func $dyn (result i64) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (call $imported) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $dyn (result i64) (drop (call $imported)) (unreachable) ) ) ;; CHECK: (func $legalstub$dyn (result i32) ;; CHECK-NEXT: (local $0 i64) ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (call $dyn) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $setTempRet0 ;; CHECK-NEXT: (i32.wrap_i64 ;; CHECK-NEXT: (i64.shr_u ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (i64.const 32) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.wrap_i64 ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK: (func $legalfunc$invoke_vj (param $0 i64) ;; CHECK-NEXT: (call $legalimport$invoke_vj ;; CHECK-NEXT: (i32.wrap_i64 ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.wrap_i64 ;; CHECK-NEXT: (i64.shr_u ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (i64.const 32) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (module)