blob: 1f315cd2c6505a94d44a97d9d02365d6fd1bbee6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; NOTE: This test was ported using port_test.py and could be cleaned up.
;; RUN: foreach %s %t wasm-opt --flatten --local-cse -Os -S -o - | filecheck %s
(module
;; testcase from AssemblyScript
(func "div16_internal" (param $0 i32) (param $1 i32) (result i32)
(i32.add
(i32.xor
(i32.shr_s
(i32.shl
(local.get $0)
(i32.const 16)
)
(i32.const 16)
)
(i32.shr_s
(i32.shl
(local.get $1)
(i32.const 16)
)
(i32.const 16)
)
)
(i32.xor
(i32.shr_s
(i32.shl
(local.get $0)
(i32.const 16)
)
(i32.const 16)
)
(i32.shr_s
(i32.shl
(local.get $1)
(i32.const 16)
)
(i32.const 16)
)
)
)
)
)
;; CHECK: (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
;; CHECK: (export "div16_internal" (func $0))
;; CHECK: (func $0 (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32)
;; CHECK-NEXT: (i32.add
;; CHECK-NEXT: (local.tee $0
;; CHECK-NEXT: (i32.xor
;; CHECK-NEXT: (i32.shr_s
;; CHECK-NEXT: (i32.shl
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: (i32.const 16)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 16)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.shr_s
;; CHECK-NEXT: (i32.shl
;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: (i32.const 16)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 16)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
|