llvm.org GIT mirror llvm / de786c9
[WebAssembly] Rename setlocal to set_local to match the spec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249218 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 4 years ago
21 changed file(s) with 304 addition(s) and 304 deletion(s). Raw diff Collapse all Expand all
287287 if (NumDefs != 0) {
288288 const MachineOperand &MO = MI->getOperand(0);
289289 unsigned Reg = MO.getReg();
290 OS << "(setlocal @" << TargetRegisterInfo::virtReg2Index(Reg) << ' ';
290 OS << "(set_local @" << TargetRegisterInfo::virtReg2Index(Reg) << ' ';
291291 }
292292
293293 if (MI->getOpcode() == WebAssembly::COPY) {
1414
1515 ; CHECK-LABEL: (func $call_i32_nullary
1616 ; CHECK-NEXT: (result i32)
17 ; CHECK-NEXT: (setlocal @0 (call $i32_nullary))
17 ; CHECK-NEXT: (set_local @0 (call $i32_nullary))
1818 ; CHECK-NEXT: (return @0)
1919 define i32 @call_i32_nullary() {
2020 %r = call i32 @i32_nullary()
2323
2424 ; CHECK-LABEL: (func $call_i64_nullary
2525 ; CHECK-NEXT: (result i64)
26 ; CHECK-NEXT: (setlocal @0 (call $i64_nullary))
26 ; CHECK-NEXT: (set_local @0 (call $i64_nullary))
2727 ; CHECK-NEXT: (return @0)
2828 define i64 @call_i64_nullary() {
2929 %r = call i64 @i64_nullary()
3232
3333 ; CHECK-LABEL: (func $call_float_nullary
3434 ; CHECK-NEXT: (result f32)
35 ; CHECK-NEXT: (setlocal @0 (call $float_nullary))
35 ; CHECK-NEXT: (set_local @0 (call $float_nullary))
3636 ; CHECK-NEXT: (return @0)
3737 define float @call_float_nullary() {
3838 %r = call float @float_nullary()
4141
4242 ; CHECK-LABEL: (func $call_double_nullary
4343 ; CHECK-NEXT: (result f64)
44 ; CHECK-NEXT: (setlocal @0 (call $double_nullary))
44 ; CHECK-NEXT: (set_local @0 (call $double_nullary))
4545 ; CHECK-NEXT: (return @0)
4646 define double @call_double_nullary() {
4747 %r = call double @double_nullary()
5858
5959 ; CHECK-LABEL: (func $call_i32_unary
6060 ; CHECK-NEXT: (param i32) (result i32)
61 ; CHECK-NEXT: (setlocal @0 (argument 0))
62 ; CHECK-NEXT: (setlocal @1 (call $i32_unary @0))
61 ; CHECK-NEXT: (set_local @0 (argument 0))
62 ; CHECK-NEXT: (set_local @1 (call $i32_unary @0))
6363 ; CHECK-NEXT: (return @1)
6464 define i32 @call_i32_unary(i32 %a) {
6565 %r = call i32 @i32_unary(i32 %a)
6868
6969 ; CHECK-LABEL: (func $call_i32_binary
7070 ; CHECK-NEXT: (param i32) (param i32) (result i32)
71 ; CHECK-NEXT: (setlocal @0 (argument 1))
72 ; CHECK-NEXT: (setlocal @1 (argument 0))
73 ; CHECK-NEXT: (setlocal @2 (call $i32_binary @1 @0))
71 ; CHECK-NEXT: (set_local @0 (argument 1))
72 ; CHECK-NEXT: (set_local @1 (argument 0))
73 ; CHECK-NEXT: (set_local @2 (call $i32_binary @1 @0))
7474 ; CHECK-NEXT: (return @2)
7575 define i32 @call_i32_binary(i32 %a, i32 %b) {
7676 %r = call i32 @i32_binary(i32 %a, i32 %b)
7979
8080 ; CHECK-LABEL: (func $call_indirect_void
8181 ; CHECK-NEXT: (param i32)
82 ; CHECK-NEXT: (setlocal @0 (argument 0))
82 ; CHECK-NEXT: (set_local @0 (argument 0))
8383 ; CHECK-NEXT: (call_indirect @0)
8484 ; CHECK-NEXT: (return)
8585 define void @call_indirect_void(void ()* %callee) {
8989
9090 ; CHECK-LABEL: (func $call_indirect_i32
9191 ; CHECK-NEXT: (param i32)
92 ; CHECK-NEXT: (setlocal @0 (argument 0))
93 ; CHECK-NEXT: (setlocal @1 (call_indirect @0))
92 ; CHECK-NEXT: (set_local @0 (argument 0))
93 ; CHECK-NEXT: (set_local @1 (call_indirect @0))
9494 ; CHECK-NEXT: (return @1)
9595 define i32 @call_indirect_i32(i32 ()* %callee) {
9696 %t = call i32 %callee()
77
88 ; CHECK-LABEL: (func $ord_f32
99 ; CHECK-NEXT: (param f32) (param f32) (result i32)
10 ; CHECK-NEXT: (setlocal @0 (argument 0))
11 ; CHECK-NEXT: (setlocal @1 (argument 1))
12 ; CHECK-NEXT: (setlocal @2 (eq @1 @1))
13 ; CHECK-NEXT: (setlocal @3 (eq @0 @0))
14 ; CHECK-NEXT: (setlocal @4 (and @3 @2))
10 ; CHECK-NEXT: (set_local @0 (argument 0))
11 ; CHECK-NEXT: (set_local @1 (argument 1))
12 ; CHECK-NEXT: (set_local @2 (eq @1 @1))
13 ; CHECK-NEXT: (set_local @3 (eq @0 @0))
14 ; CHECK-NEXT: (set_local @4 (and @3 @2))
1515 ; CHECK-NEXT: (return @4)
1616 define i32 @ord_f32(float %x, float %y) {
1717 %a = fcmp ord float %x, %y
2121
2222 ; CHECK-LABEL: (func $uno_f32
2323 ; CHECK-NEXT: (param f32) (param f32) (result i32)
24 ; CHECK-NEXT: (setlocal @0 (argument 0))
25 ; CHECK-NEXT: (setlocal @1 (argument 1))
26 ; CHECK-NEXT: (setlocal @2 (ne @1 @1))
27 ; CHECK-NEXT: (setlocal @3 (ne @0 @0))
28 ; CHECK-NEXT: (setlocal @4 (ior @3 @2))
24 ; CHECK-NEXT: (set_local @0 (argument 0))
25 ; CHECK-NEXT: (set_local @1 (argument 1))
26 ; CHECK-NEXT: (set_local @2 (ne @1 @1))
27 ; CHECK-NEXT: (set_local @3 (ne @0 @0))
28 ; CHECK-NEXT: (set_local @4 (ior @3 @2))
2929 ; CHECK-NEXT: (return @4)
3030 define i32 @uno_f32(float %x, float %y) {
3131 %a = fcmp uno float %x, %y
3535
3636 ; CHECK-LABEL: (func $oeq_f32
3737 ; CHECK-NEXT: (param f32) (param f32) (result i32)
38 ; CHECK-NEXT: (setlocal @0 (argument 1))
39 ; CHECK-NEXT: (setlocal @1 (argument 0))
40 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
38 ; CHECK-NEXT: (set_local @0 (argument 1))
39 ; CHECK-NEXT: (set_local @1 (argument 0))
40 ; CHECK-NEXT: (set_local @2 (eq @1 @0))
4141 ; CHECK-NEXT: (return @2)
4242 define i32 @oeq_f32(float %x, float %y) {
4343 %a = fcmp oeq float %x, %y
4646 }
4747
4848 ; CHECK-LABEL: (func $une_f32
49 ; CHECK: (setlocal @2 (ne @1 @0))
49 ; CHECK: (set_local @2 (ne @1 @0))
5050 define i32 @une_f32(float %x, float %y) {
5151 %a = fcmp une float %x, %y
5252 %b = zext i1 %a to i32
5454 }
5555
5656 ; CHECK-LABEL: (func $olt_f32
57 ; CHECK: (setlocal @2 (lt @1 @0))
57 ; CHECK: (set_local @2 (lt @1 @0))
5858 define i32 @olt_f32(float %x, float %y) {
5959 %a = fcmp olt float %x, %y
6060 %b = zext i1 %a to i32
6262 }
6363
6464 ; CHECK-LABEL: (func $ole_f32
65 ; CHECK: (setlocal @2 (le @1 @0))
65 ; CHECK: (set_local @2 (le @1 @0))
6666 define i32 @ole_f32(float %x, float %y) {
6767 %a = fcmp ole float %x, %y
6868 %b = zext i1 %a to i32
7070 }
7171
7272 ; CHECK-LABEL: (func $ogt_f32
73 ; CHECK: (setlocal @2 (gt @1 @0))
73 ; CHECK: (set_local @2 (gt @1 @0))
7474 define i32 @ogt_f32(float %x, float %y) {
7575 %a = fcmp ogt float %x, %y
7676 %b = zext i1 %a to i32
7878 }
7979
8080 ; CHECK-LABEL: (func $oge_f32
81 ; CHECK: (setlocal @2 (ge @1 @0))
81 ; CHECK: (set_local @2 (ge @1 @0))
8282 define i32 @oge_f32(float %x, float %y) {
8383 %a = fcmp oge float %x, %y
8484 %b = zext i1 %a to i32
8989
9090 ; CHECK-LABEL: (func $ueq_f32
9191 ; CHECK-NEXT: (param f32) (param f32) (result i32)
92 ; CHECK-NEXT: (setlocal @0 (argument 1))
93 ; CHECK-NEXT: (setlocal @1 (argument 0))
94 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
95 ; CHECK-NEXT: (setlocal @3 (ne @0 @0))
96 ; CHECK-NEXT: (setlocal @4 (ne @1 @1))
97 ; CHECK-NEXT: (setlocal @5 (ior @4 @3))
98 ; CHECK-NEXT: (setlocal @6 (ior @2 @5))
92 ; CHECK-NEXT: (set_local @0 (argument 1))
93 ; CHECK-NEXT: (set_local @1 (argument 0))
94 ; CHECK-NEXT: (set_local @2 (eq @1 @0))
95 ; CHECK-NEXT: (set_local @3 (ne @0 @0))
96 ; CHECK-NEXT: (set_local @4 (ne @1 @1))
97 ; CHECK-NEXT: (set_local @5 (ior @4 @3))
98 ; CHECK-NEXT: (set_local @6 (ior @2 @5))
9999 ; CHECK-NEXT: (return @6)
100100 define i32 @ueq_f32(float %x, float %y) {
101101 %a = fcmp ueq float %x, %y
104104 }
105105
106106 ; CHECK-LABEL: (func $one_f32
107 ; CHECK: (setlocal @2 (ne @1 @0))
107 ; CHECK: (set_local @2 (ne @1 @0))
108108 define i32 @one_f32(float %x, float %y) {
109109 %a = fcmp one float %x, %y
110110 %b = zext i1 %a to i32
112112 }
113113
114114 ; CHECK-LABEL: (func $ult_f32
115 ; CHECK: (setlocal @2 (lt @1 @0))
115 ; CHECK: (set_local @2 (lt @1 @0))
116116 define i32 @ult_f32(float %x, float %y) {
117117 %a = fcmp ult float %x, %y
118118 %b = zext i1 %a to i32
120120 }
121121
122122 ; CHECK-LABEL: (func $ule_f32
123 ; CHECK: (setlocal @2 (le @1 @0))
123 ; CHECK: (set_local @2 (le @1 @0))
124124 define i32 @ule_f32(float %x, float %y) {
125125 %a = fcmp ule float %x, %y
126126 %b = zext i1 %a to i32
128128 }
129129
130130 ; CHECK-LABEL: (func $ugt_f32
131 ; CHECK: (setlocal @2 (gt @1 @0))
131 ; CHECK: (set_local @2 (gt @1 @0))
132132 define i32 @ugt_f32(float %x, float %y) {
133133 %a = fcmp ugt float %x, %y
134134 %b = zext i1 %a to i32
136136 }
137137
138138 ; CHECK-LABEL: (func $uge_f32
139 ; CHECK: (setlocal @2 (ge @1 @0))
139 ; CHECK: (set_local @2 (ge @1 @0))
140140 define i32 @uge_f32(float %x, float %y) {
141141 %a = fcmp uge float %x, %y
142142 %b = zext i1 %a to i32
77
88 ; CHECK-LABEL: (func $ord_f64
99 ; CHECK-NEXT: (param f64) (param f64) (result i32)
10 ; CHECK-NEXT: (setlocal @0 (argument 0))
11 ; CHECK-NEXT: (setlocal @1 (argument 1))
12 ; CHECK-NEXT: (setlocal @2 (eq @1 @1))
13 ; CHECK-NEXT: (setlocal @3 (eq @0 @0))
14 ; CHECK-NEXT: (setlocal @4 (and @3 @2))
10 ; CHECK-NEXT: (set_local @0 (argument 0))
11 ; CHECK-NEXT: (set_local @1 (argument 1))
12 ; CHECK-NEXT: (set_local @2 (eq @1 @1))
13 ; CHECK-NEXT: (set_local @3 (eq @0 @0))
14 ; CHECK-NEXT: (set_local @4 (and @3 @2))
1515 ; CHECK-NEXT: (return @4)
1616 define i32 @ord_f64(double %x, double %y) {
1717 %a = fcmp ord double %x, %y
2121
2222 ; CHECK-LABEL: (func $uno_f64
2323 ; CHECK-NEXT: (param f64) (param f64) (result i32)
24 ; CHECK-NEXT: (setlocal @0 (argument 0))
25 ; CHECK-NEXT: (setlocal @1 (argument 1))
26 ; CHECK-NEXT: (setlocal @2 (ne @1 @1))
27 ; CHECK-NEXT: (setlocal @3 (ne @0 @0))
28 ; CHECK-NEXT: (setlocal @4 (ior @3 @2))
24 ; CHECK-NEXT: (set_local @0 (argument 0))
25 ; CHECK-NEXT: (set_local @1 (argument 1))
26 ; CHECK-NEXT: (set_local @2 (ne @1 @1))
27 ; CHECK-NEXT: (set_local @3 (ne @0 @0))
28 ; CHECK-NEXT: (set_local @4 (ior @3 @2))
2929 ; CHECK-NEXT: (return @4)
3030 define i32 @uno_f64(double %x, double %y) {
3131 %a = fcmp uno double %x, %y
3535
3636 ; CHECK-LABEL: (func $oeq_f64
3737 ; CHECK-NEXT: (param f64) (param f64) (result i32)
38 ; CHECK-NEXT: (setlocal @0 (argument 1))
39 ; CHECK-NEXT: (setlocal @1 (argument 0))
40 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
38 ; CHECK-NEXT: (set_local @0 (argument 1))
39 ; CHECK-NEXT: (set_local @1 (argument 0))
40 ; CHECK-NEXT: (set_local @2 (eq @1 @0))
4141 ; CHECK-NEXT: (return @2)
4242 define i32 @oeq_f64(double %x, double %y) {
4343 %a = fcmp oeq double %x, %y
4646 }
4747
4848 ; CHECK-LABEL: (func $une_f64
49 ; CHECK: (setlocal @2 (ne @1 @0))
49 ; CHECK: (set_local @2 (ne @1 @0))
5050 define i32 @une_f64(double %x, double %y) {
5151 %a = fcmp une double %x, %y
5252 %b = zext i1 %a to i32
5454 }
5555
5656 ; CHECK-LABEL: (func $olt_f64
57 ; CHECK: (setlocal @2 (lt @1 @0))
57 ; CHECK: (set_local @2 (lt @1 @0))
5858 define i32 @olt_f64(double %x, double %y) {
5959 %a = fcmp olt double %x, %y
6060 %b = zext i1 %a to i32
6262 }
6363
6464 ; CHECK-LABEL: (func $ole_f64
65 ; CHECK: (setlocal @2 (le @1 @0))
65 ; CHECK: (set_local @2 (le @1 @0))
6666 define i32 @ole_f64(double %x, double %y) {
6767 %a = fcmp ole double %x, %y
6868 %b = zext i1 %a to i32
7070 }
7171
7272 ; CHECK-LABEL: (func $ogt_f64
73 ; CHECK: (setlocal @2 (gt @1 @0))
73 ; CHECK: (set_local @2 (gt @1 @0))
7474 define i32 @ogt_f64(double %x, double %y) {
7575 %a = fcmp ogt double %x, %y
7676 %b = zext i1 %a to i32
7878 }
7979
8080 ; CHECK-LABEL: (func $oge_f64
81 ; CHECK: (setlocal @2 (ge @1 @0))
81 ; CHECK: (set_local @2 (ge @1 @0))
8282 define i32 @oge_f64(double %x, double %y) {
8383 %a = fcmp oge double %x, %y
8484 %b = zext i1 %a to i32
8989
9090 ; CHECK-LABEL: (func $ueq_f64
9191 ; CHECK-NEXT: (param f64) (param f64) (result i32)
92 ; CHECK-NEXT: (setlocal @0 (argument 1))
93 ; CHECK-NEXT: (setlocal @1 (argument 0))
94 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
95 ; CHECK-NEXT: (setlocal @3 (ne @0 @0))
96 ; CHECK-NEXT: (setlocal @4 (ne @1 @1))
97 ; CHECK-NEXT: (setlocal @5 (ior @4 @3))
98 ; CHECK-NEXT: (setlocal @6 (ior @2 @5))
92 ; CHECK-NEXT: (set_local @0 (argument 1))
93 ; CHECK-NEXT: (set_local @1 (argument 0))
94 ; CHECK-NEXT: (set_local @2 (eq @1 @0))
95 ; CHECK-NEXT: (set_local @3 (ne @0 @0))
96 ; CHECK-NEXT: (set_local @4 (ne @1 @1))
97 ; CHECK-NEXT: (set_local @5 (ior @4 @3))
98 ; CHECK-NEXT: (set_local @6 (ior @2 @5))
9999 ; CHECK-NEXT: (return @6)
100100 define i32 @ueq_f64(double %x, double %y) {
101101 %a = fcmp ueq double %x, %y
104104 }
105105
106106 ; CHECK-LABEL: (func $one_f64
107 ; CHECK: (setlocal @2 (ne @1 @0))
107 ; CHECK: (set_local @2 (ne @1 @0))
108108 define i32 @one_f64(double %x, double %y) {
109109 %a = fcmp one double %x, %y
110110 %b = zext i1 %a to i32
112112 }
113113
114114 ; CHECK-LABEL: (func $ult_f64
115 ; CHECK: (setlocal @2 (lt @1 @0))
115 ; CHECK: (set_local @2 (lt @1 @0))
116116 define i32 @ult_f64(double %x, double %y) {
117117 %a = fcmp ult double %x, %y
118118 %b = zext i1 %a to i32
120120 }
121121
122122 ; CHECK-LABEL: (func $ule_f64
123 ; CHECK: (setlocal @2 (le @1 @0))
123 ; CHECK: (set_local @2 (le @1 @0))
124124 define i32 @ule_f64(double %x, double %y) {
125125 %a = fcmp ule double %x, %y
126126 %b = zext i1 %a to i32
128128 }
129129
130130 ; CHECK-LABEL: (func $ugt_f64
131 ; CHECK: (setlocal @2 (gt @1 @0))
131 ; CHECK: (set_local @2 (gt @1 @0))
132132 define i32 @ugt_f64(double %x, double %y) {
133133 %a = fcmp ugt double %x, %y
134134 %b = zext i1 %a to i32
136136 }
137137
138138 ; CHECK-LABEL: (func $uge_f64
139 ; CHECK: (setlocal @2 (ge @1 @0))
139 ; CHECK: (set_local @2 (ge @1 @0))
140140 define i32 @uge_f64(double %x, double %y) {
141141 %a = fcmp uge double %x, %y
142142 %b = zext i1 %a to i32
66
77 ; CHECK-LABEL: (func $eq_i32
88 ; CHECK-NEXT: (param i32) (param i32) (result i32)
9 ; CHECK-NEXT: (setlocal @0 (argument 1))
10 ; CHECK-NEXT: (setlocal @1 (argument 0))
11 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
9 ; CHECK-NEXT: (set_local @0 (argument 1))
10 ; CHECK-NEXT: (set_local @1 (argument 0))
11 ; CHECK-NEXT: (set_local @2 (eq @1 @0))
1212 ; CHECK-NEXT: (return @2)
1313 define i32 @eq_i32(i32 %x, i32 %y) {
1414 %a = icmp eq i32 %x, %y
1717 }
1818
1919 ; CHECK-LABEL: (func $ne_i32
20 ; CHECK: (setlocal @2 (ne @1 @0))
20 ; CHECK: (set_local @2 (ne @1 @0))
2121 define i32 @ne_i32(i32 %x, i32 %y) {
2222 %a = icmp ne i32 %x, %y
2323 %b = zext i1 %a to i32
2525 }
2626
2727 ; CHECK-LABEL: (func $slt_i32
28 ; CHECK: (setlocal @2 (slt @1 @0))
28 ; CHECK: (set_local @2 (slt @1 @0))
2929 define i32 @slt_i32(i32 %x, i32 %y) {
3030 %a = icmp slt i32 %x, %y
3131 %b = zext i1 %a to i32
3333 }
3434
3535 ; CHECK-LABEL: (func $sle_i32
36 ; CHECK: (setlocal @2 (sle @1 @0))
36 ; CHECK: (set_local @2 (sle @1 @0))
3737 define i32 @sle_i32(i32 %x, i32 %y) {
3838 %a = icmp sle i32 %x, %y
3939 %b = zext i1 %a to i32
4141 }
4242
4343 ; CHECK-LABEL: (func $ult_i32
44 ; CHECK: (setlocal @2 (ult @1 @0))
44 ; CHECK: (set_local @2 (ult @1 @0))
4545 define i32 @ult_i32(i32 %x, i32 %y) {
4646 %a = icmp ult i32 %x, %y
4747 %b = zext i1 %a to i32
4949 }
5050
5151 ; CHECK-LABEL: (func $ule_i32
52 ; CHECK: (setlocal @2 (ule @1 @0))
52 ; CHECK: (set_local @2 (ule @1 @0))
5353 define i32 @ule_i32(i32 %x, i32 %y) {
5454 %a = icmp ule i32 %x, %y
5555 %b = zext i1 %a to i32
5757 }
5858
5959 ; CHECK-LABEL: (func $sgt_i32
60 ; CHECK: (setlocal @2 (sgt @1 @0))
60 ; CHECK: (set_local @2 (sgt @1 @0))
6161 define i32 @sgt_i32(i32 %x, i32 %y) {
6262 %a = icmp sgt i32 %x, %y
6363 %b = zext i1 %a to i32
6565 }
6666
6767 ; CHECK-LABEL: (func $sge_i32
68 ; CHECK: (setlocal @2 (sge @1 @0))
68 ; CHECK: (set_local @2 (sge @1 @0))
6969 define i32 @sge_i32(i32 %x, i32 %y) {
7070 %a = icmp sge i32 %x, %y
7171 %b = zext i1 %a to i32
7373 }
7474
7575 ; CHECK-LABEL: (func $ugt_i32
76 ; CHECK: (setlocal @2 (ugt @1 @0))
76 ; CHECK: (set_local @2 (ugt @1 @0))
7777 define i32 @ugt_i32(i32 %x, i32 %y) {
7878 %a = icmp ugt i32 %x, %y
7979 %b = zext i1 %a to i32
8181 }
8282
8383 ; CHECK-LABEL: (func $uge_i32
84 ; CHECK: (setlocal @2 (uge @1 @0))
84 ; CHECK: (set_local @2 (uge @1 @0))
8585 define i32 @uge_i32(i32 %x, i32 %y) {
8686 %a = icmp uge i32 %x, %y
8787 %b = zext i1 %a to i32
66
77 ; CHECK-LABEL: (func $eq_i64
88 ; CHECK-NEXT: (param i64) (param i64) (result i32)
9 ; CHECK-NEXT: (setlocal @0 (argument 1))
10 ; CHECK-NEXT: (setlocal @1 (argument 0))
11 ; CHECK-NEXT: (setlocal @2 (eq @1 @0))
9 ; CHECK-NEXT: (set_local @0 (argument 1))
10 ; CHECK-NEXT: (set_local @1 (argument 0))
11 ; CHECK-NEXT: (set_local @2 (eq @1 @0))
1212 ; CHECK-NEXT: (return @2)
1313 define i32 @eq_i64(i64 %x, i64 %y) {
1414 %a = icmp eq i64 %x, %y
1717 }
1818
1919 ; CHECK-LABEL: (func $ne_i64
20 ; CHECK: (setlocal @2 (ne @1 @0))
20 ; CHECK: (set_local @2 (ne @1 @0))
2121 define i32 @ne_i64(i64 %x, i64 %y) {
2222 %a = icmp ne i64 %x, %y
2323 %b = zext i1 %a to i32
2525 }
2626
2727 ; CHECK-LABEL: (func $slt_i64
28 ; CHECK: (setlocal @2 (slt @1 @0))
28 ; CHECK: (set_local @2 (slt @1 @0))
2929 define i32 @slt_i64(i64 %x, i64 %y) {
3030 %a = icmp slt i64 %x, %y
3131 %b = zext i1 %a to i32
3333 }
3434
3535 ; CHECK-LABEL: (func $sle_i64
36 ; CHECK: (setlocal @2 (sle @1 @0))
36 ; CHECK: (set_local @2 (sle @1 @0))
3737 define i32 @sle_i64(i64 %x, i64 %y) {
3838 %a = icmp sle i64 %x, %y
3939 %b = zext i1 %a to i32
4141 }
4242
4343 ; CHECK-LABEL: (func $ult_i64
44 ; CHECK: (setlocal @2 (ult @1 @0))
44 ; CHECK: (set_local @2 (ult @1 @0))
4545 define i32 @ult_i64(i64 %x, i64 %y) {
4646 %a = icmp ult i64 %x, %y
4747 %b = zext i1 %a to i32
4949 }
5050
5151 ; CHECK-LABEL: (func $ule_i64
52 ; CHECK: (setlocal @2 (ule @1 @0))
52 ; CHECK: (set_local @2 (ule @1 @0))
5353 define i32 @ule_i64(i64 %x, i64 %y) {
5454 %a = icmp ule i64 %x, %y
5555 %b = zext i1 %a to i32
5757 }
5858
5959 ; CHECK-LABEL: (func $sgt_i64
60 ; CHECK: (setlocal @2 (sgt @1 @0))
60 ; CHECK: (set_local @2 (sgt @1 @0))
6161 define i32 @sgt_i64(i64 %x, i64 %y) {
6262 %a = icmp sgt i64 %x, %y
6363 %b = zext i1 %a to i32
6565 }
6666
6767 ; CHECK-LABEL: (func $sge_i64
68 ; CHECK: (setlocal @2 (sge @1 @0))
68 ; CHECK: (set_local @2 (sge @1 @0))
6969 define i32 @sge_i64(i64 %x, i64 %y) {
7070 %a = icmp sge i64 %x, %y
7171 %b = zext i1 %a to i32
7373 }
7474
7575 ; CHECK-LABEL: (func $ugt_i64
76 ; CHECK: (setlocal @2 (ugt @1 @0))
76 ; CHECK: (set_local @2 (ugt @1 @0))
7777 define i32 @ugt_i64(i64 %x, i64 %y) {
7878 %a = icmp ugt i64 %x, %y
7979 %b = zext i1 %a to i32
8181 }
8282
8383 ; CHECK-LABEL: (func $uge_i64
84 ; CHECK: (setlocal @2 (uge @1 @0))
84 ; CHECK: (set_local @2 (uge @1 @0))
8585 define i32 @uge_i64(i64 %x, i64 %y) {
8686 %a = icmp uge i64 %x, %y
8787 %b = zext i1 %a to i32
66
77 ; CHECK-LABEL: $wrap_i64_i32
88 ; CHECK-NEXT: (param i64) (result i32)
9 ; CHECK-NEXT: (setlocal @0 (argument 0))
10 ; CHECK-NEXT: (setlocal @1 (wrap_i64 @0))
9 ; CHECK-NEXT: (set_local @0 (argument 0))
10 ; CHECK-NEXT: (set_local @1 (wrap_i64 @0))
1111 ; CHECK-NEXT: (return @1)
1212 define i32 @wrap_i64_i32(i64 %x) {
1313 %a = trunc i64 %x to i32
1515
1616 ; CHECK-LABEL: (func $fadd32
1717 ; CHECK-NEXT: (param f32) (param f32) (result f32)
18 ; CHECK-NEXT: (setlocal @0 (argument 1))
19 ; CHECK-NEXT: (setlocal @1 (argument 0))
20 ; CHECK-NEXT: (setlocal @2 (fadd @1 @0))
18 ; CHECK-NEXT: (set_local @0 (argument 1))
19 ; CHECK-NEXT: (set_local @1 (argument 0))
20 ; CHECK-NEXT: (set_local @2 (fadd @1 @0))
2121 ; CHECK-NEXT: (return @2)
2222 define float @fadd32(float %x, float %y) {
2323 %a = fadd float %x, %y
2525 }
2626
2727 ; CHECK-LABEL: (func $fsub32
28 ; CHECK: (setlocal @2 (fsub @1 @0))
28 ; CHECK: (set_local @2 (fsub @1 @0))
2929 define float @fsub32(float %x, float %y) {
3030 %a = fsub float %x, %y
3131 ret float %a
3232 }
3333
3434 ; CHECK-LABEL: (func $fmul32
35 ; CHECK: (setlocal @2 (fmul @1 @0))
35 ; CHECK: (set_local @2 (fmul @1 @0))
3636 define float @fmul32(float %x, float %y) {
3737 %a = fmul float %x, %y
3838 ret float %a
3939 }
4040
4141 ; CHECK-LABEL: (func $fdiv32
42 ; CHECK: (setlocal @2 (fdiv @1 @0))
42 ; CHECK: (set_local @2 (fdiv @1 @0))
4343 define float @fdiv32(float %x, float %y) {
4444 %a = fdiv float %x, %y
4545 ret float %a
4646 }
4747
4848 ; CHECK-LABEL: (func $fabs32
49 ; CHECK: (setlocal @1 (fabs @0))
49 ; CHECK: (set_local @1 (fabs @0))
5050 define float @fabs32(float %x) {
5151 %a = call float @llvm.fabs.f32(float %x)
5252 ret float %a
5353 }
5454
5555 ; CHECK-LABEL: (func $fneg32
56 ; CHECK: (setlocal @1 (fneg @0))
56 ; CHECK: (set_local @1 (fneg @0))
5757 define float @fneg32(float %x) {
5858 %a = fsub float -0., %x
5959 ret float %a
6060 }
6161
6262 ; CHECK-LABEL: (func $copysign32
63 ; CHECK: (setlocal @2 (copysign @1 @0))
63 ; CHECK: (set_local @2 (copysign @1 @0))
6464 define float @copysign32(float %x, float %y) {
6565 %a = call float @llvm.copysign.f32(float %x, float %y)
6666 ret float %a
6767 }
6868
6969 ; CHECK-LABEL: (func $sqrt32
70 ; CHECK: (setlocal @1 (sqrt @0))
70 ; CHECK: (set_local @1 (sqrt @0))
7171 define float @sqrt32(float %x) {
7272 %a = call float @llvm.sqrt.f32(float %x)
7373 ret float %a
7474 }
7575
7676 ; CHECK-LABEL: (func $ceil32
77 ; CHECK: (setlocal @1 (ceil @0))
77 ; CHECK: (set_local @1 (ceil @0))
7878 define float @ceil32(float %x) {
7979 %a = call float @llvm.ceil.f32(float %x)
8080 ret float %a
8181 }
8282
8383 ; CHECK-LABEL: (func $floor32
84 ; CHECK: (setlocal @1 (floor @0))
84 ; CHECK: (set_local @1 (floor @0))
8585 define float @floor32(float %x) {
8686 %a = call float @llvm.floor.f32(float %x)
8787 ret float %a
8888 }
8989
9090 ; CHECK-LABEL: (func $trunc32
91 ; CHECK: (setlocal @1 (trunc @0))
91 ; CHECK: (set_local @1 (trunc @0))
9292 define float @trunc32(float %x) {
9393 %a = call float @llvm.trunc.f32(float %x)
9494 ret float %a
9595 }
9696
9797 ; CHECK-LABEL: (func $nearest32
98 ; CHECK: (setlocal @1 (nearest @0))
98 ; CHECK: (set_local @1 (nearest @0))
9999 define float @nearest32(float %x) {
100100 %a = call float @llvm.nearbyint.f32(float %x)
101101 ret float %a
102102 }
103103
104104 ; CHECK-LABEL: (func $nearest32_via_rint
105 ; CHECK: (setlocal @1 (nearest @0))
105 ; CHECK: (set_local @1 (nearest @0))
106106 define float @nearest32_via_rint(float %x) {
107107 %a = call float @llvm.rint.f32(float %x)
108108 ret float %a
1515
1616 ; CHECK-LABEL: (func $fadd64
1717 ; CHECK-NEXT: (param f64) (param f64) (result f64)
18 ; CHECK-NEXT: (setlocal @0 (argument 1))
19 ; CHECK-NEXT: (setlocal @1 (argument 0))
20 ; CHECK-NEXT: (setlocal @2 (fadd @1 @0))
18 ; CHECK-NEXT: (set_local @0 (argument 1))
19 ; CHECK-NEXT: (set_local @1 (argument 0))
20 ; CHECK-NEXT: (set_local @2 (fadd @1 @0))
2121 ; CHECK-NEXT: (return @2)
2222 define double @fadd64(double %x, double %y) {
2323 %a = fadd double %x, %y
2525 }
2626
2727 ; CHECK-LABEL: (func $fsub64
28 ; CHECK: (setlocal @2 (fsub @1 @0))
28 ; CHECK: (set_local @2 (fsub @1 @0))
2929 define double @fsub64(double %x, double %y) {
3030 %a = fsub double %x, %y
3131 ret double %a
3232 }
3333
3434 ; CHECK-LABEL: (func $fmul64
35 ; CHECK: (setlocal @2 (fmul @1 @0))
35 ; CHECK: (set_local @2 (fmul @1 @0))
3636 define double @fmul64(double %x, double %y) {
3737 %a = fmul double %x, %y
3838 ret double %a
3939 }
4040
4141 ; CHECK-LABEL: (func $fdiv64
42 ; CHECK: (setlocal @2 (fdiv @1 @0))
42 ; CHECK: (set_local @2 (fdiv @1 @0))
4343 define double @fdiv64(double %x, double %y) {
4444 %a = fdiv double %x, %y
4545 ret double %a
4646 }
4747
4848 ; CHECK-LABEL: (func $fabs64
49 ; CHECK: (setlocal @1 (fabs @0))
49 ; CHECK: (set_local @1 (fabs @0))
5050 define double @fabs64(double %x) {
5151 %a = call double @llvm.fabs.f64(double %x)
5252 ret double %a
5353 }
5454
5555 ; CHECK-LABEL: (func $fneg64
56 ; CHECK: (setlocal @1 (fneg @0))
56 ; CHECK: (set_local @1 (fneg @0))
5757 define double @fneg64(double %x) {
5858 %a = fsub double -0., %x
5959 ret double %a
6060 }
6161
6262 ; CHECK-LABEL: (func $copysign64
63 ; CHECK: (setlocal @2 (copysign @1 @0))
63 ; CHECK: (set_local @2 (copysign @1 @0))
6464 define double @copysign64(double %x, double %y) {
6565 %a = call double @llvm.copysign.f64(double %x, double %y)
6666 ret double %a
6767 }
6868
6969 ; CHECK-LABEL: (func $sqrt64
70 ; CHECK: (setlocal @1 (sqrt @0))
70 ; CHECK: (set_local @1 (sqrt @0))
7171 define double @sqrt64(double %x) {
7272 %a = call double @llvm.sqrt.f64(double %x)
7373 ret double %a
7474 }
7575
7676 ; CHECK-LABEL: (func $ceil64
77 ; CHECK: (setlocal @1 (ceil @0))
77 ; CHECK: (set_local @1 (ceil @0))
7878 define double @ceil64(double %x) {
7979 %a = call double @llvm.ceil.f64(double %x)
8080 ret double %a
8181 }
8282
8383 ; CHECK-LABEL: (func $floor64
84 ; CHECK: (setlocal @1 (floor @0))
84 ; CHECK: (set_local @1 (floor @0))
8585 define double @floor64(double %x) {
8686 %a = call double @llvm.floor.f64(double %x)
8787 ret double %a
8888 }
8989
9090 ; CHECK-LABEL: (func $trunc64
91 ; CHECK: (setlocal @1 (trunc @0))
91 ; CHECK: (set_local @1 (trunc @0))
9292 define double @trunc64(double %x) {
9393 %a = call double @llvm.trunc.f64(double %x)
9494 ret double %a
9595 }
9696
9797 ; CHECK-LABEL: (func $nearest64
98 ; CHECK: (setlocal @1 (nearest @0))
98 ; CHECK: (set_local @1 (nearest @0))
9999 define double @nearest64(double %x) {
100100 %a = call double @llvm.nearbyint.f64(double %x)
101101 ret double %a
102102 }
103103
104104 ; CHECK-LABEL: (func $nearest64_via_rint
105 ; CHECK: (setlocal @1 (nearest @0))
105 ; CHECK: (set_local @1 (nearest @0))
106106 define double @nearest64_via_rint(double %x) {
107107 %a = call double @llvm.rint.f64(double %x)
108108 ret double %a
1313
1414 ; CHECK-LABEL: (func $f1{{$}}
1515 ; CHECK-NEXT: (result i32){{$}}
16 ; CHECK-NEXT: (setlocal @0 (immediate 0)){{$}}
16 ; CHECK-NEXT: (set_local @0 (immediate 0)){{$}}
1717 ; CHECK-NEXT: (return @0){{$}}
1818 ; CHECK-NEXT: ) ;; end func $f1{{$}}
1919 define i32 @f1() {
2222
2323 ; CHECK-LABEL: (func $f2{{$}}
2424 ; CHECK-NEXT: (param i32) (param f32) (result i32){{$}}
25 ; CHECK-NEXT: (setlocal @0 (immediate 0)){{$}}
25 ; CHECK-NEXT: (set_local @0 (immediate 0)){{$}}
2626 ; CHECK-NEXT: (return @0){{$}}
2727 ; CHECK-NEXT: ) ;; end func $f2{{$}}
2828 define i32 @f2(i32 %p1, float %p2) {
1010
1111 ; CHECK-LABEL: (func $add32
1212 ; CHECK-NEXT: (param i32) (param i32) (result i32)
13 ; CHECK-NEXT: (setlocal @0 (argument 1))
14 ; CHECK-NEXT: (setlocal @1 (argument 0))
15 ; CHECK-NEXT: (setlocal @2 (add @1 @0))
13 ; CHECK-NEXT: (set_local @0 (argument 1))
14 ; CHECK-NEXT: (set_local @1 (argument 0))
15 ; CHECK-NEXT: (set_local @2 (add @1 @0))
1616 ; CHECK-NEXT: (return @2)
1717 define i32 @add32(i32 %x, i32 %y) {
1818 %a = add i32 %x, %y
2121
2222 ; CHECK-LABEL: (func $sub32
2323 ; CHECK-NEXT: (param i32) (param i32) (result i32)
24 ; CHECK-NEXT: (setlocal @0 (argument 1))
25 ; CHECK-NEXT: (setlocal @1 (argument 0))
26 ; CHECK-NEXT: (setlocal @2 (sub @1 @0))
24 ; CHECK-NEXT: (set_local @0 (argument 1))
25 ; CHECK-NEXT: (set_local @1 (argument 0))
26 ; CHECK-NEXT: (set_local @2 (sub @1 @0))
2727 ; CHECK-NEXT: (return @2)
2828 define i32 @sub32(i32 %x, i32 %y) {
2929 %a = sub i32 %x, %y
3232
3333 ; CHECK-LABEL: (func $mul32
3434 ; CHECK-NEXT: (param i32) (param i32) (result i32)
35 ; CHECK-NEXT: (setlocal @0 (argument 1))
36 ; CHECK-NEXT: (setlocal @1 (argument 0))
37 ; CHECK-NEXT: (setlocal @2 (mul @1 @0))
35 ; CHECK-NEXT: (set_local @0 (argument 1))
36 ; CHECK-NEXT: (set_local @1 (argument 0))
37 ; CHECK-NEXT: (set_local @2 (mul @1 @0))
3838 ; CHECK-NEXT: (return @2)
3939 define i32 @mul32(i32 %x, i32 %y) {
4040 %a = mul i32 %x, %y
4343
4444 ; CHECK-LABEL: (func $sdiv32
4545 ; CHECK-NEXT: (param i32) (param i32) (result i32)
46 ; CHECK-NEXT: (setlocal @0 (argument 1))
47 ; CHECK-NEXT: (setlocal @1 (argument 0))
48 ; CHECK-NEXT: (setlocal @2 (sdiv @1 @0))
46 ; CHECK-NEXT: (set_local @0 (argument 1))
47 ; CHECK-NEXT: (set_local @1 (argument 0))
48 ; CHECK-NEXT: (set_local @2 (sdiv @1 @0))
4949 ; CHECK-NEXT: (return @2)
5050 define i32 @sdiv32(i32 %x, i32 %y) {
5151 %a = sdiv i32 %x, %y
5454
5555 ; CHECK-LABEL: (func $udiv32
5656 ; CHECK-NEXT: (param i32) (param i32) (result i32)
57 ; CHECK-NEXT: (setlocal @0 (argument 1))
58 ; CHECK-NEXT: (setlocal @1 (argument 0))
59 ; CHECK-NEXT: (setlocal @2 (udiv @1 @0))
57 ; CHECK-NEXT: (set_local @0 (argument 1))
58 ; CHECK-NEXT: (set_local @1 (argument 0))
59 ; CHECK-NEXT: (set_local @2 (udiv @1 @0))
6060 ; CHECK-NEXT: (return @2)
6161 define i32 @udiv32(i32 %x, i32 %y) {
6262 %a = udiv i32 %x, %y
6565
6666 ; CHECK-LABEL: (func $srem32
6767 ; CHECK-NEXT: (param i32) (param i32) (result i32)
68 ; CHECK-NEXT: (setlocal @0 (argument 1))
69 ; CHECK-NEXT: (setlocal @1 (argument 0))
70 ; CHECK-NEXT: (setlocal @2 (srem @1 @0))
68 ; CHECK-NEXT: (set_local @0 (argument 1))
69 ; CHECK-NEXT: (set_local @1 (argument 0))
70 ; CHECK-NEXT: (set_local @2 (srem @1 @0))
7171 ; CHECK-NEXT: (return @2)
7272 define i32 @srem32(i32 %x, i32 %y) {
7373 %a = srem i32 %x, %y
7676
7777 ; CHECK-LABEL: (func $urem32
7878 ; CHECK-NEXT: (param i32) (param i32) (result i32)
79 ; CHECK-NEXT: (setlocal @0 (argument 1))
80 ; CHECK-NEXT: (setlocal @1 (argument 0))
81 ; CHECK-NEXT: (setlocal @2 (urem @1 @0))
79 ; CHECK-NEXT: (set_local @0 (argument 1))
80 ; CHECK-NEXT: (set_local @1 (argument 0))
81 ; CHECK-NEXT: (set_local @2 (urem @1 @0))
8282 ; CHECK-NEXT: (return @2)
8383 define i32 @urem32(i32 %x, i32 %y) {
8484 %a = urem i32 %x, %y
8787
8888 ; CHECK-LABEL: (func $and32
8989 ; CHECK-NEXT: (param i32) (param i32) (result i32)
90 ; CHECK-NEXT: (setlocal @0 (argument 1))
91 ; CHECK-NEXT: (setlocal @1 (argument 0))
92 ; CHECK-NEXT: (setlocal @2 (and @1 @0))
90 ; CHECK-NEXT: (set_local @0 (argument 1))
91 ; CHECK-NEXT: (set_local @1 (argument 0))
92 ; CHECK-NEXT: (set_local @2 (and @1 @0))
9393 ; CHECK-NEXT: (return @2)
9494 define i32 @and32(i32 %x, i32 %y) {
9595 %a = and i32 %x, %y
9898
9999 ; CHECK-LABEL: (func $ior32
100100 ; CHECK-NEXT: (param i32) (param i32) (result i32)
101 ; CHECK-NEXT: (setlocal @0 (argument 1))
102 ; CHECK-NEXT: (setlocal @1 (argument 0))
103 ; CHECK-NEXT: (setlocal @2 (ior @1 @0))
101 ; CHECK-NEXT: (set_local @0 (argument 1))
102 ; CHECK-NEXT: (set_local @1 (argument 0))
103 ; CHECK-NEXT: (set_local @2 (ior @1 @0))
104104 ; CHECK-NEXT: (return @2)
105105 define i32 @ior32(i32 %x, i32 %y) {
106106 %a = or i32 %x, %y
109109
110110 ; CHECK-LABEL: (func $xor32
111111 ; CHECK-NEXT: (param i32) (param i32) (result i32)
112 ; CHECK-NEXT: (setlocal @0 (argument 1))
113 ; CHECK-NEXT: (setlocal @1 (argument 0))
114 ; CHECK-NEXT: (setlocal @2 (xor @1 @0))
112 ; CHECK-NEXT: (set_local @0 (argument 1))
113 ; CHECK-NEXT: (set_local @1 (argument 0))
114 ; CHECK-NEXT: (set_local @2 (xor @1 @0))
115115 ; CHECK-NEXT: (return @2)
116116 define i32 @xor32(i32 %x, i32 %y) {
117117 %a = xor i32 %x, %y
120120
121121 ; CHECK-LABEL: (func $shl32
122122 ; CHECK-NEXT: (param i32) (param i32) (result i32)
123 ; CHECK-NEXT: (setlocal @0 (argument 1))
124 ; CHECK-NEXT: (setlocal @1 (argument 0))
125 ; CHECK-NEXT: (setlocal @2 (shl @1 @0))
123 ; CHECK-NEXT: (set_local @0 (argument 1))
124 ; CHECK-NEXT: (set_local @1 (argument 0))
125 ; CHECK-NEXT: (set_local @2 (shl @1 @0))
126126 ; CHECK-NEXT: (return @2)
127127 define i32 @shl32(i32 %x, i32 %y) {
128128 %a = shl i32 %x, %y
131131
132132 ; CHECK-LABEL: (func $shr32
133133 ; CHECK-NEXT: (param i32) (param i32) (result i32)
134 ; CHECK-NEXT: (setlocal @0 (argument 1))
135 ; CHECK-NEXT: (setlocal @1 (argument 0))
136 ; CHECK-NEXT: (setlocal @2 (shr_u @1 @0))
134 ; CHECK-NEXT: (set_local @0 (argument 1))
135 ; CHECK-NEXT: (set_local @1 (argument 0))
136 ; CHECK-NEXT: (set_local @2 (shr_u @1 @0))
137137 ; CHECK-NEXT: (return @2)
138138 define i32 @shr32(i32 %x, i32 %y) {
139139 %a = lshr i32 %x, %y
142142
143143 ; CHECK-LABEL: (func $sar32
144144 ; CHECK-NEXT: (param i32) (param i32) (result i32)
145 ; CHECK-NEXT: (setlocal @0 (argument 1))
146 ; CHECK-NEXT: (setlocal @1 (argument 0))
147 ; CHECK-NEXT: (setlocal @2 (shr_s @1 @0))
145 ; CHECK-NEXT: (set_local @0 (argument 1))
146 ; CHECK-NEXT: (set_local @1 (argument 0))
147 ; CHECK-NEXT: (set_local @2 (shr_s @1 @0))
148148 ; CHECK-NEXT: (return @2)
149149 define i32 @sar32(i32 %x, i32 %y) {
150150 %a = ashr i32 %x, %y
153153
154154 ; CHECK-LABEL: (func $clz32
155155 ; CHECK-NEXT: (param i32) (result i32)
156 ; CHECK-NEXT: (setlocal @0 (argument 0))
157 ; CHECK-NEXT: (setlocal @1 (clz @0))
156 ; CHECK-NEXT: (set_local @0 (argument 0))
157 ; CHECK-NEXT: (set_local @1 (clz @0))
158158 ; CHECK-NEXT: (return @1)
159159 define i32 @clz32(i32 %x) {
160160 %a = call i32 @llvm.ctlz.i32(i32 %x, i1 false)
163163
164164 ; CHECK-LABEL: (func $clz32_zero_undef
165165 ; CHECK-NEXT: (param i32) (result i32)
166 ; CHECK-NEXT: (setlocal @0 (argument 0))
167 ; CHECK-NEXT: (setlocal @1 (clz @0))
166 ; CHECK-NEXT: (set_local @0 (argument 0))
167 ; CHECK-NEXT: (set_local @1 (clz @0))
168168 ; CHECK-NEXT: (return @1)
169169 define i32 @clz32_zero_undef(i32 %x) {
170170 %a = call i32 @llvm.ctlz.i32(i32 %x, i1 true)
173173
174174 ; CHECK-LABEL: (func $ctz32
175175 ; CHECK-NEXT: (param i32) (result i32)
176 ; CHECK-NEXT: (setlocal @0 (argument 0))
177 ; CHECK-NEXT: (setlocal @1 (ctz @0))
176 ; CHECK-NEXT: (set_local @0 (argument 0))
177 ; CHECK-NEXT: (set_local @1 (ctz @0))
178178 ; CHECK-NEXT: (return @1)
179179 define i32 @ctz32(i32 %x) {
180180 %a = call i32 @llvm.cttz.i32(i32 %x, i1 false)
183183
184184 ; CHECK-LABEL: (func $ctz32_zero_undef
185185 ; CHECK-NEXT: (param i32) (result i32)
186 ; CHECK-NEXT: (setlocal @0 (argument 0))
187 ; CHECK-NEXT: (setlocal @1 (ctz @0))
186 ; CHECK-NEXT: (set_local @0 (argument 0))
187 ; CHECK-NEXT: (set_local @1 (ctz @0))
188188 ; CHECK-NEXT: (return @1)
189189 define i32 @ctz32_zero_undef(i32 %x) {
190190 %a = call i32 @llvm.cttz.i32(i32 %x, i1 true)
193193
194194 ; CHECK-LABEL: (func $popcnt32
195195 ; CHECK-NEXT: (param i32) (result i32)
196 ; CHECK-NEXT: (setlocal @0 (argument 0))
197 ; CHECK-NEXT: (setlocal @1 (popcnt @0))
196 ; CHECK-NEXT: (set_local @0 (argument 0))
197 ; CHECK-NEXT: (set_local @1 (popcnt @0))
198198 ; CHECK-NEXT: (return @1)
199199 define i32 @popcnt32(i32 %x) {
200200 %a = call i32 @llvm.ctpop.i32(i32 %x)
1010
1111 ; CHECK-LABEL: (func $add64
1212 ; CHECK-NEXT: (param i64) (param i64) (result i64)
13 ; CHECK-NEXT: (setlocal @0 (argument 1))
14 ; CHECK-NEXT: (setlocal @1 (argument 0))
15 ; CHECK-NEXT: (setlocal @2 (add @1 @0))
13 ; CHECK-NEXT: (set_local @0 (argument 1))
14 ; CHECK-NEXT: (set_local @1 (argument 0))
15 ; CHECK-NEXT: (set_local @2 (add @1 @0))
1616 ; CHECK-NEXT: (return @2)
1717 define i64 @add64(i64 %x, i64 %y) {
1818 %a = add i64 %x, %y
2121
2222 ; CHECK-LABEL: (func $sub64
2323 ; CHECK-NEXT: (param i64) (param i64) (result i64)
24 ; CHECK-NEXT: (setlocal @0 (argument 1))
25 ; CHECK-NEXT: (setlocal @1 (argument 0))
26 ; CHECK-NEXT: (setlocal @2 (sub @1 @0))
24 ; CHECK-NEXT: (set_local @0 (argument 1))
25 ; CHECK-NEXT: (set_local @1 (argument 0))
26 ; CHECK-NEXT: (set_local @2 (sub @1 @0))
2727 ; CHECK-NEXT: (return @2)
2828 define i64 @sub64(i64 %x, i64 %y) {
2929 %a = sub i64 %x, %y
3232
3333 ; CHECK-LABEL: (func $mul64
3434 ; CHECK-NEXT: (param i64) (param i64) (result i64)
35 ; CHECK-NEXT: (setlocal @0 (argument 1))
36 ; CHECK-NEXT: (setlocal @1 (argument 0))
37 ; CHECK-NEXT: (setlocal @2 (mul @1 @0))
35 ; CHECK-NEXT: (set_local @0 (argument 1))
36 ; CHECK-NEXT: (set_local @1 (argument 0))
37 ; CHECK-NEXT: (set_local @2 (mul @1 @0))
3838 ; CHECK-NEXT: (return @2)
3939 define i64 @mul64(i64 %x, i64 %y) {
4040 %a = mul i64 %x, %y
4343
4444 ; CHECK-LABEL: (func $sdiv64
4545 ; CHECK-NEXT: (param i64) (param i64) (result i64)
46 ; CHECK-NEXT: (setlocal @0 (argument 1))
47 ; CHECK-NEXT: (setlocal @1 (argument 0))
48 ; CHECK-NEXT: (setlocal @2 (sdiv @1 @0))
46 ; CHECK-NEXT: (set_local @0 (argument 1))
47 ; CHECK-NEXT: (set_local @1 (argument 0))
48 ; CHECK-NEXT: (set_local @2 (sdiv @1 @0))
4949 ; CHECK-NEXT: (return @2)
5050 define i64 @sdiv64(i64 %x, i64 %y) {
5151 %a = sdiv i64 %x, %y
5454
5555 ; CHECK-LABEL: (func $udiv64
5656 ; CHECK-NEXT: (param i64) (param i64) (result i64)
57 ; CHECK-NEXT: (setlocal @0 (argument 1))
58 ; CHECK-NEXT: (setlocal @1 (argument 0))
59 ; CHECK-NEXT: (setlocal @2 (udiv @1 @0))
57 ; CHECK-NEXT: (set_local @0 (argument 1))
58 ; CHECK-NEXT: (set_local @1 (argument 0))
59 ; CHECK-NEXT: (set_local @2 (udiv @1 @0))
6060 ; CHECK-NEXT: (return @2)
6161 define i64 @udiv64(i64 %x, i64 %y) {
6262 %a = udiv i64 %x, %y
6565
6666 ; CHECK-LABEL: (func $srem64
6767 ; CHECK-NEXT: (param i64) (param i64) (result i64)
68 ; CHECK-NEXT: (setlocal @0 (argument 1))
69 ; CHECK-NEXT: (setlocal @1 (argument 0))
70 ; CHECK-NEXT: (setlocal @2 (srem @1 @0))
68 ; CHECK-NEXT: (set_local @0 (argument 1))
69 ; CHECK-NEXT: (set_local @1 (argument 0))
70 ; CHECK-NEXT: (set_local @2 (srem @1 @0))
7171 ; CHECK-NEXT: (return @2)
7272 define i64 @srem64(i64 %x, i64 %y) {
7373 %a = srem i64 %x, %y
7676
7777 ; CHECK-LABEL: (func $urem64
7878 ; CHECK-NEXT: (param i64) (param i64) (result i64)
79 ; CHECK-NEXT: (setlocal @0 (argument 1))
80 ; CHECK-NEXT: (setlocal @1 (argument 0))
81 ; CHECK-NEXT: (setlocal @2 (urem @1 @0))
79 ; CHECK-NEXT: (set_local @0 (argument 1))
80 ; CHECK-NEXT: (set_local @1 (argument 0))
81 ; CHECK-NEXT: (set_local @2 (urem @1 @0))
8282 ; CHECK-NEXT: (return @2)
8383 define i64 @urem64(i64 %x, i64 %y) {
8484 %a = urem i64 %x, %y
8787
8888 ; CHECK-LABEL: (func $and64
8989 ; CHECK-NEXT: (param i64) (param i64) (result i64)
90 ; CHECK-NEXT: (setlocal @0 (argument 1))
91 ; CHECK-NEXT: (setlocal @1 (argument 0))
92 ; CHECK-NEXT: (setlocal @2 (and @1 @0))
90 ; CHECK-NEXT: (set_local @0 (argument 1))
91 ; CHECK-NEXT: (set_local @1 (argument 0))
92 ; CHECK-NEXT: (set_local @2 (and @1 @0))
9393 ; CHECK-NEXT: (return @2)
9494 define i64 @and64(i64 %x, i64 %y) {
9595 %a = and i64 %x, %y
9898
9999 ; CHECK-LABEL: (func $ior64
100100 ; CHECK-NEXT: (param i64) (param i64) (result i64)
101 ; CHECK-NEXT: (setlocal @0 (argument 1))
102 ; CHECK-NEXT: (setlocal @1 (argument 0))
103 ; CHECK-NEXT: (setlocal @2 (ior @1 @0))
101 ; CHECK-NEXT: (set_local @0 (argument 1))
102 ; CHECK-NEXT: (set_local @1 (argument 0))
103 ; CHECK-NEXT: (set_local @2 (ior @1 @0))
104104 ; CHECK-NEXT: (return @2)
105105 define i64 @ior64(i64 %x, i64 %y) {
106106 %a = or i64 %x, %y
109109
110110 ; CHECK-LABEL: (func $xor64
111111 ; CHECK-NEXT: (param i64) (param i64) (result i64)
112 ; CHECK-NEXT: (setlocal @0 (argument 1))
113 ; CHECK-NEXT: (setlocal @1 (argument 0))
114 ; CHECK-NEXT: (setlocal @2 (xor @1 @0))
112 ; CHECK-NEXT: (set_local @0 (argument 1))
113 ; CHECK-NEXT: (set_local @1 (argument 0))
114 ; CHECK-NEXT: (set_local @2 (xor @1 @0))
115115 ; CHECK-NEXT: (return @2)
116116 define i64 @xor64(i64 %x, i64 %y) {
117117 %a = xor i64 %x, %y
120120
121121 ; CHECK-LABEL: (func $shl64
122122 ; CHECK-NEXT: (param i64) (param i64) (result i64)
123 ; CHECK-NEXT: (setlocal @0 (argument 1))
124 ; CHECK-NEXT: (setlocal @1 (argument 0))
125 ; CHECK-NEXT: (setlocal @2 (shl @1 @0))
123 ; CHECK-NEXT: (set_local @0 (argument 1))
124 ; CHECK-NEXT: (set_local @1 (argument 0))
125 ; CHECK-NEXT: (set_local @2 (shl @1 @0))
126126 ; CHECK-NEXT: (return @2)
127127 define i64 @shl64(i64 %x, i64 %y) {
128128 %a = shl i64 %x, %y
131131
132132 ; CHECK-LABEL: (func $shr64
133133 ; CHECK-NEXT: (param i64) (param i64) (result i64)
134 ; CHECK-NEXT: (setlocal @0 (argument 1))
135 ; CHECK-NEXT: (setlocal @1 (argument 0))
136 ; CHECK-NEXT: (setlocal @2 (shr_u @1 @0))
134 ; CHECK-NEXT: (set_local @0 (argument 1))
135 ; CHECK-NEXT: (set_local @1 (argument 0))
136 ; CHECK-NEXT: (set_local @2 (shr_u @1 @0))
137137 ; CHECK-NEXT: (return @2)
138138 define i64 @shr64(i64 %x, i64 %y) {
139139 %a = lshr i64 %x, %y
142142
143143 ; CHECK-LABEL: (func $sar64
144144 ; CHECK-NEXT: (param i64) (param i64) (result i64)
145 ; CHECK-NEXT: (setlocal @0 (argument 1))
146 ; CHECK-NEXT: (setlocal @1 (argument 0))
147 ; CHECK-NEXT: (setlocal @2 (shr_s @1 @0))
145 ; CHECK-NEXT: (set_local @0 (argument 1))
146 ; CHECK-NEXT: (set_local @1 (argument 0))
147 ; CHECK-NEXT: (set_local @2 (shr_s @1 @0))
148148 ; CHECK-NEXT: (return @2)
149149 define i64 @sar64(i64 %x, i64 %y) {
150150 %a = ashr i64 %x, %y
153153
154154 ; CHECK-LABEL: (func $clz64
155155 ; CHECK-NEXT: (param i64) (result i64)
156 ; CHECK-NEXT: (setlocal @0 (argument 0))
157 ; CHECK-NEXT: (setlocal @1 (clz @0))
156 ; CHECK-NEXT: (set_local @0 (argument 0))
157 ; CHECK-NEXT: (set_local @1 (clz @0))
158158 ; CHECK-NEXT: (return @1)
159159 define i64 @clz64(i64 %x) {
160160 %a = call i64 @llvm.ctlz.i64(i64 %x, i1 false)
163163
164164 ; CHECK-LABEL: (func $clz64_zero_undef
165165 ; CHECK-NEXT: (param i64) (result i64)
166 ; CHECK-NEXT: (setlocal @0 (argument 0))
167 ; CHECK-NEXT: (setlocal @1 (clz @0))
166 ; CHECK-NEXT: (set_local @0 (argument 0))
167 ; CHECK-NEXT: (set_local @1 (clz @0))
168168 ; CHECK-NEXT: (return @1)
169169 define i64 @clz64_zero_undef(i64 %x) {
170170 %a = call i64 @llvm.ctlz.i64(i64 %x, i1 true)
173173
174174 ; CHECK-LABEL: (func $ctz64
175175 ; CHECK-NEXT: (param i64) (result i64)
176 ; CHECK-NEXT: (setlocal @0 (argument 0))
177 ; CHECK-NEXT: (setlocal @1 (ctz @0))
176 ; CHECK-NEXT: (set_local @0 (argument 0))
177 ; CHECK-NEXT: (set_local @1 (ctz @0))
178178 ; CHECK-NEXT: (return @1)
179179 define i64 @ctz64(i64 %x) {
180180 %a = call i64 @llvm.cttz.i64(i64 %x, i1 false)
183183
184184 ; CHECK-LABEL: (func $ctz64_zero_undef
185185 ; CHECK-NEXT: (param i64) (result i64)
186 ; CHECK-NEXT: (setlocal @0 (argument 0))
187 ; CHECK-NEXT: (setlocal @1 (ctz @0))
186 ; CHECK-NEXT: (set_local @0 (argument 0))
187 ; CHECK-NEXT: (set_local @1 (ctz @0))
188188 ; CHECK-NEXT: (return @1)
189189 define i64 @ctz64_zero_undef(i64 %x) {
190190 %a = call i64 @llvm.cttz.i64(i64 %x, i1 true)
193193
194194 ; CHECK-LABEL: (func $popcnt64
195195 ; CHECK-NEXT: (param i64) (result i64)
196 ; CHECK-NEXT: (setlocal @0 (argument 0))
197 ; CHECK-NEXT: (setlocal @1 (popcnt @0))
196 ; CHECK-NEXT: (set_local @0 (argument 0))
197 ; CHECK-NEXT: (set_local @1 (popcnt @0))
198198 ; CHECK-NEXT: (return @1)
199199 define i64 @popcnt64(i64 %x) {
200200 %a = call i64 @llvm.ctpop.i64(i64 %x)
66
77 ; CHECK-LABEL: (func $zero_i32
88 ; CHECK-NEXT: (result i32)
9 ; CHECK-NEXT: (setlocal @0 (immediate 0))
9 ; CHECK-NEXT: (set_local @0 (immediate 0))
1010 ; CHECK-NEXT: (return @0)
1111 define i32 @zero_i32() {
1212 ret i32 0
1414
1515 ; CHECK-LABEL: (func $one_i32
1616 ; CHECK-NEXT: (result i32)
17 ; CHECK-NEXT: (setlocal @0 (immediate 1))
17 ; CHECK-NEXT: (set_local @0 (immediate 1))
1818 ; CHECK-NEXT: (return @0)
1919 define i32 @one_i32() {
2020 ret i32 1
2222
2323 ; CHECK-LABEL: (func $max_i32
2424 ; CHECK-NEXT: (result i32)
25 ; CHECK-NEXT: (setlocal @0 (immediate 2147483647))
25 ; CHECK-NEXT: (set_local @0 (immediate 2147483647))
2626 ; CHECK-NEXT: (return @0)
2727 define i32 @max_i32() {
2828 ret i32 2147483647
3030
3131 ; CHECK-LABEL: (func $min_i32
3232 ; CHECK-NEXT: (result i32)
33 ; CHECK-NEXT: (setlocal @0 (immediate -2147483648))
33 ; CHECK-NEXT: (set_local @0 (immediate -2147483648))
3434 ; CHECK-NEXT: (return @0)
3535 define i32 @min_i32() {
3636 ret i32 -2147483648
3838
3939 ; CHECK-LABEL: (func $zero_i64
4040 ; CHECK-NEXT: (result i64)
41 ; CHECK-NEXT: (setlocal @0 (immediate 0))
41 ; CHECK-NEXT: (set_local @0 (immediate 0))
4242 ; CHECK-NEXT: (return @0)
4343 define i64 @zero_i64() {
4444 ret i64 0
4646
4747 ; CHECK-LABEL: (func $one_i64
4848 ; CHECK-NEXT: (result i64)
49 ; CHECK-NEXT: (setlocal @0 (immediate 1))
49 ; CHECK-NEXT: (set_local @0 (immediate 1))
5050 ; CHECK-NEXT: (return @0)
5151 define i64 @one_i64() {
5252 ret i64 1
5454
5555 ; CHECK-LABEL: (func $max_i64
5656 ; CHECK-NEXT: (result i64)
57 ; CHECK-NEXT: (setlocal @0 (immediate 9223372036854775807))
57 ; CHECK-NEXT: (set_local @0 (immediate 9223372036854775807))
5858 ; CHECK-NEXT: (return @0)
5959 define i64 @max_i64() {
6060 ret i64 9223372036854775807
6262
6363 ; CHECK-LABEL: (func $min_i64
6464 ; CHECK-NEXT: (result i64)
65 ; CHECK-NEXT: (setlocal @0 (immediate -9223372036854775808))
65 ; CHECK-NEXT: (set_local @0 (immediate -9223372036854775808))
6666 ; CHECK-NEXT: (return @0)
6767 define i64 @min_i64() {
6868 ret i64 -9223372036854775808
7070
7171 ; CHECK-LABEL: (func $negzero_f32
7272 ; CHECK-NEXT: (result f32)
73 ; CHECK-NEXT: (setlocal @0 (immediate -0x0p0))
73 ; CHECK-NEXT: (set_local @0 (immediate -0x0p0))
7474 ; CHECK-NEXT: (return @0)
7575 define float @negzero_f32() {
7676 ret float -0.0
7878
7979 ; CHECK-LABEL: (func $zero_f32
8080 ; CHECK-NEXT: (result f32)
81 ; CHECK-NEXT: (setlocal @0 (immediate 0x0p0))
81 ; CHECK-NEXT: (set_local @0 (immediate 0x0p0))
8282 ; CHECK-NEXT: (return @0)
8383 define float @zero_f32() {
8484 ret float 0.0
8686
8787 ; CHECK-LABEL: (func $one_f32
8888 ; CHECK-NEXT: (result f32)
89 ; CHECK-NEXT: (setlocal @0 (immediate 0x1p0))
89 ; CHECK-NEXT: (set_local @0 (immediate 0x1p0))
9090 ; CHECK-NEXT: (return @0)
9191 define float @one_f32() {
9292 ret float 1.0
9494
9595 ; CHECK-LABEL: (func $two_f32
9696 ; CHECK-NEXT: (result f32)
97 ; CHECK-NEXT: (setlocal @0 (immediate 0x1p1))
97 ; CHECK-NEXT: (set_local @0 (immediate 0x1p1))
9898 ; CHECK-NEXT: (return @0)
9999 define float @two_f32() {
100100 ret float 2.0
102102
103103 ; CHECK-LABEL: (func $nan_f32
104104 ; CHECK-NEXT: (result f32)
105 ; CHECK-NEXT: (setlocal @0 (immediate nan))
105 ; CHECK-NEXT: (set_local @0 (immediate nan))
106106 ; CHECK-NEXT: (return @0)
107107 define float @nan_f32() {
108108 ret float 0x7FF8000000000000
110110
111111 ; CHECK-LABEL: (func $negnan_f32
112112 ; CHECK-NEXT: (result f32)
113 ; CHECK-NEXT: (setlocal @0 (immediate -nan))
113 ; CHECK-NEXT: (set_local @0 (immediate -nan))
114114 ; CHECK-NEXT: (return @0)
115115 define float @negnan_f32() {
116116 ret float 0xFFF8000000000000
118118
119119 ; CHECK-LABEL: (func $inf_f32
120120 ; CHECK-NEXT: (result f32)
121 ; CHECK-NEXT: (setlocal @0 (immediate infinity))
121 ; CHECK-NEXT: (set_local @0 (immediate infinity))
122122 ; CHECK-NEXT: (return @0)
123123 define float @inf_f32() {
124124 ret float 0x7FF0000000000000
126126
127127 ; CHECK-LABEL: (func $neginf_f32
128128 ; CHECK-NEXT: (result f32)
129 ; CHECK-NEXT: (setlocal @0 (immediate -infinity))
129 ; CHECK-NEXT: (set_local @0 (immediate -infinity))
130130 ; CHECK-NEXT: (return @0)
131131 define float @neginf_f32() {
132132 ret float 0xFFF0000000000000
134134
135135 ; CHECK-LABEL: (func $negzero_f64
136136 ; CHECK-NEXT: (result f64)
137 ; CHECK-NEXT: (setlocal @0 (immediate -0x0p0))
137 ; CHECK-NEXT: (set_local @0 (immediate -0x0p0))
138138 ; CHECK-NEXT: (return @0)
139139 define double @negzero_f64() {
140140 ret double -0.0
142142
143143 ; CHECK-LABEL: (func $zero_f64
144144 ; CHECK-NEXT: (result f64)
145 ; CHECK-NEXT: (setlocal @0 (immediate 0x0p0))
145 ; CHECK-NEXT: (set_local @0 (immediate 0x0p0))
146146 ; CHECK-NEXT: (return @0)
147147 define double @zero_f64() {
148148 ret double 0.0
150150
151151 ; CHECK-LABEL: (func $one_f64
152152 ; CHECK-NEXT: (result f64)
153 ; CHECK-NEXT: (setlocal @0 (immediate 0x1p0))
153 ; CHECK-NEXT: (set_local @0 (immediate 0x1p0))
154154 ; CHECK-NEXT: (return @0)
155155 define double @one_f64() {
156156 ret double 1.0
158158
159159 ; CHECK-LABEL: (func $two_f64
160160 ; CHECK-NEXT: (result f64)
161 ; CHECK-NEXT: (setlocal @0 (immediate 0x1p1))
161 ; CHECK-NEXT: (set_local @0 (immediate 0x1p1))
162162 ; CHECK-NEXT: (return @0)
163163 define double @two_f64() {
164164 ret double 2.0
166166
167167 ; CHECK-LABEL: (func $nan_f64
168168 ; CHECK-NEXT: (result f64)
169 ; CHECK-NEXT: (setlocal @0 (immediate nan))
169 ; CHECK-NEXT: (set_local @0 (immediate nan))
170170 ; CHECK-NEXT: (return @0)
171171 define double @nan_f64() {
172172 ret double 0x7FF8000000000000
174174
175175 ; CHECK-LABEL: (func $negnan_f64
176176 ; CHECK-NEXT: (result f64)
177 ; CHECK-NEXT: (setlocal @0 (immediate -nan))
177 ; CHECK-NEXT: (set_local @0 (immediate -nan))
178178 ; CHECK-NEXT: (return @0)
179179 define double @negnan_f64() {
180180 ret double 0xFFF8000000000000
182182
183183 ; CHECK-LABEL: (func $inf_f64
184184 ; CHECK-NEXT: (result f64)
185 ; CHECK-NEXT: (setlocal @0 (immediate infinity))
185 ; CHECK-NEXT: (set_local @0 (immediate infinity))
186186 ; CHECK-NEXT: (return @0)
187187 define double @inf_f64() {
188188 ret double 0x7FF0000000000000
190190
191191 ; CHECK-LABEL: (func $neginf_f64
192192 ; CHECK-NEXT: (result f64)
193 ; CHECK-NEXT: (setlocal @0 (immediate -infinity))
193 ; CHECK-NEXT: (set_local @0 (immediate -infinity))
194194 ; CHECK-NEXT: (return @0)
195195 define double @neginf_f64() {
196196 ret double 0xFFF0000000000000
55 target triple = "wasm32-unknown-unknown"
66
77 ; CHECK-LABEL: (func $sext_i8_i32
8 ; CHECK: (setlocal @1 (load_s_i8_i32 @0))
8 ; CHECK: (set_local @1 (load_s_i8_i32 @0))
99 define i32 @sext_i8_i32(i8 *%p) {
1010 %v = load i8, i8* %p
1111 %e = sext i8 %v to i32
1313 }
1414
1515 ; CHECK-LABEL: (func $zext_i8_i32
16 ; CHECK: (setlocal @1 (load_u_i8_i32 @0))
16 ; CHECK: (set_local @1 (load_u_i8_i32 @0))
1717 define i32 @zext_i8_i32(i8 *%p) {
1818 %v = load i8, i8* %p
1919 %e = zext i8 %v to i32
2121 }
2222
2323 ; CHECK-LABEL: (func $sext_i16_i32
24 ; CHECK: (setlocal @1 (load_s_i16_i32 @0))
24 ; CHECK: (set_local @1 (load_s_i16_i32 @0))
2525 define i32 @sext_i16_i32(i16 *%p) {
2626 %v = load i16, i16* %p
2727 %e = sext i16 %v to i32
2929 }
3030
3131 ; CHECK-LABEL: (func $zext_i16_i32
32 ; CHECK: (setlocal @1 (load_u_i16_i32 @0))
32 ; CHECK: (set_local @1 (load_u_i16_i32 @0))
3333 define i32 @zext_i16_i32(i16 *%p) {
3434 %v = load i16, i16* %p
3535 %e = zext i16 %v to i32
3737 }
3838
3939 ; CHECK-LABEL: (func $sext_i8_i64
40 ; CHECK: (setlocal @1 (load_s_i8_i64 @0))
40 ; CHECK: (set_local @1 (load_s_i8_i64 @0))
4141 define i64 @sext_i8_i64(i8 *%p) {
4242 %v = load i8, i8* %p
4343 %e = sext i8 %v to i64
4545 }
4646
4747 ; CHECK-LABEL: (func $zext_i8_i64
48 ; CHECK: (setlocal @1 (load_u_i8_i64 @0))
48 ; CHECK: (set_local @1 (load_u_i8_i64 @0))
4949 define i64 @zext_i8_i64(i8 *%p) {
5050 %v = load i8, i8* %p
5151 %e = zext i8 %v to i64
5353 }
5454
5555 ; CHECK-LABEL: (func $sext_i16_i64
56 ; CHECK: (setlocal @1 (load_s_i16_i64 @0))
56 ; CHECK: (set_local @1 (load_s_i16_i64 @0))
5757 define i64 @sext_i16_i64(i16 *%p) {
5858 %v = load i16, i16* %p
5959 %e = sext i16 %v to i64
6161 }
6262
6363 ; CHECK-LABEL: (func $zext_i16_i64
64 ; CHECK: (setlocal @1 (load_u_i16_i64 @0))
64 ; CHECK: (set_local @1 (load_u_i16_i64 @0))
6565 define i64 @zext_i16_i64(i16 *%p) {
6666 %v = load i16, i16* %p
6767 %e = zext i16 %v to i64
6969 }
7070
7171 ; CHECK-LABEL: (func $sext_i32_i64
72 ; CHECK: (setlocal @1 (load_s_i32_i64 @0))
72 ; CHECK: (set_local @1 (load_s_i32_i64 @0))
7373 define i64 @sext_i32_i64(i32 *%p) {
7474 %v = load i32, i32* %p
7575 %e = sext i32 %v to i64
7777 }
7878
7979 ; CHECK-LABEL: (func $zext_i32_i64
80 ; CHECK: (setlocal @1 (load_u_i32_i64 @0))
80 ; CHECK: (set_local @1 (load_u_i32_i64 @0))
8181 define i64 @zext_i32_i64(i32 *%p) {
8282 %v = load i32, i32* %p
8383 %e = zext i32 %v to i64
55 target triple = "wasm32-unknown-unknown"
66
77 ; CHECK-LABEL: (func $load_u_i1_i32
8 ; CHECK: (setlocal @1 (load_u_i8_i32 @0))
8 ; CHECK: (set_local @1 (load_u_i8_i32 @0))
99 ; CHECK-NEXT: (return @1)
1010 define i32 @load_u_i1_i32(i1* %p) {
1111 %v = load i1, i1* %p
1414 }
1515
1616 ; CHECK-LABEL: (func $load_s_i1_i32
17 ; CHECK: (setlocal @1 (load_u_i8_i32 @0))
18 ; CHECK-NEXT: (setlocal @2 (immediate 31))
19 ; CHECK-NEXT: (setlocal @3 (shl @1 @2))
20 ; CHECK-NEXT: (setlocal @4 (shr_s @3 @2))
17 ; CHECK: (set_local @1 (load_u_i8_i32 @0))
18 ; CHECK-NEXT: (set_local @2 (immediate 31))
19 ; CHECK-NEXT: (set_local @3 (shl @1 @2))
20 ; CHECK-NEXT: (set_local @4 (shr_s @3 @2))
2121 ; CHECK-NEXT: (return @4)
2222 define i32 @load_s_i1_i32(i1* %p) {
2323 %v = load i1, i1* %p
2626 }
2727
2828 ; CHECK-LABEL: (func $load_u_i1_i64
29 ; CHECK: (setlocal @1 (load_u_i8_i64 @0))
29 ; CHECK: (set_local @1 (load_u_i8_i64 @0))
3030 ; CHECK-NEXT: (return @1)
3131 define i64 @load_u_i1_i64(i1* %p) {
3232 %v = load i1, i1* %p
3535 }
3636
3737 ; CHECK-LABEL: (func $load_s_i1_i64
38 ; CHECK: (setlocal @1 (load_u_i8_i64 @0))
39 ; CHECK-NEXT: (setlocal @2 (immediate 63))
40 ; CHECK-NEXT: (setlocal @3 (shl @1 @2))
41 ; CHECK-NEXT: (setlocal @4 (shr_s @3 @2))
38 ; CHECK: (set_local @1 (load_u_i8_i64 @0))
39 ; CHECK-NEXT: (set_local @2 (immediate 63))
40 ; CHECK-NEXT: (set_local @3 (shl @1 @2))
41 ; CHECK-NEXT: (set_local @4 (shr_s @3 @2))
4242 ; CHECK-NEXT: (return @4)
4343 define i64 @load_s_i1_i64(i1* %p) {
4444 %v = load i1, i1* %p
4747 }
4848
4949 ; CHECK-LABEL: (func $store_i32_i1
50 ; CHECK: (setlocal @2 (immediate 1))
51 ; CHECK-NEXT: (setlocal @3 (and @1 @2))
50 ; CHECK: (set_local @2 (immediate 1))
51 ; CHECK-NEXT: (set_local @3 (and @1 @2))
5252 ; CHECK-NEXT: (store_i8 @0 @3)
5353 define void @store_i32_i1(i1* %p, i32 %v) {
5454 %t = trunc i32 %v to i1
5757 }
5858
5959 ; CHECK-LABEL: (func $store_i64_i1
60 ; CHECK: (setlocal @2 (immediate 1))
61 ; CHECK-NEXT: (setlocal @3 (and @1 @2))
60 ; CHECK: (set_local @2 (immediate 1))
61 ; CHECK-NEXT: (set_local @3 (and @1 @2))
6262 ; CHECK-NEXT: (store_i8 @0 @3)
6363 define void @store_i64_i1(i1* %p, i64 %v) {
6464 %t = trunc i64 %v to i1
66
77 ; CHECK-LABEL: (func $ldi32
88 ; CHECK-NEXT: (param i32) (result i32)
9 ; CHECK-NEXT: (setlocal @0 (argument 0))
10 ; CHECK-NEXT: (setlocal @1 (load_i32 @0))
9 ; CHECK-NEXT: (set_local @0 (argument 0))
10 ; CHECK-NEXT: (set_local @1 (load_i32 @0))
1111 ; CHECK-NEXT: (return @1)
1212 define i32 @ldi32(i32 *%p) {
1313 %v = load i32, i32* %p
1616
1717 ; CHECK-LABEL: (func $ldi64
1818 ; CHECK-NEXT: (param i32) (result i64)
19 ; CHECK-NEXT: (setlocal @0 (argument 0))
20 ; CHECK-NEXT: (setlocal @1 (load_i64 @0))
19 ; CHECK-NEXT: (set_local @0 (argument 0))
20 ; CHECK-NEXT: (set_local @1 (load_i64 @0))
2121 ; CHECK-NEXT: (return @1)
2222 define i64 @ldi64(i64 *%p) {
2323 %v = load i64, i64* %p
2626
2727 ; CHECK-LABEL: (func $ldf32
2828 ; CHECK-NEXT: (param i32) (result f32)
29 ; CHECK-NEXT: (setlocal @0 (argument 0))
30 ; CHECK-NEXT: (setlocal @1 (load_f32 @0))
29 ; CHECK-NEXT: (set_local @0 (argument 0))
30 ; CHECK-NEXT: (set_local @1 (load_f32 @0))
3131 ; CHECK-NEXT: (return @1)
3232 define float @ldf32(float *%p) {
3333 %v = load float, float* %p
3636
3737 ; CHECK-LABEL: (func $ldf64
3838 ; CHECK-NEXT: (param i32) (result f64)
39 ; CHECK-NEXT: (setlocal @0 (argument 0))
40 ; CHECK-NEXT: (setlocal @1 (load_f64 @0))
39 ; CHECK-NEXT: (set_local @0 (argument 0))
40 ; CHECK-NEXT: (set_local @1 (load_f64 @0))
4141 ; CHECK-NEXT: (return @1)
4242 define double @ldf64(double *%p) {
4343 %v = load double, double* %p
1010
1111 ; CHECK-LABEL: (func $page_size
1212 ; CHECK-NEXT: (result i32)
13 ; CHECK-NEXT: (setlocal @0 (page_size))
13 ; CHECK-NEXT: (set_local @0 (page_size))
1414 ; CHECK-NEXT: (return @0)
1515 define i32 @page_size() {
1616 %a = call i32 @llvm.wasm.page.size.i32()
1919
2020 ; CHECK-LABEL: (func $memory_size
2121 ; CHECK-NEXT: (result i32)
22 ; CHECK-NEXT: (setlocal @0 (memory_size))
22 ; CHECK-NEXT: (set_local @0 (memory_size))
2323 ; CHECK-NEXT: (return @0)
2424 define i32 @memory_size() {
2525 %a = call i32 @llvm.wasm.memory.size.i32()
1010
1111 ; CHECK-LABEL: (func $page_size
1212 ; CHECK-NEXT: (result i64)
13 ; CHECK-NEXT: (setlocal @0 (page_size))
13 ; CHECK-NEXT: (set_local @0 (page_size))
1414 ; CHECK-NEXT: (return @0)
1515 define i64 @page_size() {
1616 %a = call i64 @llvm.wasm.page.size.i64()
1919
2020 ; CHECK-LABEL: (func $memory_size
2121 ; CHECK-NEXT: (result i64)
22 ; CHECK-NEXT: (setlocal @0 (memory_size))
22 ; CHECK-NEXT: (set_local @0 (memory_size))
2323 ; CHECK-NEXT: (return @0)
2424 define i64 @memory_size() {
2525 %a = call i64 @llvm.wasm.memory.size.i64()
77 ; Basic phi triangle.
88
99 ; CHECK-LABEL: test0
10 ; CHECK: (setlocal [[REG:@.*]] (argument 0))
11 ; CHECK: (setlocal [[REG]] (sdiv [[REG]] {{.*}}))
10 ; CHECK: (set_local [[REG:@.*]] (argument 0))
11 ; CHECK: (set_local [[REG]] (sdiv [[REG]] {{.*}}))
1212 ; CHECK: (return [[REG]])
1313 define i32 @test0(i32 %p) {
1414 entry:
2626
2727 ; CHECK-LABEL: test1
2828 ; CHECK: BB1_1:
29 ; CHECK: (setlocal [[REG0:@.*]] [[REG1:@.*]])
30 ; CHECK: (setlocal [[REG1]] [[REG2:@.*]])
31 ; CHECK: (setlocal [[REG2]] [[REG0]])
29 ; CHECK: (set_local [[REG0:@.*]] [[REG1:@.*]])
30 ; CHECK: (set_local [[REG1]] [[REG2:@.*]])
31 ; CHECK: (set_local [[REG2]] [[REG0]])
3232 define i32 @test1(i32 %n) {
3333 entry:
3434 br label %loop
66
77 ; CHECK-LABEL: (func $sti32
88 ; CHECK-NEXT: (param i32) (param i32)
9 ; CHECK-NEXT: (setlocal @0 (argument 1))
10 ; CHECK-NEXT: (setlocal @1 (argument 0))
9 ; CHECK-NEXT: (set_local @0 (argument 1))
10 ; CHECK-NEXT: (set_local @1 (argument 0))
1111 ; CHECK-NEXT: (store_i32 @1 @0)
1212 ; CHECK-NEXT: (return)
1313 define void @sti32(i32 *%p, i32 %v) {
1717
1818 ; CHECK-LABEL: (func $sti64
1919 ; CHECK-NEXT: (param i32) (param i64)
20 ; CHECK-NEXT: (setlocal @0 (argument 1))
21 ; CHECK-NEXT: (setlocal @1 (argument 0))
20 ; CHECK-NEXT: (set_local @0 (argument 1))
21 ; CHECK-NEXT: (set_local @1 (argument 0))
2222 ; CHECK-NEXT: (store_i64 @1 @0)
2323 ; CHECK-NEXT: (return)
2424 define void @sti64(i64 *%p, i64 %v) {
2828
2929 ; CHECK-LABEL: (func $stf32
3030 ; CHECK-NEXT: (param i32) (param f32)
31 ; CHECK-NEXT: (setlocal @0 (argument 1))
32 ; CHECK-NEXT: (setlocal @1 (argument 0))
31 ; CHECK-NEXT: (set_local @0 (argument 1))
32 ; CHECK-NEXT: (set_local @1 (argument 0))
3333 ; CHECK-NEXT: (store_f32 @1 @0)
3434 ; CHECK-NEXT: (return)
3535 define void @stf32(float *%p, float %v) {
3939
4040 ; CHECK-LABEL: (func $stf64
4141 ; CHECK-NEXT: (param i32) (param f64)
42 ; CHECK-NEXT: (setlocal @0 (argument 1))
43 ; CHECK-NEXT: (setlocal @1 (argument 0))
42 ; CHECK-NEXT: (set_local @0 (argument 1))
43 ; CHECK-NEXT: (set_local @1 (argument 0))
4444 ; CHECK-NEXT: (store_f64 @1 @0)
4545 ; CHECK-NEXT: (return)
4646 define void @stf64(double *%p, double %v) {
66
77 ; CHECK-LABEL: (func $unused_first
88 ; CHECK-NEXT: (param i32) (param i32) (result i32)
9 ; CHECK-NEXT: (setlocal @0 (argument 1))
9 ; CHECK-NEXT: (set_local @0 (argument 1))
1010 ; CHECK-NEXT: (return @0)
1111 define i32 @unused_first(i32 %x, i32 %y) {
1212 ret i32 %y
1414
1515 ; CHECK-LABEL: (func $unused_second
1616 ; CHECK-NEXT: (param i32) (param i32) (result i32)
17 ; CHECK-NEXT: (setlocal @0 (argument 0))
17 ; CHECK-NEXT: (set_local @0 (argument 0))
1818 ; CHECK-NEXT: (return @0)
1919 define i32 @unused_second(i32 %x, i32 %y) {
2020 ret i32 %x