Skip to content

Commit

Permalink
test: use midenc driver for non-cargo-based fixtures in
Browse files Browse the repository at this point in the history
integration tests
  • Loading branch information
greenhat committed May 4, 2024
1 parent e485804 commit 139fad4
Show file tree
Hide file tree
Showing 217 changed files with 2,181 additions and 46,196 deletions.
48 changes: 29 additions & 19 deletions frontend-wasm/tests/expected/add.hir
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
(module #noname
;; Constants
(const (id 0) 0x00100000)
(component
;; Modules
(module #test_rust_239a60d2cc893c838f4427eafefdb541ab7c907f4b97a510f3e3eef268518bea
;; Constants
(const (id 0) 0x00100000)

;; Global Variables
(global (export #__stack_pointer) (id 0) (type i32) (const 0))
(global (export #gv1) (id 1) (type i32) (const 0))
(global (export #gv2) (id 2) (type i32) (const 0))
;; Global Variables
(global (export #__stack_pointer) (id 0) (type i32) (const 0))
(global (export #gv1) (id 1) (type i32) (const 0))
(global (export #gv2) (id 2) (type i32) (const 0))

;; Functions
(func (export #__main) (result i32)
(block 0
(let (v1 i32) (const.i32 1))
(let (v2 i32) (const.i32 2))
(let (v3 i32) (call #add v1 v2))
(ret v3))
)
;; Functions
(func (export #add) (param i32) (param i32) (result i32)
(block 0 (param v0 i32) (param v1 i32)
(let (v3 i32) (add.wrapping v1 v0))
(br (block 1 v3)))

(block 1 (param v2 i32)
(ret v2))
)

(func (export #add) (param i32) (param i32) (result i32)
(block 0 (param v0 i32) (param v1 i32)
(let (v3 i32) (add.wrapping v1 v0))
(ret v3))
(func (export #__main) (result i32)
(block 0
(let (v1 i32) (const.i32 1))
(let (v2 i32) (const.i32 2))
(let (v3 i32) (call #add v1 v2))
(br (block 1 v3)))

(block 1 (param v0 i32)
(ret v0))
)
)

)
2 changes: 1 addition & 1 deletion frontend-wasm/tests/expected/add.wat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(module $239a60d2cc893c838f4427eafefdb541ab7c907f4b97a510f3e3eef268518bea.wasm
(module $test_rust_239a60d2cc893c838f4427eafefdb541ab7c907f4b97a510f3e3eef268518bea.wasm
(type (;0;) (func (param i32 i32) (result i32)))
(type (;1;) (func (result i32)))
(func $add (;0;) (type 0) (param i32 i32) (result i32)
Expand Down
123 changes: 68 additions & 55 deletions frontend-wasm/tests/expected/array.hir
Original file line number Diff line number Diff line change
@@ -1,58 +1,71 @@
(module #noname
;; Constants
(const (id 0) 0x00100000)
(const (id 1) 0x00100028)
(const (id 2) 0x00100030)

;; Global Variables
(global (export #__stack_pointer) (id 0) (type i32) (const 0))
(global (export #gv1) (id 1) (type i32) (const 1))
(global (export #gv2) (id 2) (type i32) (const 2))

;; Functions
(func (export #__main) (result i32)
(block 0
(let (v1 i32) (const.i32 1048576))
(let (v2 i32) (const.i32 5))
(let (v3 i32) (call #sum_arr v1 v2))
(let (v4 i32) (const.i32 1048596))
(let (v5 i32) (const.i32 5))
(let (v6 i32) (call #sum_arr v4 v5))
(let (v7 i32) (add.wrapping v3 v6))
(ret v7))
)
(component
;; Modules
(module #test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6
;; Data Segments
(data (mut) (offset 1048576) 0x0100000002000000030000000400000005000000060000000700000008000000090000000a000000)

;; Constants
(const (id 0) 0x00100000)
(const (id 1) 0x00100028)
(const (id 2) 0x00100030)

;; Global Variables
(global (export #__stack_pointer) (id 0) (type i32) (const 0))
(global (export #gv1) (id 1) (type i32) (const 1))
(global (export #gv2) (id 2) (type i32) (const 2))

;; Functions
(func (export #sum_arr) (param i32) (param i32) (result i32)
(block 0 (param v0 i32) (param v1 i32)
(let (v3 i32) (const.i32 0))
(let (v4 i32) (const.i32 0))
(let (v5 i1) (eq v1 0))
(let (v6 i32) (cast v5))
(let (v7 i1) (neq v6 0))
(condbr v7 (block 2 v4) (block 3)))

(block 1 (param v2 i32)
(ret v2))

(block 2 (param v20 i32)
(br (block 1 v20)))

(func (export #sum_arr) (param i32) (param i32) (result i32)
(block 0 (param v0 i32) (param v1 i32)
(let (v3 i32) (const.i32 0))
(let (v4 i32) (const.i32 0))
(let (v5 i1) (eq v1 0))
(let (v6 i32) (cast v5))
(let (v7 i1) (neq v6 0))
(condbr v7 (block 7) (block 3)))

(block 7
(ret v4))

(block 3
(br (block 4 v0 v4 v1)))

(block 4 (param v8 i32) (param v12 i32) (param v16 i32)
(let (v9 u32) (cast v8))
(let (v10 (ptr i32)) (inttoptr v9))
(let (v11 i32) (load v10))
(let (v13 i32) (add.wrapping v11 v12))
(let (v14 i32) (const.i32 4))
(let (v15 i32) (add.wrapping v8 v14))
(let (v17 i32) (const.i32 -1))
(let (v18 i32) (add.wrapping v16 v17))
(let (v19 i1) (neq v18 0))
(condbr v19 (block 8) (block 6)))

(block 8
(br (block 4 v15 v13 v18)))

(block 6
(ret v13))
(block 3
(br (block 4 v0 v4 v1)))

(block 4 (param v8 i32) (param v12 i32) (param v16 i32)
(let (v9 u32) (cast v8))
(let (v10 (ptr i32)) (inttoptr v9))
(let (v11 i32) (load v10))
(let (v13 i32) (add.wrapping v11 v12))
(let (v14 i32) (const.i32 4))
(let (v15 i32) (add.wrapping v8 v14))
(let (v17 i32) (const.i32 -1))
(let (v18 i32) (add.wrapping v16 v17))
(let (v19 i1) (neq v18 0))
(condbr v19 (block 4 v15 v13 v18) (block 6)))

(block 5
(br (block 2 v13)))

(block 6
(br (block 5)))
)

(func (export #__main) (result i32)
(block 0
(let (v1 i32) (const.i32 1048576))
(let (v2 i32) (const.i32 5))
(let (v3 i32) (call #sum_arr v1 v2))
(let (v4 i32) (const.i32 1048596))
(let (v5 i32) (const.i32 5))
(let (v6 i32) (call #sum_arr v4 v5))
(let (v7 i32) (add.wrapping v3 v6))
(br (block 1 v7)))

(block 1 (param v0 i32)
(ret v0))
)
)

)
2 changes: 1 addition & 1 deletion frontend-wasm/tests/expected/array.wat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(module $d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6.wasm
(module $test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6.wasm
(type (;0;) (func (param i32 i32) (result i32)))
(type (;1;) (func (result i32)))
(func $sum_arr (;0;) (type 0) (param i32 i32) (result i32)
Expand Down
111 changes: 61 additions & 50 deletions frontend-wasm/tests/expected/enum.hir
Original file line number Diff line number Diff line change
@@ -1,53 +1,64 @@
(module #noname
;; Constants
(const (id 0) 0x00100000)

;; Global Variables
(global (export #__stack_pointer) (id 0) (type i32) (const 0))
(global (export #gv1) (id 1) (type i32) (const 0))
(global (export #gv2) (id 2) (type i32) (const 0))

;; Functions
(func (export #__main) (result i32)
(block 0
(let (v1 i32) (const.i32 3))
(let (v2 i32) (const.i32 5))
(let (v3 i32) (const.i32 0))
(let (v4 i32) (call #match_enum v1 v2 v3))
(let (v5 i32) (const.i32 3))
(let (v6 i32) (const.i32 5))
(let (v7 i32) (const.i32 1))
(let (v8 i32) (call #match_enum v5 v6 v7))
(let (v9 i32) (add.wrapping v4 v8))
(let (v10 i32) (const.i32 3))
(let (v11 i32) (const.i32 5))
(let (v12 i32) (const.i32 2))
(let (v13 i32) (call #match_enum v10 v11 v12))
(let (v14 i32) (add.wrapping v9 v13))
(ret v14))
)
(component
;; Modules
(module #test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824
;; Constants
(const (id 0) 0x00100000)

;; Global Variables
(global (export #__stack_pointer) (id 0) (type i32) (const 0))
(global (export #gv1) (id 1) (type i32) (const 0))
(global (export #gv2) (id 2) (type i32) (const 0))

;; Functions
(func (export #match_enum)
(param i32) (param i32) (param i32) (result i32)
(block 0 (param v0 i32) (param v1 i32) (param v2 i32)
(let (v4 i32) (const.i32 255))
(let (v5 i32) (band v2 v4))
(let (v6 u32) (cast v5))
(switchv6
(0 . (block 4))
(1 . (block 3))
(2 . (block 2))
(_ . (block4))))

(block 1 (param v3 i32)
(ret v3))

(block 2
(let (v9 i32) (mul.wrapping v1 v0))
(br (block 1 v9)))

(func (export #match_enum) (param i32) (param i32) (param i32) (result i32)
(block 0 (param v0 i32) (param v1 i32) (param v2 i32)
(let (v4 i32) (const.i32 255))
(let (v5 i32) (band v2 v4))
(let (v6 u32) (cast v5))
(switchv6
(0 . (block 4))
(1 . (block 3))
(2 . (block 2))
(_ . (block4))))

(block 2
(let (v9 i32) (mul.wrapping v1 v0))
(ret v9))

(block 3
(let (v8 i32) (sub.wrapping v0 v1))
(ret v8))

(block 4
(let (v7 i32) (add.wrapping v1 v0))
(ret v7))
(block 3
(let (v8 i32) (sub.wrapping v0 v1))
(ret v8))

(block 4
(let (v7 i32) (add.wrapping v1 v0))
(ret v7))
)

(func (export #__main) (result i32)
(block 0
(let (v1 i32) (const.i32 3))
(let (v2 i32) (const.i32 5))
(let (v3 i32) (const.i32 0))
(let (v4 i32) (call #match_enum v1 v2 v3))
(let (v5 i32) (const.i32 3))
(let (v6 i32) (const.i32 5))
(let (v7 i32) (const.i32 1))
(let (v8 i32) (call #match_enum v5 v6 v7))
(let (v9 i32) (add.wrapping v4 v8))
(let (v10 i32) (const.i32 3))
(let (v11 i32) (const.i32 5))
(let (v12 i32) (const.i32 2))
(let (v13 i32) (call #match_enum v10 v11 v12))
(let (v14 i32) (add.wrapping v9 v13))
(br (block 1 v14)))

(block 1 (param v0 i32)
(ret v0))
)
)

)
2 changes: 1 addition & 1 deletion frontend-wasm/tests/expected/enum.wat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(module $f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824.wasm
(module $test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824.wasm
(type (;0;) (func (param i32 i32 i32) (result i32)))
(type (;1;) (func (result i32)))
(func $match_enum (;0;) (type 0) (param i32 i32 i32) (result i32)
Expand Down
Loading

0 comments on commit 139fad4

Please sign in to comment.