1 | /* |
2 | * Copyright (C) 2016-2017 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * |
8 | * 1. Redistributions of source code must retain the above copyright |
9 | * notice, this list of conditions and the following disclaimer. |
10 | * 2. Redistributions in binary form must reproduce the above copyright |
11 | * notice, this list of conditions and the following disclaimer in the |
12 | * documentation and/or other materials provided with the distribution. |
13 | * |
14 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
15 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
18 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | // DO NO EDIT! - This file was generated by /home/user/data/webkitgtk-2.25.2/Source/JavaScriptCore/wasm/generateWasmB3IRGeneratorInlinesHeader.py |
27 | |
28 | #pragma once |
29 | |
30 | #if ENABLE(WEBASSEMBLY) |
31 | |
32 | namespace JSC { namespace Wasm { |
33 | |
34 | |
35 | template<> auto B3IRGenerator::addOp<OpType::F32Ceil>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
36 | { |
37 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Ceil, origin(), arg0); |
38 | return { }; |
39 | } |
40 | |
41 | template<> auto B3IRGenerator::addOp<OpType::I64ShrS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
42 | { |
43 | Value* temp3 = m_currentBlock->appendNew<Value>(m_proc, B3::Trunc, origin(), arg1); |
44 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::SShr, origin(), arg0, temp3); |
45 | result = temp0; |
46 | return { }; |
47 | } |
48 | |
49 | template<> auto B3IRGenerator::addOp<OpType::I32Mul>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
50 | { |
51 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Mul, origin(), arg0, arg1); |
52 | return { }; |
53 | } |
54 | |
55 | template<> auto B3IRGenerator::addOp<OpType::I32Sub>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
56 | { |
57 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Sub, origin(), arg0, arg1); |
58 | return { }; |
59 | } |
60 | |
61 | template<> auto B3IRGenerator::addOp<OpType::F64Le>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
62 | { |
63 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessEqual, origin(), arg0, arg1); |
64 | return { }; |
65 | } |
66 | |
67 | template<> auto B3IRGenerator::addOp<OpType::F32DemoteF64>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
68 | { |
69 | result = m_currentBlock->appendNew<Value>(m_proc, B3::DoubleToFloat, origin(), arg0); |
70 | return { }; |
71 | } |
72 | |
73 | template<> auto B3IRGenerator::addOp<OpType::F32Min>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
74 | { |
75 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
76 | Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), arg0, arg1); |
77 | Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
78 | Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
79 | Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
80 | Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg1, temp28); |
81 | Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg0, temp20); |
82 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12); |
83 | result = temp0; |
84 | return { }; |
85 | } |
86 | |
87 | template<> auto B3IRGenerator::addOp<OpType::F64Ne>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
88 | { |
89 | result = m_currentBlock->appendNew<Value>(m_proc, B3::NotEqual, origin(), arg0, arg1); |
90 | return { }; |
91 | } |
92 | |
93 | template<> auto B3IRGenerator::addOp<OpType::F64Lt>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
94 | { |
95 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
96 | return { }; |
97 | } |
98 | |
99 | template<> auto B3IRGenerator::addOp<OpType::F32Max>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
100 | { |
101 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
102 | Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), arg0, arg1); |
103 | Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
104 | Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
105 | Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
106 | Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg0, temp28); |
107 | Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg1, temp20); |
108 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12); |
109 | result = temp0; |
110 | return { }; |
111 | } |
112 | |
113 | template<> auto B3IRGenerator::addOp<OpType::F64Mul>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
114 | { |
115 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Mul, origin(), arg0, arg1); |
116 | return { }; |
117 | } |
118 | |
119 | template<> auto B3IRGenerator::addOp<OpType::F32Div>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
120 | { |
121 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Div, origin(), arg0, arg1); |
122 | return { }; |
123 | } |
124 | |
125 | template<> auto B3IRGenerator::addOp<OpType::I32Clz>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
126 | { |
127 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Clz, origin(), arg0); |
128 | return { }; |
129 | } |
130 | |
131 | template<> auto B3IRGenerator::addOp<OpType::F32Copysign>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
132 | { |
133 | Value* temp6 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg1); |
134 | Value* temp12 = constant(Int32, 0x80000000); |
135 | Value* temp4 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp6, temp12); |
136 | Value* temp17 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0); |
137 | Value* temp23 = constant(Int32, 0x7fffffff); |
138 | Value* temp15 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp17, temp23); |
139 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), temp4, temp15); |
140 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), temp2); |
141 | result = temp0; |
142 | return { }; |
143 | } |
144 | |
145 | template<> auto B3IRGenerator::addOp<OpType::F64ConvertUI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
146 | { |
147 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::ZExt32, origin(), arg0); |
148 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::IToD, origin(), temp2); |
149 | result = temp0; |
150 | return { }; |
151 | } |
152 | |
153 | template<> auto B3IRGenerator::addOp<OpType::F32ReinterpretI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
154 | { |
155 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0); |
156 | return { }; |
157 | } |
158 | |
159 | template<> auto B3IRGenerator::addOp<OpType::I64And>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
160 | { |
161 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), arg0, arg1); |
162 | return { }; |
163 | } |
164 | |
165 | template<> auto B3IRGenerator::addOp<OpType::F32Ne>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
166 | { |
167 | result = m_currentBlock->appendNew<Value>(m_proc, B3::NotEqual, origin(), arg0, arg1); |
168 | return { }; |
169 | } |
170 | |
171 | template<> auto B3IRGenerator::addOp<OpType::F64Gt>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
172 | { |
173 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
174 | return { }; |
175 | } |
176 | |
177 | template<> auto B3IRGenerator::addOp<OpType::F32Sqrt>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
178 | { |
179 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Sqrt, origin(), arg0); |
180 | return { }; |
181 | } |
182 | |
183 | template<> auto B3IRGenerator::addOp<OpType::F64Ge>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
184 | { |
185 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterEqual, origin(), arg0, arg1); |
186 | return { }; |
187 | } |
188 | |
189 | template<> auto B3IRGenerator::addOp<OpType::I64GtS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
190 | { |
191 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
192 | return { }; |
193 | } |
194 | |
195 | template<> auto B3IRGenerator::addOp<OpType::I64GtU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
196 | { |
197 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Above, origin(), arg0, arg1); |
198 | return { }; |
199 | } |
200 | |
201 | template<> auto B3IRGenerator::addOp<OpType::I64Eqz>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
202 | { |
203 | Value* temp4 = constant(Int64, 0); |
204 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), temp4, arg0); |
205 | result = temp0; |
206 | return { }; |
207 | } |
208 | |
209 | template<> auto B3IRGenerator::addOp<OpType::F64Div>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
210 | { |
211 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Div, origin(), arg0, arg1); |
212 | return { }; |
213 | } |
214 | |
215 | template<> auto B3IRGenerator::addOp<OpType::F32Add>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
216 | { |
217 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
218 | return { }; |
219 | } |
220 | |
221 | template<> auto B3IRGenerator::addOp<OpType::I64Or>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
222 | { |
223 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), arg0, arg1); |
224 | return { }; |
225 | } |
226 | |
227 | template<> auto B3IRGenerator::addOp<OpType::I32LeU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
228 | { |
229 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BelowEqual, origin(), arg0, arg1); |
230 | return { }; |
231 | } |
232 | |
233 | template<> auto B3IRGenerator::addOp<OpType::I32LeS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
234 | { |
235 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessEqual, origin(), arg0, arg1); |
236 | return { }; |
237 | } |
238 | |
239 | template<> auto B3IRGenerator::addOp<OpType::I64Ne>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
240 | { |
241 | result = m_currentBlock->appendNew<Value>(m_proc, B3::NotEqual, origin(), arg0, arg1); |
242 | return { }; |
243 | } |
244 | |
245 | template<> auto B3IRGenerator::addOp<OpType::I64Clz>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
246 | { |
247 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Clz, origin(), arg0); |
248 | return { }; |
249 | } |
250 | |
251 | template<> auto B3IRGenerator::addOp<OpType::F32Neg>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
252 | { |
253 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Neg, origin(), arg0); |
254 | return { }; |
255 | } |
256 | |
257 | template<> auto B3IRGenerator::addOp<OpType::I32And>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
258 | { |
259 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), arg0, arg1); |
260 | return { }; |
261 | } |
262 | |
263 | template<> auto B3IRGenerator::addOp<OpType::I32LtU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
264 | { |
265 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Below, origin(), arg0, arg1); |
266 | return { }; |
267 | } |
268 | |
269 | template<> auto B3IRGenerator::addOp<OpType::I64Rotr>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
270 | { |
271 | Value* temp3 = m_currentBlock->appendNew<Value>(m_proc, B3::Trunc, origin(), arg1); |
272 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::RotR, origin(), arg0, temp3); |
273 | result = temp0; |
274 | return { }; |
275 | } |
276 | |
277 | template<> auto B3IRGenerator::addOp<OpType::F64Abs>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
278 | { |
279 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Abs, origin(), arg0); |
280 | return { }; |
281 | } |
282 | |
283 | template<> auto B3IRGenerator::addOp<OpType::I32LtS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
284 | { |
285 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
286 | return { }; |
287 | } |
288 | |
289 | template<> auto B3IRGenerator::addOp<OpType::I32Eq>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
290 | { |
291 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
292 | return { }; |
293 | } |
294 | |
295 | template<> auto B3IRGenerator::addOp<OpType::F64Copysign>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
296 | { |
297 | Value* temp6 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg1); |
298 | Value* temp12 = constant(Int64, 0x8000000000000000); |
299 | Value* temp4 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp6, temp12); |
300 | Value* temp17 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0); |
301 | Value* temp23 = constant(Int64, 0x7fffffffffffffff); |
302 | Value* temp15 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp17, temp23); |
303 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), temp4, temp15); |
304 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), temp2); |
305 | result = temp0; |
306 | return { }; |
307 | } |
308 | |
309 | template<> auto B3IRGenerator::addOp<OpType::F32ConvertSI64>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
310 | { |
311 | result = m_currentBlock->appendNew<Value>(m_proc, B3::IToF, origin(), arg0); |
312 | return { }; |
313 | } |
314 | |
315 | template<> auto B3IRGenerator::addOp<OpType::I64Rotl>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
316 | { |
317 | Value* temp3 = m_currentBlock->appendNew<Value>(m_proc, B3::Trunc, origin(), arg1); |
318 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::RotL, origin(), arg0, temp3); |
319 | result = temp0; |
320 | return { }; |
321 | } |
322 | |
323 | template<> auto B3IRGenerator::addOp<OpType::F32Lt>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
324 | { |
325 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
326 | return { }; |
327 | } |
328 | |
329 | template<> auto B3IRGenerator::addOp<OpType::F64ConvertSI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
330 | { |
331 | result = m_currentBlock->appendNew<Value>(m_proc, B3::IToD, origin(), arg0); |
332 | return { }; |
333 | } |
334 | |
335 | template<> auto B3IRGenerator::addOp<OpType::F64Eq>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
336 | { |
337 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
338 | return { }; |
339 | } |
340 | |
341 | template<> auto B3IRGenerator::addOp<OpType::F32Le>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
342 | { |
343 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessEqual, origin(), arg0, arg1); |
344 | return { }; |
345 | } |
346 | |
347 | template<> auto B3IRGenerator::addOp<OpType::F32Ge>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
348 | { |
349 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterEqual, origin(), arg0, arg1); |
350 | return { }; |
351 | } |
352 | |
353 | template<> auto B3IRGenerator::addOp<OpType::I32ShrU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
354 | { |
355 | result = m_currentBlock->appendNew<Value>(m_proc, B3::ZShr, origin(), arg0, arg1); |
356 | return { }; |
357 | } |
358 | |
359 | template<> auto B3IRGenerator::addOp<OpType::F32ConvertUI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
360 | { |
361 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::ZExt32, origin(), arg0); |
362 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::IToF, origin(), temp2); |
363 | result = temp0; |
364 | return { }; |
365 | } |
366 | |
367 | template<> auto B3IRGenerator::addOp<OpType::I32ShrS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
368 | { |
369 | result = m_currentBlock->appendNew<Value>(m_proc, B3::SShr, origin(), arg0, arg1); |
370 | return { }; |
371 | } |
372 | |
373 | template<> auto B3IRGenerator::addOp<OpType::I32GeU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
374 | { |
375 | result = m_currentBlock->appendNew<Value>(m_proc, B3::AboveEqual, origin(), arg0, arg1); |
376 | return { }; |
377 | } |
378 | |
379 | template<> auto B3IRGenerator::addOp<OpType::F64Ceil>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
380 | { |
381 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Ceil, origin(), arg0); |
382 | return { }; |
383 | } |
384 | |
385 | template<> auto B3IRGenerator::addOp<OpType::I32GeS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
386 | { |
387 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterEqual, origin(), arg0, arg1); |
388 | return { }; |
389 | } |
390 | |
391 | template<> auto B3IRGenerator::addOp<OpType::I32Shl>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
392 | { |
393 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Shl, origin(), arg0, arg1); |
394 | return { }; |
395 | } |
396 | |
397 | template<> auto B3IRGenerator::addOp<OpType::F64Floor>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
398 | { |
399 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Floor, origin(), arg0); |
400 | return { }; |
401 | } |
402 | |
403 | template<> auto B3IRGenerator::addOp<OpType::I32Xor>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
404 | { |
405 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitXor, origin(), arg0, arg1); |
406 | return { }; |
407 | } |
408 | |
409 | template<> auto B3IRGenerator::addOp<OpType::F32Abs>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
410 | { |
411 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Abs, origin(), arg0); |
412 | return { }; |
413 | } |
414 | |
415 | template<> auto B3IRGenerator::addOp<OpType::F64Min>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
416 | { |
417 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
418 | Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), arg0, arg1); |
419 | Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
420 | Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
421 | Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
422 | Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg1, temp28); |
423 | Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg0, temp20); |
424 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12); |
425 | result = temp0; |
426 | return { }; |
427 | } |
428 | |
429 | template<> auto B3IRGenerator::addOp<OpType::F32Mul>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
430 | { |
431 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Mul, origin(), arg0, arg1); |
432 | return { }; |
433 | } |
434 | |
435 | template<> auto B3IRGenerator::addOp<OpType::I64Sub>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
436 | { |
437 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Sub, origin(), arg0, arg1); |
438 | return { }; |
439 | } |
440 | |
441 | template<> auto B3IRGenerator::addOp<OpType::I32ReinterpretF32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
442 | { |
443 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0); |
444 | return { }; |
445 | } |
446 | |
447 | template<> auto B3IRGenerator::addOp<OpType::I32Add>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
448 | { |
449 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
450 | return { }; |
451 | } |
452 | |
453 | template<> auto B3IRGenerator::addOp<OpType::F64Sub>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
454 | { |
455 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Sub, origin(), arg0, arg1); |
456 | return { }; |
457 | } |
458 | |
459 | template<> auto B3IRGenerator::addOp<OpType::I32Or>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
460 | { |
461 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), arg0, arg1); |
462 | return { }; |
463 | } |
464 | |
465 | template<> auto B3IRGenerator::addOp<OpType::I64LtU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
466 | { |
467 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Below, origin(), arg0, arg1); |
468 | return { }; |
469 | } |
470 | |
471 | template<> auto B3IRGenerator::addOp<OpType::I64LtS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
472 | { |
473 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
474 | return { }; |
475 | } |
476 | |
477 | template<> auto B3IRGenerator::addOp<OpType::F64ConvertSI64>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
478 | { |
479 | result = m_currentBlock->appendNew<Value>(m_proc, B3::IToD, origin(), arg0); |
480 | return { }; |
481 | } |
482 | |
483 | template<> auto B3IRGenerator::addOp<OpType::I64Xor>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
484 | { |
485 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitXor, origin(), arg0, arg1); |
486 | return { }; |
487 | } |
488 | |
489 | template<> auto B3IRGenerator::addOp<OpType::I64GeU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
490 | { |
491 | result = m_currentBlock->appendNew<Value>(m_proc, B3::AboveEqual, origin(), arg0, arg1); |
492 | return { }; |
493 | } |
494 | |
495 | template<> auto B3IRGenerator::addOp<OpType::I64Mul>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
496 | { |
497 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Mul, origin(), arg0, arg1); |
498 | return { }; |
499 | } |
500 | |
501 | template<> auto B3IRGenerator::addOp<OpType::F32Sub>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
502 | { |
503 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Sub, origin(), arg0, arg1); |
504 | return { }; |
505 | } |
506 | |
507 | template<> auto B3IRGenerator::addOp<OpType::F64PromoteF32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
508 | { |
509 | result = m_currentBlock->appendNew<Value>(m_proc, B3::FloatToDouble, origin(), arg0); |
510 | return { }; |
511 | } |
512 | |
513 | template<> auto B3IRGenerator::addOp<OpType::F64Add>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
514 | { |
515 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
516 | return { }; |
517 | } |
518 | |
519 | template<> auto B3IRGenerator::addOp<OpType::I64GeS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
520 | { |
521 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterEqual, origin(), arg0, arg1); |
522 | return { }; |
523 | } |
524 | |
525 | template<> auto B3IRGenerator::addOp<OpType::I64ExtendUI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
526 | { |
527 | result = m_currentBlock->appendNew<Value>(m_proc, B3::ZExt32, origin(), arg0); |
528 | return { }; |
529 | } |
530 | |
531 | template<> auto B3IRGenerator::addOp<OpType::I32Ne>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
532 | { |
533 | result = m_currentBlock->appendNew<Value>(m_proc, B3::NotEqual, origin(), arg0, arg1); |
534 | return { }; |
535 | } |
536 | |
537 | template<> auto B3IRGenerator::addOp<OpType::F64ReinterpretI64>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
538 | { |
539 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0); |
540 | return { }; |
541 | } |
542 | |
543 | template<> auto B3IRGenerator::addOp<OpType::F32Eq>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
544 | { |
545 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
546 | return { }; |
547 | } |
548 | |
549 | template<> auto B3IRGenerator::addOp<OpType::I64Eq>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
550 | { |
551 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
552 | return { }; |
553 | } |
554 | |
555 | template<> auto B3IRGenerator::addOp<OpType::F32Floor>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
556 | { |
557 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Floor, origin(), arg0); |
558 | return { }; |
559 | } |
560 | |
561 | template<> auto B3IRGenerator::addOp<OpType::F32ConvertSI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
562 | { |
563 | result = m_currentBlock->appendNew<Value>(m_proc, B3::IToF, origin(), arg0); |
564 | return { }; |
565 | } |
566 | |
567 | template<> auto B3IRGenerator::addOp<OpType::I32Eqz>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
568 | { |
569 | Value* temp4 = constant(Int32, 0); |
570 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), temp4, arg0); |
571 | result = temp0; |
572 | return { }; |
573 | } |
574 | |
575 | template<> auto B3IRGenerator::addOp<OpType::I64ReinterpretF64>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
576 | { |
577 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0); |
578 | return { }; |
579 | } |
580 | |
581 | template<> auto B3IRGenerator::addOp<OpType::I64ShrU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
582 | { |
583 | Value* temp3 = m_currentBlock->appendNew<Value>(m_proc, B3::Trunc, origin(), arg1); |
584 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::ZShr, origin(), arg0, temp3); |
585 | result = temp0; |
586 | return { }; |
587 | } |
588 | |
589 | template<> auto B3IRGenerator::addOp<OpType::F64Sqrt>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
590 | { |
591 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Sqrt, origin(), arg0); |
592 | return { }; |
593 | } |
594 | |
595 | template<> auto B3IRGenerator::addOp<OpType::I64Shl>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
596 | { |
597 | Value* temp3 = m_currentBlock->appendNew<Value>(m_proc, B3::Trunc, origin(), arg1); |
598 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Shl, origin(), arg0, temp3); |
599 | result = temp0; |
600 | return { }; |
601 | } |
602 | |
603 | template<> auto B3IRGenerator::addOp<OpType::F32Gt>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
604 | { |
605 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
606 | return { }; |
607 | } |
608 | |
609 | template<> auto B3IRGenerator::addOp<OpType::I32WrapI64>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
610 | { |
611 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Trunc, origin(), arg0); |
612 | return { }; |
613 | } |
614 | |
615 | template<> auto B3IRGenerator::addOp<OpType::I32Rotl>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
616 | { |
617 | result = m_currentBlock->appendNew<Value>(m_proc, B3::RotL, origin(), arg0, arg1); |
618 | return { }; |
619 | } |
620 | |
621 | template<> auto B3IRGenerator::addOp<OpType::I32Rotr>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
622 | { |
623 | result = m_currentBlock->appendNew<Value>(m_proc, B3::RotR, origin(), arg0, arg1); |
624 | return { }; |
625 | } |
626 | |
627 | template<> auto B3IRGenerator::addOp<OpType::I32GtU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
628 | { |
629 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Above, origin(), arg0, arg1); |
630 | return { }; |
631 | } |
632 | |
633 | template<> auto B3IRGenerator::addOp<OpType::I64ExtendSI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
634 | { |
635 | result = m_currentBlock->appendNew<Value>(m_proc, B3::SExt32, origin(), arg0); |
636 | return { }; |
637 | } |
638 | |
639 | template<> auto B3IRGenerator::addOp<OpType::I32GtS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
640 | { |
641 | result = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
642 | return { }; |
643 | } |
644 | |
645 | template<> auto B3IRGenerator::addOp<OpType::F64Neg>(ExpressionType arg0, ExpressionType& result) -> PartialResult |
646 | { |
647 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Neg, origin(), arg0); |
648 | return { }; |
649 | } |
650 | |
651 | template<> auto B3IRGenerator::addOp<OpType::F64Max>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
652 | { |
653 | Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), arg0, arg1); |
654 | Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), arg0, arg1); |
655 | Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1); |
656 | Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1); |
657 | Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
658 | Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg0, temp28); |
659 | Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg1, temp20); |
660 | Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12); |
661 | result = temp0; |
662 | return { }; |
663 | } |
664 | |
665 | template<> auto B3IRGenerator::addOp<OpType::I64LeU>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
666 | { |
667 | result = m_currentBlock->appendNew<Value>(m_proc, B3::BelowEqual, origin(), arg0, arg1); |
668 | return { }; |
669 | } |
670 | |
671 | template<> auto B3IRGenerator::addOp<OpType::I64LeS>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
672 | { |
673 | result = m_currentBlock->appendNew<Value>(m_proc, B3::LessEqual, origin(), arg0, arg1); |
674 | return { }; |
675 | } |
676 | |
677 | template<> auto B3IRGenerator::addOp<OpType::I64Add>(ExpressionType arg0, ExpressionType arg1, ExpressionType& result) -> PartialResult |
678 | { |
679 | result = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1); |
680 | return { }; |
681 | } |
682 | |
683 | |
684 | } } // namespace JSC::Wasm |
685 | |
686 | #endif // ENABLE(WEBASSEMBLY) |
687 | |
688 | |