llvm.org GIT mirror llvm / 11228e3
[WebAssembly] Make expression-stack pushing explicit Modelling of the expression stack is evolving. This patch takes another step by making pushes explicit. Differential Revision: http://reviews.llvm.org/D14338 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252334 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 4 years ago
16 changed file(s) with 210 addition(s) and 198 deletion(s). Raw diff Collapse all Expand all
268268
269269 switch (MI->getOpcode()) {
270270 case TargetOpcode::COPY:
271 OS << "get_local " << regToString(MI->getOperand(1));
271 OS << "get_local push, " << regToString(MI->getOperand(1));
272272 break;
273273 case WebAssembly::GLOBAL:
274274 // TODO: wasm64
275 OS << "i32.const " << toSymbol(MI->getOperand(1).getGlobal()->getName());
275 OS << "i32.const push, " << toSymbol(MI->getOperand(1).getGlobal()->getName());
276276 break;
277277 case WebAssembly::ARGUMENT_I32:
278278 case WebAssembly::ARGUMENT_I64:
279279 case WebAssembly::ARGUMENT_F32:
280280 case WebAssembly::ARGUMENT_F64:
281 OS << "get_local " << argToString(MI->getOperand(1));
281 OS << "get_local push, " << argToString(MI->getOperand(1));
282282 break;
283283 case WebAssembly::Const_I32:
284 OS << "i32.const " << MI->getOperand(1).getImm();
284 OS << "i32.const push, " << MI->getOperand(1).getImm();
285285 break;
286286 case WebAssembly::Const_I64:
287 OS << "i64.const " << MI->getOperand(1).getImm();
287 OS << "i64.const push, " << MI->getOperand(1).getImm();
288288 break;
289289 case WebAssembly::Const_F32:
290 OS << "f32.const " << toString(MI->getOperand(1).getFPImm()->getValueAPF());
290 OS << "f32.const push, " << toString(MI->getOperand(1).getFPImm()->getValueAPF());
291291 break;
292292 case WebAssembly::Const_F64:
293 OS << "f64.const " << toString(MI->getOperand(1).getFPImm()->getValueAPF());
293 OS << "f64.const push, " << toString(MI->getOperand(1).getFPImm()->getValueAPF());
294294 break;
295295 default: {
296296 OS << OpcodeName(TII, MI);
297297 bool NeedComma = false;
298 bool DefsPushed = false;
299 if (NumDefs != 0 && !MI->isCall()) {
300 OS << " push";
301 NeedComma = true;
302 DefsPushed = true;
303 }
298304 for (const MachineOperand &MO : MI->uses()) {
299305 if (MO.isReg() && MO.isImplicit())
300306 continue;
320326 case MachineOperand::MO_MachineBasicBlock:
321327 OS << toSymbol(MO.getMBB()->getSymbol()->getName());
322328 break;
329 }
330 if (NumDefs != 0 && !DefsPushed) {
331 // Special-case for calls; print the push after the callee.
332 assert(MI->isCall());
333 OS << ", push";
334 DefsPushed = true;
323335 }
324336 }
325337 break;
1515 ; CHECK-LABEL: call_i32_nullary:
1616 ; CHECK-NEXT: .result i32
1717 ; CHECK-NEXT: .local i32
18 ; CHECK-NEXT: call $i32_nullary
18 ; CHECK-NEXT: call $i32_nullary, push{{$}}
1919 ; CHECK-NEXT: set_local 0, pop
2020 ; CHECK-NEXT: return (get_local 0)
2121 define i32 @call_i32_nullary() {
2626 ; CHECK-LABEL: call_i64_nullary:
2727 ; CHECK-NEXT: .result i64
2828 ; CHECK-NEXT: .local i64
29 ; CHECK-NEXT: call $i64_nullary
29 ; CHECK-NEXT: call $i64_nullary, push{{$}}
3030 ; CHECK-NEXT: set_local 0, pop
3131 ; CHECK-NEXT: return (get_local 0)
3232 define i64 @call_i64_nullary() {
3737 ; CHECK-LABEL: call_float_nullary:
3838 ; CHECK-NEXT: .result f32
3939 ; CHECK-NEXT: .local f32
40 ; CHECK-NEXT: call $float_nullary
40 ; CHECK-NEXT: call $float_nullary, push{{$}}
4141 ; CHECK-NEXT: set_local 0, pop
4242 ; CHECK-NEXT: return (get_local 0)
4343 define float @call_float_nullary() {
4848 ; CHECK-LABEL: call_double_nullary:
4949 ; CHECK-NEXT: .result f64
5050 ; CHECK-NEXT: .local f64
51 ; CHECK-NEXT: call $double_nullary
51 ; CHECK-NEXT: call $double_nullary, push{{$}}
5252 ; CHECK-NEXT: set_local 0, pop
5353 ; CHECK-NEXT: return (get_local 0)
5454 define double @call_double_nullary() {
5757 }
5858
5959 ; CHECK-LABEL: call_void_nullary:
60 ; CHECK-NEXT: call $void_nullary
60 ; CHECK-NEXT: call $void_nullary{{$}}
6161 ; CHECK-NEXT: return
6262 define void @call_void_nullary() {
6363 call void @void_nullary()
7070 ; CHECK-NEXT: .local i32, i32
7171 ; CHECK-NEXT: get_local 0
7272 ; CHECK-NEXT: set_local 1, pop
73 ; CHECK-NEXT: call $i32_unary, (get_local 1)
73 ; CHECK-NEXT: call $i32_unary, push, (get_local 1){{$}}
7474 ; CHECK-NEXT: set_local 2, pop
7575 ; CHECK-NEXT: return (get_local 2)
7676 define i32 @call_i32_unary(i32 %a) {
8787 ; CHECK-NEXT: set_local 2, pop
8888 ; CHECK-NEXT: get_local 0
8989 ; CHECK-NEXT: set_local 3, pop
90 ; CHECK-NEXT: call $i32_binary, (get_local 3), (get_local 2)
90 ; CHECK-NEXT: call $i32_binary, push, (get_local 3), (get_local 2){{$}}
9191 ; CHECK-NEXT: set_local 4, pop
9292 ; CHECK-NEXT: return (get_local 4)
9393 define i32 @call_i32_binary(i32 %a, i32 %b) {
100100 ; CHECK-NEXT: .local i32
101101 ; CHECK-NEXT: get_local 0
102102 ; CHECK-NEXT: set_local 1, pop
103 ; CHECK-NEXT: call_indirect (get_local 1)
103 ; CHECK-NEXT: call_indirect (get_local 1){{$}}
104104 ; CHECK-NEXT: return
105105 define void @call_indirect_void(void ()* %callee) {
106106 call void %callee()
113113 ; CHECK-NEXT: .local i32, i32
114114 ; CHECK-NEXT: get_local 0
115115 ; CHECK-NEXT: set_local 1, pop
116 ; CHECK-NEXT: call_indirect (get_local 1)
116 ; CHECK-NEXT: call_indirect (get_local 1), push{{$}}
117117 ; CHECK-NEXT: set_local 2, pop
118118 ; CHECK-NEXT: return (get_local 2)
119119 define i32 @call_indirect_i32(i32 ()* %callee) {
122122 }
123123
124124 ; CHECK-LABEL: tail_call_void_nullary:
125 ; CHECK-NEXT: call $void_nullary
125 ; CHECK-NEXT: call $void_nullary{{$}}
126126 ; CHECK-NEXT: return{{$}}
127127 define void @tail_call_void_nullary() {
128128 tail call void @void_nullary()
130130 }
131131
132132 ; CHECK-LABEL: fastcc_tail_call_void_nullary:
133 ; CHECK-NEXT: call $void_nullary
133 ; CHECK-NEXT: call $void_nullary{{$}}
134134 ; CHECK-NEXT: return{{$}}
135135 define void @fastcc_tail_call_void_nullary() {
136136 tail call fastcc void @void_nullary()
1414 ; CHECK-NEXT: set_local 2, pop{{$}}
1515 ; CHECK-NEXT: get_local 1{{$}}
1616 ; CHECK-NEXT: set_local 3, pop{{$}}
17 ; CHECK-NEXT: eq (get_local 3), (get_local 3){{$}}
17 ; CHECK-NEXT: eq push, (get_local 3), (get_local 3){{$}}
1818 ; CHECK-NEXT: set_local 4, pop{{$}}
19 ; CHECK-NEXT: eq (get_local 2), (get_local 2){{$}}
19 ; CHECK-NEXT: eq push, (get_local 2), (get_local 2){{$}}
2020 ; CHECK-NEXT: set_local 5, pop{{$}}
21 ; CHECK-NEXT: and (get_local 5), (get_local 4){{$}}
21 ; CHECK-NEXT: and push, (get_local 5), (get_local 4){{$}}
2222 ; CHECK-NEXT: set_local 6, pop{{$}}
2323 ; CHECK-NEXT: return (get_local 6){{$}}
2424 define i32 @ord_f32(float %x, float %y) {
3636 ; CHECK-NEXT: set_local 2, pop{{$}}
3737 ; CHECK-NEXT: get_local 1{{$}}
3838 ; CHECK-NEXT: set_local 3, pop{{$}}
39 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
39 ; CHECK-NEXT: ne push, (get_local 3), (get_local 3){{$}}
4040 ; CHECK-NEXT: set_local 4, pop{{$}}
41 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
41 ; CHECK-NEXT: ne push, (get_local 2), (get_local 2){{$}}
4242 ; CHECK-NEXT: set_local 5, pop{{$}}
43 ; CHECK-NEXT: or (get_local 5), (get_local 4){{$}}
43 ; CHECK-NEXT: or push, (get_local 5), (get_local 4){{$}}
4444 ; CHECK-NEXT: set_local 6, pop{{$}}
4545 ; CHECK-NEXT: return (get_local 6){{$}}
4646 define i32 @uno_f32(float %x, float %y) {
5858 ; CHECK-NEXT: set_local 2, pop{{$}}
5959 ; CHECK-NEXT: get_local 0{{$}}
6060 ; CHECK-NEXT: set_local 3, pop{{$}}
61 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
61 ; CHECK-NEXT: eq push, (get_local 3), (get_local 2){{$}}
6262 ; CHECK-NEXT: set_local 4, pop{{$}}
6363 ; CHECK-NEXT: return (get_local 4){{$}}
6464 define i32 @oeq_f32(float %x, float %y) {
6868 }
6969
7070 ; CHECK-LABEL: une_f32:
71 ; CHECK: ne (get_local 3), (get_local 2){{$}}
71 ; CHECK: ne push, (get_local 3), (get_local 2){{$}}
7272 ; CHECK-NEXT: set_local 4, pop{{$}}
7373 define i32 @une_f32(float %x, float %y) {
7474 %a = fcmp une float %x, %y
7777 }
7878
7979 ; CHECK-LABEL: olt_f32:
80 ; CHECK: lt (get_local 3), (get_local 2){{$}}
80 ; CHECK: lt push, (get_local 3), (get_local 2){{$}}
8181 ; CHECK-NEXT: set_local 4, pop{{$}}
8282 define i32 @olt_f32(float %x, float %y) {
8383 %a = fcmp olt float %x, %y
8686 }
8787
8888 ; CHECK-LABEL: ole_f32:
89 ; CHECK: le (get_local 3), (get_local 2){{$}}
89 ; CHECK: le push, (get_local 3), (get_local 2){{$}}
9090 ; CHECK-NEXT: set_local 4, pop{{$}}
9191 define i32 @ole_f32(float %x, float %y) {
9292 %a = fcmp ole float %x, %y
9595 }
9696
9797 ; CHECK-LABEL: ogt_f32:
98 ; CHECK: gt (get_local 3), (get_local 2){{$}}
98 ; CHECK: gt push, (get_local 3), (get_local 2){{$}}
9999 ; CHECK-NEXT: set_local 4, pop{{$}}
100100 define i32 @ogt_f32(float %x, float %y) {
101101 %a = fcmp ogt float %x, %y
104104 }
105105
106106 ; CHECK-LABEL: oge_f32:
107 ; CHECK: ge (get_local 3), (get_local 2){{$}}
107 ; CHECK: ge push, (get_local 3), (get_local 2){{$}}
108108 ; CHECK-NEXT: set_local 4, pop{{$}}
109109 define i32 @oge_f32(float %x, float %y) {
110110 %a = fcmp oge float %x, %y
123123 ; CHECK-NEXT: set_local 2, pop{{$}}
124124 ; CHECK-NEXT: get_local 0{{$}}
125125 ; CHECK-NEXT: set_local 3, pop{{$}}
126 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
126 ; CHECK-NEXT: eq push, (get_local 3), (get_local 2){{$}}
127127 ; CHECK-NEXT: set_local 4, pop{{$}}
128 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
128 ; CHECK-NEXT: ne push, (get_local 2), (get_local 2){{$}}
129129 ; CHECK-NEXT: set_local 5, pop{{$}}
130 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
130 ; CHECK-NEXT: ne push, (get_local 3), (get_local 3){{$}}
131131 ; CHECK-NEXT: set_local 6, pop{{$}}
132 ; CHECK-NEXT: or (get_local 6), (get_local 5){{$}}
132 ; CHECK-NEXT: or push, (get_local 6), (get_local 5){{$}}
133133 ; CHECK-NEXT: set_local 7, pop{{$}}
134 ; CHECK-NEXT: or (get_local 4), (get_local 7){{$}}
134 ; CHECK-NEXT: or push, (get_local 4), (get_local 7){{$}}
135135 ; CHECK-NEXT: set_local 8, pop{{$}}
136136 ; CHECK-NEXT: return (get_local 8){{$}}
137137 define i32 @ueq_f32(float %x, float %y) {
141141 }
142142
143143 ; CHECK-LABEL: one_f32:
144 ; CHECK: ne (get_local 3), (get_local 2){{$}}
144 ; CHECK: ne push, (get_local 3), (get_local 2){{$}}
145145 ; CHECK-NEXT: set_local 4, pop{{$}}
146146 define i32 @one_f32(float %x, float %y) {
147147 %a = fcmp one float %x, %y
150150 }
151151
152152 ; CHECK-LABEL: ult_f32:
153 ; CHECK: lt (get_local 3), (get_local 2){{$}}
153 ; CHECK: lt push, (get_local 3), (get_local 2){{$}}
154154 ; CHECK-NEXT: set_local 4, pop{{$}}
155155 define i32 @ult_f32(float %x, float %y) {
156156 %a = fcmp ult float %x, %y
159159 }
160160
161161 ; CHECK-LABEL: ule_f32:
162 ; CHECK: le (get_local 3), (get_local 2){{$}}
162 ; CHECK: le push, (get_local 3), (get_local 2){{$}}
163163 ; CHECK-NEXT: set_local 4, pop{{$}}
164164 define i32 @ule_f32(float %x, float %y) {
165165 %a = fcmp ule float %x, %y
168168 }
169169
170170 ; CHECK-LABEL: ugt_f32:
171 ; CHECK: gt (get_local 3), (get_local 2){{$}}
171 ; CHECK: gt push, (get_local 3), (get_local 2){{$}}
172172 ; CHECK-NEXT: set_local 4, pop{{$}}
173173 define i32 @ugt_f32(float %x, float %y) {
174174 %a = fcmp ugt float %x, %y
177177 }
178178
179179 ; CHECK-LABEL: uge_f32:
180 ; CHECK: ge (get_local 3), (get_local 2){{$}}
180 ; CHECK: ge push, (get_local 3), (get_local 2){{$}}
181181 ; CHECK-NEXT: set_local 4, pop{{$}}
182182 define i32 @uge_f32(float %x, float %y) {
183183 %a = fcmp uge float %x, %y
1414 ; CHECK-NEXT: set_local 2, pop{{$}}
1515 ; CHECK-NEXT: get_local 1{{$}}
1616 ; CHECK-NEXT: set_local 3, pop{{$}}
17 ; CHECK-NEXT: eq (get_local 3), (get_local 3){{$}}
17 ; CHECK-NEXT: eq push, (get_local 3), (get_local 3){{$}}
1818 ; CHECK-NEXT: set_local 4, pop{{$}}
19 ; CHECK-NEXT: eq (get_local 2), (get_local 2){{$}}
19 ; CHECK-NEXT: eq push, (get_local 2), (get_local 2){{$}}
2020 ; CHECK-NEXT: set_local 5, pop{{$}}
21 ; CHECK-NEXT: and (get_local 5), (get_local 4){{$}}
21 ; CHECK-NEXT: and push, (get_local 5), (get_local 4){{$}}
2222 ; CHECK-NEXT: set_local 6, pop{{$}}
2323 ; CHECK-NEXT: return (get_local 6){{$}}
2424 define i32 @ord_f64(double %x, double %y) {
3636 ; CHECK-NEXT: set_local 2, pop{{$}}
3737 ; CHECK-NEXT: get_local 1{{$}}
3838 ; CHECK-NEXT: set_local 3, pop{{$}}
39 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
39 ; CHECK-NEXT: ne push, (get_local 3), (get_local 3){{$}}
4040 ; CHECK-NEXT: set_local 4, pop{{$}}
41 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
41 ; CHECK-NEXT: ne push, (get_local 2), (get_local 2){{$}}
4242 ; CHECK-NEXT: set_local 5, pop{{$}}
43 ; CHECK-NEXT: or (get_local 5), (get_local 4){{$}}
43 ; CHECK-NEXT: or push, (get_local 5), (get_local 4){{$}}
4444 ; CHECK-NEXT: set_local 6, pop{{$}}
4545 ; CHECK-NEXT: return (get_local 6){{$}}
4646 define i32 @uno_f64(double %x, double %y) {
5858 ; CHECK-NEXT: set_local 2, pop{{$}}
5959 ; CHECK-NEXT: get_local 0{{$}}
6060 ; CHECK-NEXT: set_local 3, pop{{$}}
61 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
61 ; CHECK-NEXT: eq push, (get_local 3), (get_local 2){{$}}
6262 ; CHECK-NEXT: set_local 4, pop{{$}}
6363 ; CHECK-NEXT: return (get_local 4){{$}}
6464 define i32 @oeq_f64(double %x, double %y) {
6868 }
6969
7070 ; CHECK-LABEL: une_f64:
71 ; CHECK: ne (get_local 3), (get_local 2){{$}}
71 ; CHECK: ne push, (get_local 3), (get_local 2){{$}}
7272 ; CHECK-NEXT: set_local 4, pop{{$}}
7373 define i32 @une_f64(double %x, double %y) {
7474 %a = fcmp une double %x, %y
7777 }
7878
7979 ; CHECK-LABEL: olt_f64:
80 ; CHECK: lt (get_local 3), (get_local 2){{$}}
80 ; CHECK: lt push, (get_local 3), (get_local 2){{$}}
8181 ; CHECK-NEXT: set_local 4, pop{{$}}
8282 define i32 @olt_f64(double %x, double %y) {
8383 %a = fcmp olt double %x, %y
8686 }
8787
8888 ; CHECK-LABEL: ole_f64:
89 ; CHECK: le (get_local 3), (get_local 2){{$}}
89 ; CHECK: le push, (get_local 3), (get_local 2){{$}}
9090 ; CHECK-NEXT: set_local 4, pop{{$}}
9191 define i32 @ole_f64(double %x, double %y) {
9292 %a = fcmp ole double %x, %y
9595 }
9696
9797 ; CHECK-LABEL: ogt_f64:
98 ; CHECK: gt (get_local 3), (get_local 2){{$}}
98 ; CHECK: gt push, (get_local 3), (get_local 2){{$}}
9999 ; CHECK-NEXT: set_local 4, pop{{$}}
100100 define i32 @ogt_f64(double %x, double %y) {
101101 %a = fcmp ogt double %x, %y
104104 }
105105
106106 ; CHECK-LABEL: oge_f64:
107 ; CHECK: ge (get_local 3), (get_local 2){{$}}
107 ; CHECK: ge push, (get_local 3), (get_local 2){{$}}
108108 ; CHECK-NEXT: set_local 4, pop{{$}}
109109 define i32 @oge_f64(double %x, double %y) {
110110 %a = fcmp oge double %x, %y
123123 ; CHECK-NEXT: set_local 2, pop{{$}}
124124 ; CHECK-NEXT: get_local 0{{$}}
125125 ; CHECK-NEXT: set_local 3, pop{{$}}
126 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
126 ; CHECK-NEXT: eq push, (get_local 3), (get_local 2){{$}}
127127 ; CHECK-NEXT: set_local 4, pop{{$}}
128 ; CHECK-NEXT: ne (get_local 2), (get_local 2){{$}}
128 ; CHECK-NEXT: ne push, (get_local 2), (get_local 2){{$}}
129129 ; CHECK-NEXT: set_local 5, pop{{$}}
130 ; CHECK-NEXT: ne (get_local 3), (get_local 3){{$}}
130 ; CHECK-NEXT: ne push, (get_local 3), (get_local 3){{$}}
131131 ; CHECK-NEXT: set_local 6, pop{{$}}
132 ; CHECK-NEXT: or (get_local 6), (get_local 5){{$}}
132 ; CHECK-NEXT: or push, (get_local 6), (get_local 5){{$}}
133133 ; CHECK-NEXT: set_local 7, pop{{$}}
134 ; CHECK-NEXT: or (get_local 4), (get_local 7){{$}}
134 ; CHECK-NEXT: or push, (get_local 4), (get_local 7){{$}}
135135 ; CHECK-NEXT: set_local 8, pop{{$}}
136136 ; CHECK-NEXT: return (get_local 8){{$}}
137137 define i32 @ueq_f64(double %x, double %y) {
141141 }
142142
143143 ; CHECK-LABEL: one_f64:
144 ; CHECK: ne (get_local 3), (get_local 2){{$}}
144 ; CHECK: ne push, (get_local 3), (get_local 2){{$}}
145145 ; CHECK-NEXT: set_local 4, pop{{$}}
146146 define i32 @one_f64(double %x, double %y) {
147147 %a = fcmp one double %x, %y
150150 }
151151
152152 ; CHECK-LABEL: ult_f64:
153 ; CHECK: lt (get_local 3), (get_local 2){{$}}
153 ; CHECK: lt push, (get_local 3), (get_local 2){{$}}
154154 ; CHECK-NEXT: set_local 4, pop{{$}}
155155 define i32 @ult_f64(double %x, double %y) {
156156 %a = fcmp ult double %x, %y
159159 }
160160
161161 ; CHECK-LABEL: ule_f64:
162 ; CHECK: le (get_local 3), (get_local 2){{$}}
162 ; CHECK: le push, (get_local 3), (get_local 2){{$}}
163163 ; CHECK-NEXT: set_local 4, pop{{$}}
164164 define i32 @ule_f64(double %x, double %y) {
165165 %a = fcmp ule double %x, %y
168168 }
169169
170170 ; CHECK-LABEL: ugt_f64:
171 ; CHECK: gt (get_local 3), (get_local 2){{$}}
171 ; CHECK: gt push, (get_local 3), (get_local 2){{$}}
172172 ; CHECK-NEXT: set_local 4, pop{{$}}
173173 define i32 @ugt_f64(double %x, double %y) {
174174 %a = fcmp ugt double %x, %y
177177 }
178178
179179 ; CHECK-LABEL: uge_f64:
180 ; CHECK: ge (get_local 3), (get_local 2){{$}}
180 ; CHECK: ge push, (get_local 3), (get_local 2){{$}}
181181 ; CHECK-NEXT: set_local 4, pop{{$}}
182182 define i32 @uge_f64(double %x, double %y) {
183183 %a = fcmp uge double %x, %y
1313 ; CHECK-NEXT: set_local 2, pop{{$}}
1414 ; CHECK-NEXT: get_local 0{{$}}
1515 ; CHECK-NEXT: set_local 3, pop{{$}}
16 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
16 ; CHECK-NEXT: eq push, (get_local 3), (get_local 2){{$}}
1717 ; CHECK-NEXT: set_local 4, pop{{$}}
1818 ; CHECK-NEXT: return (get_local 4){{$}}
1919 define i32 @eq_i32(i32 %x, i32 %y) {
2323 }
2424
2525 ; CHECK-LABEL: ne_i32:
26 ; CHECK: ne (get_local 3), (get_local 2){{$}}
26 ; CHECK: ne push, (get_local 3), (get_local 2){{$}}
2727 ; CHECK-NEXT: set_local 4, pop{{$}}
2828 define i32 @ne_i32(i32 %x, i32 %y) {
2929 %a = icmp ne i32 %x, %y
3232 }
3333
3434 ; CHECK-LABEL: slt_i32:
35 ; CHECK: i32.lt_s (get_local 3), (get_local 2){{$}}
35 ; CHECK: i32.lt_s push, (get_local 3), (get_local 2){{$}}
3636 ; CHECK-NEXT: set_local 4, pop{{$}}
3737 define i32 @slt_i32(i32 %x, i32 %y) {
3838 %a = icmp slt i32 %x, %y
4141 }
4242
4343 ; CHECK-LABEL: sle_i32:
44 ; CHECK: i32.le_s (get_local 3), (get_local 2){{$}}
44 ; CHECK: i32.le_s push, (get_local 3), (get_local 2){{$}}
4545 ; CHECK-NEXT: set_local 4, pop{{$}}
4646 define i32 @sle_i32(i32 %x, i32 %y) {
4747 %a = icmp sle i32 %x, %y
5050 }
5151
5252 ; CHECK-LABEL: ult_i32:
53 ; CHECK: i32.lt_u (get_local 3), (get_local 2){{$}}
53 ; CHECK: i32.lt_u push, (get_local 3), (get_local 2){{$}}
5454 ; CHECK-NEXT: set_local 4, pop{{$}}
5555 define i32 @ult_i32(i32 %x, i32 %y) {
5656 %a = icmp ult i32 %x, %y
5959 }
6060
6161 ; CHECK-LABEL: ule_i32:
62 ; CHECK: i32.le_u (get_local 3), (get_local 2){{$}}
62 ; CHECK: i32.le_u push, (get_local 3), (get_local 2){{$}}
6363 ; CHECK-NEXT: set_local 4, pop{{$}}
6464 define i32 @ule_i32(i32 %x, i32 %y) {
6565 %a = icmp ule i32 %x, %y
6868 }
6969
7070 ; CHECK-LABEL: sgt_i32:
71 ; CHECK: i32.gt_s (get_local 3), (get_local 2){{$}}
71 ; CHECK: i32.gt_s push, (get_local 3), (get_local 2){{$}}
7272 ; CHECK-NEXT: set_local 4, pop{{$}}
7373 define i32 @sgt_i32(i32 %x, i32 %y) {
7474 %a = icmp sgt i32 %x, %y
7777 }
7878
7979 ; CHECK-LABEL: sge_i32:
80 ; CHECK: i32.ge_s (get_local 3), (get_local 2){{$}}
80 ; CHECK: i32.ge_s push, (get_local 3), (get_local 2){{$}}
8181 ; CHECK-NEXT: set_local 4, pop{{$}}
8282 define i32 @sge_i32(i32 %x, i32 %y) {
8383 %a = icmp sge i32 %x, %y
8686 }
8787
8888 ; CHECK-LABEL: ugt_i32:
89 ; CHECK: i32.gt_u (get_local 3), (get_local 2){{$}}
89 ; CHECK: i32.gt_u push, (get_local 3), (get_local 2){{$}}
9090 ; CHECK-NEXT: set_local 4, pop{{$}}
9191 define i32 @ugt_i32(i32 %x, i32 %y) {
9292 %a = icmp ugt i32 %x, %y
9595 }
9696
9797 ; CHECK-LABEL: uge_i32:
98 ; CHECK: i32.ge_u (get_local 3), (get_local 2){{$}}
98 ; CHECK: i32.ge_u push, (get_local 3), (get_local 2){{$}}
9999 ; CHECK-NEXT: set_local 4, pop{{$}}
100100 define i32 @uge_i32(i32 %x, i32 %y) {
101101 %a = icmp uge i32 %x, %y
1313 ; CHECK-NEXT: set_local 2, pop{{$}}
1414 ; CHECK-NEXT: get_local 0{{$}}
1515 ; CHECK-NEXT: set_local 3, pop{{$}}
16 ; CHECK-NEXT: eq (get_local 3), (get_local 2){{$}}
16 ; CHECK-NEXT: eq push, (get_local 3), (get_local 2){{$}}
1717 ; CHECK-NEXT: set_local 4, pop{{$}}
1818 ; CHECK-NEXT: return (get_local 4){{$}}
1919 define i32 @eq_i64(i64 %x, i64 %y) {
2323 }
2424
2525 ; CHECK-LABEL: ne_i64:
26 ; CHECK: ne (get_local 3), (get_local 2){{$}}
26 ; CHECK: ne push, (get_local 3), (get_local 2){{$}}
2727 ; CHECK-NEXT: set_local 4, pop{{$}}
2828 define i32 @ne_i64(i64 %x, i64 %y) {
2929 %a = icmp ne i64 %x, %y
3232 }
3333
3434 ; CHECK-LABEL: slt_i64:
35 ; CHECK: i64.lt_s (get_local 3), (get_local 2){{$}}
35 ; CHECK: i64.lt_s push, (get_local 3), (get_local 2){{$}}
3636 ; CHECK-NEXT: set_local 4, pop{{$}}
3737 define i32 @slt_i64(i64 %x, i64 %y) {
3838 %a = icmp slt i64 %x, %y
4141 }
4242
4343 ; CHECK-LABEL: sle_i64:
44 ; CHECK: i64.le_s (get_local 3), (get_local 2){{$}}
44 ; CHECK: i64.le_s push, (get_local 3), (get_local 2){{$}}
4545 ; CHECK-NEXT: set_local 4, pop{{$}}
4646 define i32 @sle_i64(i64 %x, i64 %y) {
4747 %a = icmp sle i64 %x, %y
5050 }
5151
5252 ; CHECK-LABEL: ult_i64:
53 ; CHECK: i64.lt_u (get_local 3), (get_local 2){{$}}
53 ; CHECK: i64.lt_u push, (get_local 3), (get_local 2){{$}}
5454 ; CHECK-NEXT: set_local 4, pop{{$}}
5555 define i32 @ult_i64(i64 %x, i64 %y) {
5656 %a = icmp ult i64 %x, %y
5959 }
6060
6161 ; CHECK-LABEL: ule_i64:
62 ; CHECK: i64.le_u (get_local 3), (get_local 2){{$}}
62 ; CHECK: i64.le_u push, (get_local 3), (get_local 2){{$}}
6363 ; CHECK-NEXT: set_local 4, pop{{$}}
6464 define i32 @ule_i64(i64 %x, i64 %y) {
6565 %a = icmp ule i64 %x, %y
6868 }
6969
7070 ; CHECK-LABEL: sgt_i64:
71 ; CHECK: i64.gt_s (get_local 3), (get_local 2){{$}}
71 ; CHECK: i64.gt_s push, (get_local 3), (get_local 2){{$}}
7272 ; CHECK-NEXT: set_local 4, pop{{$}}
7373 define i32 @sgt_i64(i64 %x, i64 %y) {
7474 %a = icmp sgt i64 %x, %y
7777 }
7878
7979 ; CHECK-LABEL: sge_i64:
80 ; CHECK: i64.ge_s (get_local 3), (get_local 2){{$}}
80 ; CHECK: i64.ge_s push, (get_local 3), (get_local 2){{$}}
8181 ; CHECK-NEXT: set_local 4, pop{{$}}
8282 define i32 @sge_i64(i64 %x, i64 %y) {
8383 %a = icmp sge i64 %x, %y
8686 }
8787
8888 ; CHECK-LABEL: ugt_i64:
89 ; CHECK: i64.gt_u (get_local 3), (get_local 2){{$}}
89 ; CHECK: i64.gt_u push, (get_local 3), (get_local 2){{$}}
9090 ; CHECK-NEXT: set_local 4, pop{{$}}
9191 define i32 @ugt_i64(i64 %x, i64 %y) {
9292 %a = icmp ugt i64 %x, %y
9595 }
9696
9797 ; CHECK-LABEL: uge_i64:
98 ; CHECK: i64.ge_u (get_local 3), (get_local 2){{$}}
98 ; CHECK: i64.ge_u push, (get_local 3), (get_local 2){{$}}
9999 ; CHECK-NEXT: set_local 4, pop{{$}}
100100 define i32 @uge_i64(i64 %x, i64 %y) {
101101 %a = icmp uge i64 %x, %y
1010 ; CHECK-NEXT: .local i64, i32{{$}}
1111 ; CHECK-NEXT: get_local 0{{$}}
1212 ; CHECK-NEXT: set_local 1, pop{{$}}
13 ; CHECK-NEXT: i32.wrap/i64 (get_local 1){{$}}
13 ; CHECK-NEXT: i32.wrap/i64 push, (get_local 1){{$}}
1414 ; CHECK-NEXT: set_local 2, pop{{$}}
1515 ; CHECK-NEXT: return (get_local 2){{$}}
1616 define i32 @i32_wrap_i64(i64 %x) {
2424 ; CHECK-NEXT: .local i32, i64{{$}}
2525 ; CHECK-NEXT: get_local 0{{$}}
2626 ; CHECK-NEXT: set_local 1, pop{{$}}
27 ; CHECK-NEXT: i64.extend_s/i32 (get_local 1){{$}}
27 ; CHECK-NEXT: i64.extend_s/i32 push, (get_local 1){{$}}
2828 ; CHECK-NEXT: set_local 2, pop{{$}}
2929 ; CHECK-NEXT: return (get_local 2){{$}}
3030 define i64 @i64_extend_s_i32(i32 %x) {
3838 ; CHECK-NEXT: .local i32, i64{{$}}
3939 ; CHECK-NEXT: get_local 0{{$}}
4040 ; CHECK-NEXT: set_local 1, pop{{$}}
41 ; CHECK-NEXT: i64.extend_u/i32 (get_local 1){{$}}
41 ; CHECK-NEXT: i64.extend_u/i32 push, (get_local 1){{$}}
4242 ; CHECK-NEXT: set_local 2, pop{{$}}
4343 ; CHECK-NEXT: return (get_local 2){{$}}
4444 define i64 @i64_extend_u_i32(i32 %x) {
5252 ; CHECK-NEXT: .local f32, i32{{$}}
5353 ; CHECK-NEXT: get_local 0{{$}}
5454 ; CHECK-NEXT: set_local 1, pop{{$}}
55 ; CHECK-NEXT: i32.trunc_s/f32 (get_local 1){{$}}
55 ; CHECK-NEXT: i32.trunc_s/f32 push, (get_local 1){{$}}
5656 ; CHECK-NEXT: set_local 2, pop{{$}}
5757 ; CHECK-NEXT: return (get_local 2){{$}}
5858 define i32 @i32_trunc_s_f32(float %x) {
6666 ; CHECK-NEXT: .local f32, i32{{$}}
6767 ; CHECK-NEXT: get_local 0{{$}}
6868 ; CHECK-NEXT: set_local 1, pop{{$}}
69 ; CHECK-NEXT: i32.trunc_u/f32 (get_local 1){{$}}
69 ; CHECK-NEXT: i32.trunc_u/f32 push, (get_local 1){{$}}
7070 ; CHECK-NEXT: set_local 2, pop{{$}}
7171 ; CHECK-NEXT: return (get_local 2){{$}}
7272 define i32 @i32_trunc_u_f32(float %x) {
8080 ; CHECK-NEXT: .local f64, i32{{$}}
8181 ; CHECK-NEXT: get_local 0{{$}}
8282 ; CHECK-NEXT: set_local 1, pop{{$}}
83 ; CHECK-NEXT: i32.trunc_s/f64 (get_local 1){{$}}
83 ; CHECK-NEXT: i32.trunc_s/f64 push, (get_local 1){{$}}
8484 ; CHECK-NEXT: set_local 2, pop{{$}}
8585 ; CHECK-NEXT: return (get_local 2){{$}}
8686 define i32 @i32_trunc_s_f64(double %x) {
9494 ; CHECK-NEXT: .local f64, i32{{$}}
9595 ; CHECK-NEXT: get_local 0{{$}}
9696 ; CHECK-NEXT: set_local 1, pop{{$}}
97 ; CHECK-NEXT: i32.trunc_u/f64 (get_local 1){{$}}
97 ; CHECK-NEXT: i32.trunc_u/f64 push, (get_local 1){{$}}
9898 ; CHECK-NEXT: set_local 2, pop{{$}}
9999 ; CHECK-NEXT: return (get_local 2){{$}}
100100 define i32 @i32_trunc_u_f64(double %x) {
108108 ; CHECK-NEXT: .local f32, i64{{$}}
109109 ; CHECK-NEXT: get_local 0{{$}}
110110 ; CHECK-NEXT: set_local 1, pop{{$}}
111 ; CHECK-NEXT: i64.trunc_s/f32 (get_local 1){{$}}
111 ; CHECK-NEXT: i64.trunc_s/f32 push, (get_local 1){{$}}
112112 ; CHECK-NEXT: set_local 2, pop{{$}}
113113 ; CHECK-NEXT: return (get_local 2){{$}}
114114 define i64 @i64_trunc_s_f32(float %x) {
122122 ; CHECK-NEXT: .local f32, i64{{$}}
123123 ; CHECK-NEXT: get_local 0{{$}}
124124 ; CHECK-NEXT: set_local 1, pop{{$}}
125 ; CHECK-NEXT: i64.trunc_u/f32 (get_local 1){{$}}
125 ; CHECK-NEXT: i64.trunc_u/f32 push, (get_local 1){{$}}
126126 ; CHECK-NEXT: set_local 2, pop{{$}}
127127 ; CHECK-NEXT: return (get_local 2){{$}}
128128 define i64 @i64_trunc_u_f32(float %x) {
136136 ; CHECK-NEXT: .local f64, i64{{$}}
137137 ; CHECK-NEXT: get_local 0{{$}}
138138 ; CHECK-NEXT: set_local 1, pop{{$}}
139 ; CHECK-NEXT: i64.trunc_s/f64 (get_local 1){{$}}
139 ; CHECK-NEXT: i64.trunc_s/f64 push, (get_local 1){{$}}
140140 ; CHECK-NEXT: set_local 2, pop{{$}}
141141 ; CHECK-NEXT: return (get_local 2){{$}}
142142 define i64 @i64_trunc_s_f64(double %x) {
150150 ; CHECK-NEXT: .local f64, i64{{$}}
151151 ; CHECK-NEXT: get_local 0{{$}}
152152 ; CHECK-NEXT: set_local 1, pop{{$}}
153 ; CHECK-NEXT: i64.trunc_u/f64 (get_local 1){{$}}
153 ; CHECK-NEXT: i64.trunc_u/f64 push, (get_local 1){{$}}
154154 ; CHECK-NEXT: set_local 2, pop{{$}}
155155 ; CHECK-NEXT: return (get_local 2){{$}}
156156 define i64 @i64_trunc_u_f64(double %x) {
164164 ; CHECK-NEXT: .local i32, f32{{$}}
165165 ; CHECK-NEXT: get_local 0{{$}}
166166 ; CHECK-NEXT: set_local 1, pop{{$}}
167 ; CHECK-NEXT: f32.convert_s/i32 (get_local 1){{$}}
167 ; CHECK-NEXT: f32.convert_s/i32 push, (get_local 1){{$}}
168168 ; CHECK-NEXT: set_local 2, pop{{$}}
169169 ; CHECK-NEXT: return (get_local 2){{$}}
170170 define float @f32_convert_s_i32(i32 %x) {
178178 ; CHECK-NEXT: .local i32, f32{{$}}
179179 ; CHECK-NEXT: get_local 0{{$}}
180180 ; CHECK-NEXT: set_local 1, pop{{$}}
181 ; CHECK-NEXT: f32.convert_u/i32 (get_local 1){{$}}
181 ; CHECK-NEXT: f32.convert_u/i32 push, (get_local 1){{$}}
182182 ; CHECK-NEXT: set_local 2, pop{{$}}
183183 ; CHECK-NEXT: return (get_local 2){{$}}
184184 define float @f32_convert_u_i32(i32 %x) {
192192 ; CHECK-NEXT: .local i32, f64{{$}}
193193 ; CHECK-NEXT: get_local 0{{$}}
194194 ; CHECK-NEXT: set_local 1, pop{{$}}
195 ; CHECK-NEXT: f64.convert_s/i32 (get_local 1){{$}}
195 ; CHECK-NEXT: f64.convert_s/i32 push, (get_local 1){{$}}
196196 ; CHECK-NEXT: set_local 2, pop{{$}}
197197 ; CHECK-NEXT: return (get_local 2){{$}}
198198 define double @f64_convert_s_i32(i32 %x) {
206206 ; CHECK-NEXT: .local i32, f64{{$}}
207207 ; CHECK-NEXT: get_local 0{{$}}
208208 ; CHECK-NEXT: set_local 1, pop{{$}}
209 ; CHECK-NEXT: f64.convert_u/i32 (get_local 1){{$}}
209 ; CHECK-NEXT: f64.convert_u/i32 push, (get_local 1){{$}}
210210 ; CHECK-NEXT: set_local 2, pop{{$}}
211211 ; CHECK-NEXT: return (get_local 2){{$}}
212212 define double @f64_convert_u_i32(i32 %x) {
220220 ; CHECK-NEXT: .local i64, f32{{$}}
221221 ; CHECK-NEXT: get_local 0{{$}}
222222 ; CHECK-NEXT: set_local 1, pop{{$}}
223 ; CHECK-NEXT: f32.convert_s/i64 (get_local 1){{$}}
223 ; CHECK-NEXT: f32.convert_s/i64 push, (get_local 1){{$}}
224224 ; CHECK-NEXT: set_local 2, pop{{$}}
225225 ; CHECK-NEXT: return (get_local 2){{$}}
226226 define float @f32_convert_s_i64(i64 %x) {
234234 ; CHECK-NEXT: .local i64, f32{{$}}
235235 ; CHECK-NEXT: get_local 0{{$}}
236236 ; CHECK-NEXT: set_local 1, pop{{$}}
237 ; CHECK-NEXT: f32.convert_u/i64 (get_local 1){{$}}
237 ; CHECK-NEXT: f32.convert_u/i64 push, (get_local 1){{$}}
238238 ; CHECK-NEXT: set_local 2, pop{{$}}
239239 ; CHECK-NEXT: return (get_local 2){{$}}
240240 define float @f32_convert_u_i64(i64 %x) {
248248 ; CHECK-NEXT: .local i64, f64{{$}}
249249 ; CHECK-NEXT: get_local 0{{$}}
250250 ; CHECK-NEXT: set_local 1, pop{{$}}
251 ; CHECK-NEXT: f64.convert_s/i64 (get_local 1){{$}}
251 ; CHECK-NEXT: f64.convert_s/i64 push, (get_local 1){{$}}
252252 ; CHECK-NEXT: set_local 2, pop{{$}}
253253 ; CHECK-NEXT: return (get_local 2){{$}}
254254 define double @f64_convert_s_i64(i64 %x) {
262262 ; CHECK-NEXT: .local i64, f64{{$}}
263263 ; CHECK-NEXT: get_local 0{{$}}
264264 ; CHECK-NEXT: set_local 1, pop{{$}}
265 ; CHECK-NEXT: f64.convert_u/i64 (get_local 1){{$}}
265 ; CHECK-NEXT: f64.convert_u/i64 push, (get_local 1){{$}}
266266 ; CHECK-NEXT: set_local 2, pop{{$}}
267267 ; CHECK-NEXT: return (get_local 2){{$}}
268268 define double @f64_convert_u_i64(i64 %x) {
276276 ; CHECK-NEXT: .local f32, f64{{$}}
277277 ; CHECK-NEXT: get_local 0{{$}}
278278 ; CHECK-NEXT: set_local 1, pop{{$}}
279 ; CHECK-NEXT: f64.promote/f32 (get_local 1){{$}}
279 ; CHECK-NEXT: f64.promote/f32 push, (get_local 1){{$}}
280280 ; CHECK-NEXT: set_local 2, pop{{$}}
281281 ; CHECK-NEXT: return (get_local 2){{$}}
282282 define double @f64_promote_f32(float %x) {
290290 ; CHECK-NEXT: .local f64, f32{{$}}
291291 ; CHECK-NEXT: get_local 0{{$}}
292292 ; CHECK-NEXT: set_local 1, pop{{$}}
293 ; CHECK-NEXT: f32.demote/f64 (get_local 1){{$}}
293 ; CHECK-NEXT: f32.demote/f64 push, (get_local 1){{$}}
294294 ; CHECK-NEXT: set_local 2, pop{{$}}
295295 ; CHECK-NEXT: return (get_local 2){{$}}
296296 define float @f32_demote_f64(double %x) {
2222 ; CHECK-NEXT: set_local 2, pop{{$}}
2323 ; CHECK-NEXT: get_local 0{{$}}
2424 ; CHECK-NEXT: set_local 3, pop{{$}}
25 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
25 ; CHECK-NEXT: add push, (get_local 3), (get_local 2){{$}}
2626 ; CHECK-NEXT: set_local 4, pop{{$}}
2727 ; CHECK-NEXT: return (get_local 4){{$}}
2828 define float @fadd32(float %x, float %y) {
3131 }
3232
3333 ; CHECK-LABEL: fsub32:
34 ; CHECK: sub (get_local 3), (get_local 2){{$}}
34 ; CHECK: sub push, (get_local 3), (get_local 2){{$}}
3535 ; CHECK-NEXT: set_local 4, pop{{$}}
3636 define float @fsub32(float %x, float %y) {
3737 %a = fsub float %x, %y
3939 }
4040
4141 ; CHECK-LABEL: fmul32:
42 ; CHECK: mul (get_local 3), (get_local 2){{$}}
42 ; CHECK: mul push, (get_local 3), (get_local 2){{$}}
4343 ; CHECK-NEXT: set_local 4, pop{{$}}
4444 define float @fmul32(float %x, float %y) {
4545 %a = fmul float %x, %y
4747 }
4848
4949 ; CHECK-LABEL: fdiv32:
50 ; CHECK: div (get_local 3), (get_local 2){{$}}
50 ; CHECK: div push, (get_local 3), (get_local 2){{$}}
5151 ; CHECK-NEXT: set_local 4, pop{{$}}
5252 define float @fdiv32(float %x, float %y) {
5353 %a = fdiv float %x, %y
5555 }
5656
5757 ; CHECK-LABEL: fabs32:
58 ; CHECK: abs (get_local 1){{$}}
58 ; CHECK: abs push, (get_local 1){{$}}
5959 ; CHECK-NEXT: set_local 2, pop{{$}}
6060 define float @fabs32(float %x) {
6161 %a = call float @llvm.fabs.f32(float %x)
6363 }
6464
6565 ; CHECK-LABEL: fneg32:
66 ; CHECK: neg (get_local 1){{$}}
66 ; CHECK: neg push, (get_local 1){{$}}
6767 ; CHECK-NEXT: set_local 2, pop{{$}}
6868 define float @fneg32(float %x) {
6969 %a = fsub float -0., %x
7171 }
7272
7373 ; CHECK-LABEL: copysign32:
74 ; CHECK: copysign (get_local 3), (get_local 2){{$}}
74 ; CHECK: copysign push, (get_local 3), (get_local 2){{$}}
7575 ; CHECK-NEXT: set_local 4, pop{{$}}
7676 define float @copysign32(float %x, float %y) {
7777 %a = call float @llvm.copysign.f32(float %x, float %y)
7979 }
8080
8181 ; CHECK-LABEL: sqrt32:
82 ; CHECK: sqrt (get_local 1){{$}}
82 ; CHECK: sqrt push, (get_local 1){{$}}
8383 ; CHECK-NEXT: set_local 2, pop{{$}}
8484 define float @sqrt32(float %x) {
8585 %a = call float @llvm.sqrt.f32(float %x)
8787 }
8888
8989 ; CHECK-LABEL: ceil32:
90 ; CHECK: ceil (get_local 1){{$}}
90 ; CHECK: ceil push, (get_local 1){{$}}
9191 ; CHECK-NEXT: set_local 2, pop{{$}}
9292 define float @ceil32(float %x) {
9393 %a = call float @llvm.ceil.f32(float %x)
9595 }
9696
9797 ; CHECK-LABEL: floor32:
98 ; CHECK: floor (get_local 1){{$}}
98 ; CHECK: floor push, (get_local 1){{$}}
9999 ; CHECK-NEXT: set_local 2, pop{{$}}
100100 define float @floor32(float %x) {
101101 %a = call float @llvm.floor.f32(float %x)
103103 }
104104
105105 ; CHECK-LABEL: trunc32:
106 ; CHECK: trunc (get_local 1){{$}}
106 ; CHECK: trunc push, (get_local 1){{$}}
107107 ; CHECK-NEXT: set_local 2, pop{{$}}
108108 define float @trunc32(float %x) {
109109 %a = call float @llvm.trunc.f32(float %x)
111111 }
112112
113113 ; CHECK-LABEL: nearest32:
114 ; CHECK: nearest (get_local 1){{$}}
114 ; CHECK: nearest push, (get_local 1){{$}}
115115 ; CHECK-NEXT: set_local 2, pop{{$}}
116116 define float @nearest32(float %x) {
117117 %a = call float @llvm.nearbyint.f32(float %x)
119119 }
120120
121121 ; CHECK-LABEL: nearest32_via_rint:
122 ; CHECK: nearest (get_local 1){{$}}
122 ; CHECK: nearest push, (get_local 1){{$}}
123123 ; CHECK-NEXT: set_local 2, pop{{$}}
124124 define float @nearest32_via_rint(float %x) {
125125 %a = call float @llvm.rint.f32(float %x)
2222 ; CHECK-NEXT: set_local 2, pop{{$}}
2323 ; CHECK-NEXT: get_local 0{{$}}
2424 ; CHECK-NEXT: set_local 3, pop{{$}}
25 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
25 ; CHECK-NEXT: add push, (get_local 3), (get_local 2){{$}}
2626 ; CHECK-NEXT: set_local 4, pop{{$}}
2727 ; CHECK-NEXT: return (get_local 4){{$}}
2828 define double @fadd64(double %x, double %y) {
3131 }
3232
3333 ; CHECK-LABEL: fsub64:
34 ; CHECK: sub (get_local 3), (get_local 2){{$}}
34 ; CHECK: sub push, (get_local 3), (get_local 2){{$}}
3535 ; CHECK-NEXT: set_local 4, pop{{$}}
3636 define double @fsub64(double %x, double %y) {
3737 %a = fsub double %x, %y
3939 }
4040
4141 ; CHECK-LABEL: fmul64:
42 ; CHECK: mul (get_local 3), (get_local 2){{$}}
42 ; CHECK: mul push, (get_local 3), (get_local 2){{$}}
4343 ; CHECK-NEXT: set_local 4, pop{{$}}
4444 define double @fmul64(double %x, double %y) {
4545 %a = fmul double %x, %y
4747 }
4848
4949 ; CHECK-LABEL: fdiv64:
50 ; CHECK: div (get_local 3), (get_local 2){{$}}
50 ; CHECK: div push, (get_local 3), (get_local 2){{$}}
5151 ; CHECK-NEXT: set_local 4, pop{{$}}
5252 define double @fdiv64(double %x, double %y) {
5353 %a = fdiv double %x, %y
5555 }
5656
5757 ; CHECK-LABEL: fabs64:
58 ; CHECK: abs (get_local 1){{$}}
58 ; CHECK: abs push, (get_local 1){{$}}
5959 ; CHECK-NEXT: set_local 2, pop{{$}}
6060 define double @fabs64(double %x) {
6161 %a = call double @llvm.fabs.f64(double %x)
6363 }
6464
6565 ; CHECK-LABEL: fneg64:
66 ; CHECK: neg (get_local 1){{$}}
66 ; CHECK: neg push, (get_local 1){{$}}
6767 ; CHECK-NEXT: set_local 2, pop{{$}}
6868 define double @fneg64(double %x) {
6969 %a = fsub double -0., %x
7171 }
7272
7373 ; CHECK-LABEL: copysign64:
74 ; CHECK: copysign (get_local 3), (get_local 2){{$}}
74 ; CHECK: copysign push, (get_local 3), (get_local 2){{$}}
7575 ; CHECK-NEXT: set_local 4, pop{{$}}
7676 define double @copysign64(double %x, double %y) {
7777 %a = call double @llvm.copysign.f64(double %x, double %y)
7979 }
8080
8181 ; CHECK-LABEL: sqrt64:
82 ; CHECK: sqrt (get_local 1){{$}}
82 ; CHECK: sqrt push, (get_local 1){{$}}
8383 ; CHECK-NEXT: set_local 2, pop{{$}}
8484 define double @sqrt64(double %x) {
8585 %a = call double @llvm.sqrt.f64(double %x)
8787 }
8888
8989 ; CHECK-LABEL: ceil64:
90 ; CHECK: ceil (get_local 1){{$}}
90 ; CHECK: ceil push, (get_local 1){{$}}
9191 ; CHECK-NEXT: set_local 2, pop{{$}}
9292 define double @ceil64(double %x) {
9393 %a = call double @llvm.ceil.f64(double %x)
9595 }
9696
9797 ; CHECK-LABEL: floor64:
98 ; CHECK: floor (get_local 1){{$}}
98 ; CHECK: floor push, (get_local 1){{$}}
9999 ; CHECK-NEXT: set_local 2, pop{{$}}
100100 define double @floor64(double %x) {
101101 %a = call double @llvm.floor.f64(double %x)
103103 }
104104
105105 ; CHECK-LABEL: trunc64:
106 ; CHECK: trunc (get_local 1){{$}}
106 ; CHECK: trunc push, (get_local 1){{$}}
107107 ; CHECK-NEXT: set_local 2, pop{{$}}
108108 define double @trunc64(double %x) {
109109 %a = call double @llvm.trunc.f64(double %x)
111111 }
112112
113113 ; CHECK-LABEL: nearest64:
114 ; CHECK: nearest (get_local 1){{$}}
114 ; CHECK: nearest push, (get_local 1){{$}}
115115 ; CHECK-NEXT: set_local 2, pop{{$}}
116116 define double @nearest64(double %x) {
117117 %a = call double @llvm.nearbyint.f64(double %x)
119119 }
120120
121121 ; CHECK-LABEL: nearest64_via_rint:
122 ; CHECK: nearest (get_local 1){{$}}
122 ; CHECK: nearest push, (get_local 1){{$}}
123123 ; CHECK-NEXT: set_local 2, pop{{$}}
124124 define double @nearest64_via_rint(double %x) {
125125 %a = call double @llvm.rint.f64(double %x)
1717 ; CHECK-NEXT: set_local 2, pop{{$}}
1818 ; CHECK-NEXT: get_local 0{{$}}
1919 ; CHECK-NEXT: set_local 3, pop{{$}}
20 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
20 ; CHECK-NEXT: add push, (get_local 3), (get_local 2){{$}}
2121 ; CHECK-NEXT: set_local 4, pop{{$}}
2222 ; CHECK-NEXT: return (get_local 4){{$}}
2323 define i32 @add32(i32 %x, i32 %y) {
3434 ; CHECK-NEXT: set_local 2, pop{{$}}
3535 ; CHECK-NEXT: get_local 0{{$}}
3636 ; CHECK-NEXT: set_local 3, pop{{$}}
37 ; CHECK-NEXT: sub (get_local 3), (get_local 2){{$}}
37 ; CHECK-NEXT: sub push, (get_local 3), (get_local 2){{$}}
3838 ; CHECK-NEXT: set_local 4, pop{{$}}
3939 ; CHECK-NEXT: return (get_local 4){{$}}
4040 define i32 @sub32(i32 %x, i32 %y) {
5151 ; CHECK-NEXT: set_local 2, pop{{$}}
5252 ; CHECK-NEXT: get_local 0{{$}}
5353 ; CHECK-NEXT: set_local 3, pop{{$}}
54 ; CHECK-NEXT: mul (get_local 3), (get_local 2){{$}}
54 ; CHECK-NEXT: mul push, (get_local 3), (get_local 2){{$}}
5555 ; CHECK-NEXT: set_local 4, pop{{$}}
5656 ; CHECK-NEXT: return (get_local 4){{$}}
5757 define i32 @mul32(i32 %x, i32 %y) {
6868 ; CHECK-NEXT: set_local 2, pop{{$}}
6969 ; CHECK-NEXT: get_local 0{{$}}
7070 ; CHECK-NEXT: set_local 3, pop{{$}}
71 ; CHECK-NEXT: div_s (get_local 3), (get_local 2){{$}}
71 ; CHECK-NEXT: div_s push, (get_local 3), (get_local 2){{$}}
7272 ; CHECK-NEXT: set_local 4, pop{{$}}
7373 ; CHECK-NEXT: return (get_local 4){{$}}
7474 define i32 @sdiv32(i32 %x, i32 %y) {
8585 ; CHECK-NEXT: set_local 2, pop{{$}}
8686 ; CHECK-NEXT: get_local 0{{$}}
8787 ; CHECK-NEXT: set_local 3, pop{{$}}
88 ; CHECK-NEXT: div_u (get_local 3), (get_local 2){{$}}
88 ; CHECK-NEXT: div_u push, (get_local 3), (get_local 2){{$}}
8989 ; CHECK-NEXT: set_local 4, pop{{$}}
9090 ; CHECK-NEXT: return (get_local 4){{$}}
9191 define i32 @udiv32(i32 %x, i32 %y) {
102102 ; CHECK-NEXT: set_local 2, pop{{$}}
103103 ; CHECK-NEXT: get_local 0{{$}}
104104 ; CHECK-NEXT: set_local 3, pop{{$}}
105 ; CHECK-NEXT: rem_s (get_local 3), (get_local 2){{$}}
105 ; CHECK-NEXT: rem_s push, (get_local 3), (get_local 2){{$}}
106106 ; CHECK-NEXT: set_local 4, pop{{$}}
107107 ; CHECK-NEXT: return (get_local 4){{$}}
108108 define i32 @srem32(i32 %x, i32 %y) {
119119 ; CHECK-NEXT: set_local 2, pop{{$}}
120120 ; CHECK-NEXT: get_local 0{{$}}
121121 ; CHECK-NEXT: set_local 3, pop{{$}}
122 ; CHECK-NEXT: rem_u (get_local 3), (get_local 2){{$}}
122 ; CHECK-NEXT: rem_u push, (get_local 3), (get_local 2){{$}}
123123 ; CHECK-NEXT: set_local 4, pop{{$}}
124124 ; CHECK-NEXT: return (get_local 4){{$}}
125125 define i32 @urem32(i32 %x, i32 %y) {
136136 ; CHECK-NEXT: set_local 2, pop{{$}}
137137 ; CHECK-NEXT: get_local 0{{$}}
138138 ; CHECK-NEXT: set_local 3, pop{{$}}
139 ; CHECK-NEXT: and (get_local 3), (get_local 2){{$}}
139 ; CHECK-NEXT: and push, (get_local 3), (get_local 2){{$}}
140140 ; CHECK-NEXT: set_local 4, pop{{$}}
141141 ; CHECK-NEXT: return (get_local 4){{$}}
142142 define i32 @and32(i32 %x, i32 %y) {
153153 ; CHECK-NEXT: set_local 2, pop{{$}}
154154 ; CHECK-NEXT: get_local 0{{$}}
155155 ; CHECK-NEXT: set_local 3, pop{{$}}
156 ; CHECK-NEXT: or (get_local 3), (get_local 2){{$}}
156 ; CHECK-NEXT: or push, (get_local 3), (get_local 2){{$}}
157157 ; CHECK-NEXT: set_local 4, pop{{$}}
158158 ; CHECK-NEXT: return (get_local 4){{$}}
159159 define i32 @or32(i32 %x, i32 %y) {
170170 ; CHECK-NEXT: set_local 2, pop{{$}}
171171 ; CHECK-NEXT: get_local 0{{$}}
172172 ; CHECK-NEXT: set_local 3, pop{{$}}
173 ; CHECK-NEXT: xor (get_local 3), (get_local 2){{$}}
173 ; CHECK-NEXT: xor push, (get_local 3), (get_local 2){{$}}
174174 ; CHECK-NEXT: set_local 4, pop{{$}}
175175 ; CHECK-NEXT: return (get_local 4){{$}}
176176 define i32 @xor32(i32 %x, i32 %y) {
187187 ; CHECK-NEXT: set_local 2, pop{{$}}
188188 ; CHECK-NEXT: get_local 0{{$}}
189189 ; CHECK-NEXT: set_local 3, pop{{$}}
190 ; CHECK-NEXT: shl (get_local 3), (get_local 2){{$}}
190 ; CHECK-NEXT: shl push, (get_local 3), (get_local 2){{$}}
191191 ; CHECK-NEXT: set_local 4, pop{{$}}
192192 ; CHECK-NEXT: return (get_local 4){{$}}
193193 define i32 @shl32(i32 %x, i32 %y) {
204204 ; CHECK-NEXT: set_local 2, pop{{$}}
205205 ; CHECK-NEXT: get_local 0{{$}}
206206 ; CHECK-NEXT: set_local 3, pop{{$}}
207 ; CHECK-NEXT: shr_u (get_local 3), (get_local 2){{$}}
207 ; CHECK-NEXT: shr_u push, (get_local 3), (get_local 2){{$}}
208208 ; CHECK-NEXT: set_local 4, pop{{$}}
209209 ; CHECK-NEXT: return (get_local 4){{$}}
210210 define i32 @shr32(i32 %x, i32 %y) {
221221 ; CHECK-NEXT: set_local 2, pop{{$}}
222222 ; CHECK-NEXT: get_local 0{{$}}
223223 ; CHECK-NEXT: set_local 3, pop{{$}}
224 ; CHECK-NEXT: shr_s (get_local 3), (get_local 2){{$}}
224 ; CHECK-NEXT: shr_s push, (get_local 3), (get_local 2){{$}}
225225 ; CHECK-NEXT: set_local 4, pop{{$}}
226226 ; CHECK-NEXT: return (get_local 4){{$}}
227227 define i32 @sar32(i32 %x, i32 %y) {
235235 ; CHECK-NEXT: .local i32, i32{{$}}
236236 ; CHECK-NEXT: get_local 0{{$}}
237237 ; CHECK-NEXT: set_local 1, pop{{$}}
238 ; CHECK-NEXT: clz (get_local 1){{$}}
238 ; CHECK-NEXT: clz push, (get_local 1){{$}}
239239 ; CHECK-NEXT: set_local 2, pop{{$}}
240240 ; CHECK-NEXT: return (get_local 2){{$}}
241241 define i32 @clz32(i32 %x) {
249249 ; CHECK-NEXT: .local i32, i32{{$}}
250250 ; CHECK-NEXT: get_local 0{{$}}
251251 ; CHECK-NEXT: set_local 1, pop{{$}}
252 ; CHECK-NEXT: clz (get_local 1){{$}}
252 ; CHECK-NEXT: clz push, (get_local 1){{$}}
253253 ; CHECK-NEXT: set_local 2, pop{{$}}
254254 ; CHECK-NEXT: return (get_local 2){{$}}
255255 define i32 @clz32_zero_undef(i32 %x) {
263263 ; CHECK-NEXT: .local i32, i32{{$}}
264264 ; CHECK-NEXT: get_local 0{{$}}
265265 ; CHECK-NEXT: set_local 1, pop{{$}}
266 ; CHECK-NEXT: ctz (get_local 1){{$}}
266 ; CHECK-NEXT: ctz push, (get_local 1){{$}}
267267 ; CHECK-NEXT: set_local 2, pop{{$}}
268268 ; CHECK-NEXT: return (get_local 2){{$}}
269269 define i32 @ctz32(i32 %x) {
277277 ; CHECK-NEXT: .local i32, i32{{$}}
278278 ; CHECK-NEXT: get_local 0{{$}}
279279 ; CHECK-NEXT: set_local 1, pop{{$}}
280 ; CHECK-NEXT: ctz (get_local 1){{$}}
280 ; CHECK-NEXT: ctz push, (get_local 1){{$}}
281281 ; CHECK-NEXT: set_local 2, pop{{$}}
282282 ; CHECK-NEXT: return (get_local 2){{$}}
283283 define i32 @ctz32_zero_undef(i32 %x) {
291291 ; CHECK-NEXT: .local i32, i32{{$}}
292292 ; CHECK-NEXT: get_local 0{{$}}
293293 ; CHECK-NEXT: set_local 1, pop{{$}}
294 ; CHECK-NEXT: popcnt (get_local 1){{$}}
294 ; CHECK-NEXT: popcnt push, (get_local 1){{$}}
295295 ; CHECK-NEXT: set_local 2, pop{{$}}
296296 ; CHECK-NEXT: return (get_local 2){{$}}
297297 define i32 @popcnt32(i32 %x) {
1717 ; CHECK-NEXT: set_local 2, pop{{$}}
1818 ; CHECK-NEXT: get_local 0{{$}}
1919 ; CHECK-NEXT: set_local 3, pop{{$}}
20 ; CHECK-NEXT: add (get_local 3), (get_local 2){{$}}
20 ; CHECK-NEXT: add push, (get_local 3), (get_local 2){{$}}
2121 ; CHECK-NEXT: set_local 4, pop{{$}}
2222 ; CHECK-NEXT: return (get_local 4){{$}}
2323 define i64 @add64(i64 %x, i64 %y) {
3434 ; CHECK-NEXT: set_local 2, pop{{$}}
3535 ; CHECK-NEXT: get_local 0{{$}}
3636 ; CHECK-NEXT: set_local 3, pop{{$}}
37 ; CHECK-NEXT: sub (get_local 3), (get_local 2){{$}}
37 ; CHECK-NEXT: sub push, (get_local 3), (get_local 2){{$}}
3838 ; CHECK-NEXT: set_local 4, pop{{$}}
3939 ; CHECK-NEXT: return (get_local 4){{$}}
4040 define i64 @sub64(i64 %x, i64 %y) {
5151 ; CHECK-NEXT: set_local 2, pop{{$}}
5252 ; CHECK-NEXT: get_local 0{{$}}
5353 ; CHECK-NEXT: set_local 3, pop{{$}}
54 ; CHECK-NEXT: mul (get_local 3), (get_local 2){{$}}
54 ; CHECK-NEXT: mul push, (get_local 3), (get_local 2){{$}}
5555 ; CHECK-NEXT: set_local 4, pop{{$}}
5656 ; CHECK-NEXT: return (get_local 4){{$}}
5757 define i64 @mul64(i64 %x, i64 %y) {
6868 ; CHECK-NEXT: set_local 2, pop{{$}}
6969 ; CHECK-NEXT: get_local 0{{$}}
7070 ; CHECK-NEXT: set_local 3, pop{{$}}
71 ; CHECK-NEXT: div_s (get_local 3), (get_local 2){{$}}
71 ; CHECK-NEXT: div_s push, (get_local 3), (get_local 2){{$}}
7272 ; CHECK-NEXT: set_local 4, pop{{$}}
7373 ; CHECK-NEXT: return (get_local 4){{$}}
7474 define i64 @sdiv64(i64 %x, i64 %y) {
8585 ; CHECK-NEXT: set_local 2, pop{{$}}
8686 ; CHECK-NEXT: get_local 0{{$}}
8787 ; CHECK-NEXT: set_local 3, pop{{$}}
88 ; CHECK-NEXT: div_u (get_local 3), (get_local 2){{$}}
88 ; CHECK-NEXT: div_u push, (get_local 3), (get_local 2){{$}}
8989 ; CHECK-NEXT: set_local 4, pop{{$}}
9090 ; CHECK-NEXT: return (get_local 4){{$}}
9191 define i64 @udiv64(i64 %x, i64 %y) {
102102 ; CHECK-NEXT: set_local 2, pop{{$}}
103103 ; CHECK-NEXT: get_local 0{{$}}
104104 ; CHECK-NEXT: set_local 3, pop{{$}}
105 ; CHECK-NEXT: rem_s (get_local 3), (get_local 2){{$}}
105 ; CHECK-NEXT: rem_s push, (get_local 3), (get_local 2){{$}}
106106 ; CHECK-NEXT: set_local 4, pop{{$}}
107107 ; CHECK-NEXT: return (get_local 4){{$}}
108108 define i64 @srem64(i64 %x, i64 %y) {
119119 ; CHECK-NEXT: set_local 2, pop{{$}}
120120 ; CHECK-NEXT: get_local 0{{$}}
121121 ; CHECK-NEXT: set_local 3, pop{{$}}
122 ; CHECK-NEXT: rem_u (get_local 3), (get_local 2){{$}}
122 ; CHECK-NEXT: rem_u push, (get_local 3), (get_local 2){{$}}
123123 ; CHECK-NEXT: set_local 4, pop{{$}}
124124 ; CHECK-NEXT: return (get_local 4){{$}}
125125 define i64 @urem64(i64 %x, i64 %y) {
136136 ; CHECK-NEXT: set_local 2, pop{{$}}
137137 ; CHECK-NEXT: get_local 0{{$}}
138138 ; CHECK-NEXT: set_local 3, pop{{$}}
139 ; CHECK-NEXT: and (get_local 3), (get_local 2){{$}}
139 ; CHECK-NEXT: and push, (get_local 3), (get_local 2){{$}}
140140 ; CHECK-NEXT: set_local 4, pop{{$}}
141141 ; CHECK-NEXT: return (get_local 4){{$}}
142142 define i64 @and64(i64 %x, i64 %y) {
153153 ; CHECK-NEXT: set_local 2, pop{{$}}
154154 ; CHECK-NEXT: get_local 0{{$}}
155155 ; CHECK-NEXT: set_local 3, pop{{$}}
156 ; CHECK-NEXT: or (get_local 3), (get_local 2){{$}}
156 ; CHECK-NEXT: or push, (get_local 3), (get_local 2){{$}}
157157 ; CHECK-NEXT: set_local 4, pop{{$}}
158158 ; CHECK-NEXT: return (get_local 4){{$}}
159159 define i64 @or64(i64 %x, i64 %y) {
170170 ; CHECK-NEXT: set_local 2, pop{{$}}
171171 ; CHECK-NEXT: get_local 0{{$}}
172172 ; CHECK-NEXT: set_local 3, pop{{$}}
173 ; CHECK-NEXT: xor (get_local 3), (get_local 2){{$}}
173 ; CHECK-NEXT: xor push, (get_local 3), (get_local 2){{$}}
174174 ; CHECK-NEXT: set_local 4, pop{{$}}
175175 ; CHECK-NEXT: return (get_local 4){{$}}
176176 define i64 @xor64(i64 %x, i64 %y) {
187187 ; CHECK-NEXT: set_local 2, pop{{$}}
188188 ; CHECK-NEXT: get_local 0{{$}}
189189 ; CHECK-NEXT: set_local 3, pop{{$}}
190 ; CHECK-NEXT: shl (get_local 3), (get_local 2){{$}}
190 ; CHECK-NEXT: shl push, (get_local 3), (get_local 2){{$}}
191191 ; CHECK-NEXT: set_local 4, pop{{$}}
192192 ; CHECK-NEXT: return (get_local 4){{$}}
193193 define i64 @shl64(i64 %x, i64 %y) {
204204 ; CHECK-NEXT: set_local 2, pop{{$}}
205205 ; CHECK-NEXT: get_local 0{{$}}
206206 ; CHECK-NEXT: set_local 3, pop{{$}}
207 ; CHECK-NEXT: shr_u (get_local 3), (get_local 2){{$}}
207 ; CHECK-NEXT: shr_u push, (get_local 3), (get_local 2){{$}}
208208 ; CHECK-NEXT: set_local 4, pop{{$}}
209209 ; CHECK-NEXT: return (get_local 4){{$}}
210210 define i64 @shr64(i64 %x, i64 %y) {
221221 ; CHECK-NEXT: set_local 2, pop{{$}}
222222 ; CHECK-NEXT: get_local 0{{$}}
223223 ; CHECK-NEXT: set_local 3, pop{{$}}
224 ; CHECK-NEXT: shr_s (get_local 3), (get_local 2){{$}}
224 ; CHECK-NEXT: shr_s push, (get_local 3), (get_local 2){{$}}
225225 ; CHECK-NEXT: set_local 4, pop{{$}}
226226 ; CHECK-NEXT: return (get_local 4){{$}}
227227 define i64 @sar64(i64 %x, i64 %y) {
235235 ; CHECK-NEXT: .local i64, i64{{$}}
236236 ; CHECK-NEXT: get_local 0{{$}}
237237 ; CHECK-NEXT: set_local 1, pop{{$}}
238 ; CHECK-NEXT: clz (get_local 1){{$}}
238 ; CHECK-NEXT: clz push, (get_local 1){{$}}
239239 ; CHECK-NEXT: set_local 2, pop{{$}}
240240 ; CHECK-NEXT: return (get_local 2){{$}}
241241 define i64 @clz64(i64 %x) {
249249 ; CHECK-NEXT: .local i64, i64{{$}}
250250 ; CHECK-NEXT: get_local 0{{$}}
251251 ; CHECK-NEXT: set_local 1, pop{{$}}
252 ; CHECK-NEXT: clz (get_local 1){{$}}
252 ; CHECK-NEXT: clz push, (get_local 1){{$}}
253253 ; CHECK-NEXT: set_local 2, pop{{$}}
254254 ; CHECK-NEXT: return (get_local 2){{$}}
255255 define i64 @clz64_zero_undef(i64 %x) {
263263 ; CHECK-NEXT: .local i64, i64{{$}}
264264 ; CHECK-NEXT: get_local 0{{$}}
265265 ; CHECK-NEXT: set_local 1, pop{{$}}
266 ; CHECK-NEXT: ctz (get_local 1){{$}}
266 ; CHECK-NEXT: ctz push, (get_local 1){{$}}
267267 ; CHECK-NEXT: set_local 2, pop{{$}}
268268 ; CHECK-NEXT: return (get_local 2){{$}}
269269 define i64 @ctz64(i64 %x) {
277277 ; CHECK-NEXT: .local i64, i64{{$}}
278278 ; CHECK-NEXT: get_local 0{{$}}
279279 ; CHECK-NEXT: set_local 1, pop{{$}}
280 ; CHECK-NEXT: ctz (get_local 1){{$}}
280 ; CHECK-NEXT: ctz push, (get_local 1){{$}}
281281 ; CHECK-NEXT: set_local 2, pop{{$}}
282282 ; CHECK-NEXT: return (get_local 2){{$}}
283283 define i64 @ctz64_zero_undef(i64 %x) {
291291 ; CHECK-NEXT: .local i64, i64{{$}}
292292 ; CHECK-NEXT: get_local 0{{$}}
293293 ; CHECK-NEXT: set_local 1, pop{{$}}
294 ; CHECK-NEXT: popcnt (get_local 1){{$}}
294 ; CHECK-NEXT: popcnt push, (get_local 1){{$}}
295295 ; CHECK-NEXT: set_local 2, pop{{$}}
296296 ; CHECK-NEXT: return (get_local 2){{$}}
297297 define i64 @popcnt64(i64 %x) {
55 target triple = "wasm32-unknown-unknown"
66
77 ; CHECK-LABEL: sext_i8_i32:
8 ; CHECK: i32.load8_s (get_local 1){{$}}
8 ; CHECK: i32.load8_s push, (get_local 1){{$}}
99 ; CHECK-NEXT: set_local 2, pop{{$}}
1010 define i32 @sext_i8_i32(i8 *%p) {
1111 %v = load i8, i8* %p
1414 }
1515
1616 ; CHECK-LABEL: zext_i8_i32:
17 ; CHECK: i32.load8_u (get_local 1){{$}}
17 ; CHECK: i32.load8_u push, (get_local 1){{$}}
1818 ; CHECK-NEXT: set_local 2, pop{{$}}
1919 define i32 @zext_i8_i32(i8 *%p) {
2020 %v = load i8, i8* %p
2323 }
2424
2525 ; CHECK-LABEL: sext_i16_i32:
26 ; CHECK: i32.load16_s (get_local 1){{$}}
26 ; CHECK: i32.load16_s push, (get_local 1){{$}}
2727 ; CHECK-NEXT: set_local 2, pop{{$}}
2828 define i32 @sext_i16_i32(i16 *%p) {
2929 %v = load i16, i16* %p
3232 }
3333
3434 ; CHECK-LABEL: zext_i16_i32:
35 ; CHECK: i32.load16_u (get_local 1){{$}}
35 ; CHECK: i32.load16_u push, (get_local 1){{$}}
3636 ; CHECK-NEXT: set_local 2, pop{{$}}
3737 define i32 @zext_i16_i32(i16 *%p) {
3838 %v = load i16, i16* %p
4141 }
4242
4343 ; CHECK-LABEL: sext_i8_i64:
44 ; CHECK: i64.load8_s (get_local 1){{$}}
44 ; CHECK: i64.load8_s push, (get_local 1){{$}}
4545 ; CHECK-NEXT: set_local 2, pop{{$}}
4646 define i64 @sext_i8_i64(i8 *%p) {
4747 %v = load i8, i8* %p
5050 }
5151
5252 ; CHECK-LABEL: zext_i8_i64:
53 ; CHECK: i64.load8_u (get_local 1){{$}}
53 ; CHECK: i64.load8_u push, (get_local 1){{$}}
5454 ; CHECK-NEXT: set_local 2, pop{{$}}
5555 define i64 @zext_i8_i64(i8 *%p) {
5656 %v = load i8, i8* %p
5959 }
6060
6161 ; CHECK-LABEL: sext_i16_i64:
62 ; CHECK: i64.load16_s (get_local 1){{$}}
62 ; CHECK: i64.load16_s push, (get_local 1){{$}}
6363 ; CHECK-NEXT: set_local 2, pop{{$}}
6464 define i64 @sext_i16_i64(i16 *%p) {
6565 %v = load i16, i16* %p
6868 }
6969
7070 ; CHECK-LABEL: zext_i16_i64:
71 ; CHECK: i64.load16_u (get_local 1){{$}}
71 ; CHECK: i64.load16_u push, (get_local 1){{$}}
7272 ; CHECK-NEXT: set_local 2, pop{{$}}
7373 define i64 @zext_i16_i64(i16 *%p) {
7474 %v = load i16, i16* %p
7777 }
7878
7979 ; CHECK-LABEL: sext_i32_i64:
80 ; CHECK: i64.load32_s (get_local 1){{$}}
80 ; CHECK: i64.load32_s push, (get_local 1){{$}}
8181 ; CHECK-NEXT: set_local 2, pop{{$}}
8282 define i64 @sext_i32_i64(i32 *%p) {
8383 %v = load i32, i32* %p
8686 }
8787
8888 ; CHECK-LABEL: zext_i32_i64:
89 ; CHECK: i64.load32_u (get_local 1){{$}}
89 ; CHECK: i64.load32_u push, (get_local 1){{$}}
9090 ; CHECK: set_local 2, pop{{$}}
9191 define i64 @zext_i32_i64(i32 *%p) {
9292 %v = load i32, i32* %p
55 target triple = "wasm32-unknown-unknown"
66
77 ; CHECK-LABEL: load_u_i1_i32:
8 ; CHECK: i32.load8_u (get_local 1){{$}}
8 ; CHECK: i32.load8_u push, (get_local 1){{$}}
99 ; CHECK-NEXT: set_local 2, pop{{$}}
1010 ; CHECK-NEXT: return (get_local 2){{$}}
1111 define i32 @load_u_i1_i32(i1* %p) {
1515 }
1616
1717 ; CHECK-LABEL: load_s_i1_i32:
18 ; CHECK: i32.load8_u (get_local 1){{$}}
18 ; CHECK: i32.load8_u push, (get_local 1){{$}}
1919 ; CHECK-NEXT: set_local 2, pop{{$}}
2020 ; CHECK-NEXT: i32.const 31{{$}}
2121 ; CHECK-NEXT: set_local 3, pop{{$}}
22 ; CHECK-NEXT: shl (get_local 2), (get_local 3){{$}}
22 ; CHECK-NEXT: shl push, (get_local 2), (get_local 3){{$}}
2323 ; CHECK-NEXT: set_local 4, pop{{$}}
24 ; CHECK-NEXT: shr_s (get_local 4), (get_local 3){{$}}
24 ; CHECK-NEXT: shr_s push, (get_local 4), (get_local 3){{$}}
2525 ; CHECK-NEXT: set_local 5, pop{{$}}
2626 ; CHECK-NEXT: return (get_local 5){{$}}
2727 define i32 @load_s_i1_i32(i1* %p) {
3131 }
3232
3333 ; CHECK-LABEL: load_u_i1_i64:
34 ; CHECK: i64.load8_u (get_local 1){{$}}
34 ; CHECK: i64.load8_u push, (get_local 1){{$}}
3535 ; CHECK-NEXT: set_local 2, pop{{$}}
3636 ; CHECK-NEXT: return (get_local 2){{$}}
3737 define i64 @load_u_i1_i64(i1* %p) {
4141 }
4242
4343 ; CHECK-LABEL: load_s_i1_i64:
44 ; CHECK: i64.load8_u (get_local 1){{$}}
44 ; CHECK: i64.load8_u push, (get_local 1){{$}}
4545 ; CHECK-NEXT: set_local 2, pop{{$}}
4646 ; CHECK-NEXT: i64.const 63{{$}}
4747 ; CHECK-NEXT: set_local 3, pop{{$}}
48 ; CHECK-NEXT: shl (get_local 2), (get_local 3){{$}}
48 ; CHECK-NEXT: shl push, (get_local 2), (get_local 3){{$}}
4949 ; CHECK-NEXT: set_local 4, pop{{$}}
50 ; CHECK-NEXT: shr_s (get_local 4), (get_local 3){{$}}
50 ; CHECK-NEXT: shr_s push, (get_local 4), (get_local 3){{$}}
5151 ; CHECK-NEXT: set_local 5, pop{{$}}
5252 ; CHECK-NEXT: return (get_local 5){{$}}
5353 define i64 @load_s_i1_i64(i1* %p) {
5959 ; CHECK-LABEL: store_i32_i1:
6060 ; CHECK: i32.const 1{{$}}
6161 ; CHECK-NEXT: set_local 4, pop{{$}}
62 ; CHECK-NEXT: and (get_local 3), (get_local 4){{$}}
62 ; CHECK-NEXT: and push, (get_local 3), (get_local 4){{$}}
6363 ; CHECK-NEXT: set_local 5, pop{{$}}
6464 ; CHECK-NEXT: i32.store8 (get_local 2), (get_local 5){{$}}
6565 define void @store_i32_i1(i1* %p, i32 %v) {
7171 ; CHECK-LABEL: store_i64_i1:
7272 ; CHECK: i64.const 1{{$}}
7373 ; CHECK-NEXT: set_local 4, pop{{$}}
74 ; CHECK-NEXT: and (get_local 3), (get_local 4){{$}}
74 ; CHECK-NEXT: and push, (get_local 3), (get_local 4){{$}}
7575 ; CHECK-NEXT: set_local 5, pop{{$}}
7676 ; CHECK-NEXT: i64.store8 (get_local 2), (get_local 5){{$}}
7777 define void @store_i64_i1(i1* %p, i64 %v) {
1010 ; CHECK-NEXT: .local i32, i32{{$}}
1111 ; CHECK-NEXT: get_local 0{{$}}
1212 ; CHECK-NEXT: set_local 1, pop{{$}}
13 ; CHECK-NEXT: i32.load (get_local 1){{$}}
13 ; CHECK-NEXT: i32.load push, (get_local 1){{$}}
1414 ; CHECK-NEXT: set_local 2, pop{{$}}
1515 ; CHECK-NEXT: return (get_local 2){{$}}
1616 define i32 @ldi32(i32 *%p) {
2424 ; CHECK-NEXT: .local i32, i64{{$}}
2525 ; CHECK-NEXT: get_local 0{{$}}
2626 ; CHECK-NEXT: set_local 1, pop{{$}}
27 ; CHECK-NEXT: i64.load (get_local 1){{$}}
27 ; CHECK-NEXT: i64.load push, (get_local 1){{$}}
2828 ; CHECK-NEXT: set_local 2, pop{{$}}
2929 ; CHECK-NEXT: return (get_local 2){{$}}
3030 define i64 @ldi64(i64 *%p) {
3838 ; CHECK-NEXT: .local i32, f32{{$}}
3939 ; CHECK-NEXT: get_local 0{{$}}
4040 ; CHECK-NEXT: set_local 1, pop{{$}}
41 ; CHECK-NEXT: f32.load (get_local 1){{$}}
41 ; CHECK-NEXT: f32.load push, (get_local 1){{$}}
4242 ; CHECK-NEXT: set_local 2, pop{{$}}
4343 ; CHECK-NEXT: return (get_local 2){{$}}
4444 define float @ldf32(float *%p) {
5252 ; CHECK-NEXT: .local i32, f64{{$}}
5353 ; CHECK-NEXT: get_local 0{{$}}
5454 ; CHECK-NEXT: set_local 1, pop{{$}}
55 ; CHECK-NEXT: f64.load (get_local 1){{$}}
55 ; CHECK-NEXT: f64.load push, (get_local 1){{$}}
5656 ; CHECK-NEXT: set_local 2, pop{{$}}
5757 ; CHECK-NEXT: return (get_local 2){{$}}
5858 define double @ldf64(double *%p) {
99 ; CHECK-LABEL: test0:
1010 ; CHECK: get_local 0{{$}}
1111 ; CHECK: set_local [[REG:.*]], pop
12 ; CHECK: div_s (get_local [[REG]]), {{.*}}
12 ; CHECK: div_s push, (get_local [[REG]]), {{.*}}
1313 ; CHECK: set_local [[REG]], pop
1414 ; CHECK: return (get_local [[REG]])
1515 define i32 @test0(i32 %p) {
1010 ; CHECK: set_local [[LOCAL_B:[0-9]]]
1111 ; CHECK: get_local 0
1212 ; CHECK: set_local [[LOCAL_A:[0-9]]]
13 ; CHECK: i32.eq (get_local 5), (get_local 6)
13 ; CHECK: i32.eq push, (get_local 5), (get_local 6)
1414 ; CHECK: set_local 7, pop
15 ; CHECK: i32.select (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
15 ; CHECK: i32.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
1616 define i32 @select_i32(i32 %a, i32 %b, i32 %cond) {
1717 %cc = icmp eq i32 %cond, 0
1818 %result = select i1 %cc, i32 %a, i32 %b
2424 ; CHECK: set_local [[LOCAL_B:[0-9]]]
2525 ; CHECK: get_local 0
2626 ; CHECK: set_local [[LOCAL_A:[0-9]]]
27 ; CHECK: i32.eq (get_local 5), (get_local 6)
27 ; CHECK: i32.eq push, (get_local 5), (get_local 6)
2828 ; CHECK: set_local 7, pop
29 ; CHECK: i64.select (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
29 ; CHECK: i64.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
3030 define i64 @select_i64(i64 %a, i64 %b, i32 %cond) {
3131 %cc = icmp eq i32 %cond, 0
3232 %result = select i1 %cc, i64 %a, i64 %b
3838 ; CHECK: set_local [[LOCAL_B:[0-9]]]
3939 ; CHECK: get_local 0
4040 ; CHECK: set_local [[LOCAL_A:[0-9]]]
41 ; CHECK: i32.eq (get_local 5), (get_local 6)
41 ; CHECK: i32.eq push, (get_local 5), (get_local 6)
4242 ; CHECK: set_local 7, pop
43 ; CHECK: f32.select (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
43 ; CHECK: f32.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
4444 define float @select_f32(float %a, float %b, i32 %cond) {
4545 %cc = icmp eq i32 %cond, 0
4646 %result = select i1 %cc, float %a, float %b
5252 ; CHECK: set_local [[LOCAL_B:[0-9]]]
5353 ; CHECK: get_local 0
5454 ; CHECK: set_local [[LOCAL_A:[0-9]]]
55 ; CHECK: i32.eq (get_local 5), (get_local 6)
55 ; CHECK: i32.eq push, (get_local 5), (get_local 6)
5656 ; CHECK: set_local 7, pop
57 ; CHECK: f64.select (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
57 ; CHECK: f64.select push, (get_local 7), (get_local [[LOCAL_A]]), (get_local [[LOCAL_B]])
5858 define double @select_f64(double %a, double %b, i32 %cond) {
5959 %cc = icmp eq i32 %cond, 0
6060 %result = select i1 %cc, double %a, double %b