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
32namespace JSC { namespace Wasm {
33
34
35template<> 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
41template<> 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);
44Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::SShr, origin(), arg0, temp3);
45result = temp0;
46 return { };
47}
48
49template<> 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
55template<> 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
61template<> 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
67template<> 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
73template<> 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);
76Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), arg0, arg1);
77Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1);
78Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1);
79Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1);
80Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg1, temp28);
81Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg0, temp20);
82Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12);
83result = temp0;
84 return { };
85}
86
87template<> 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
93template<> 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
99template<> 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);
102Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), arg0, arg1);
103Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1);
104Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1);
105Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1);
106Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg0, temp28);
107Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg1, temp20);
108Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12);
109result = temp0;
110 return { };
111}
112
113template<> 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
119template<> 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
125template<> 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
131template<> 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);
134Value* temp12 = constant(Int32, 0x80000000);
135Value* temp4 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp6, temp12);
136Value* temp17 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0);
137Value* temp23 = constant(Int32, 0x7fffffff);
138Value* temp15 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp17, temp23);
139Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), temp4, temp15);
140Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), temp2);
141result = temp0;
142 return { };
143}
144
145template<> auto B3IRGenerator::addOp<OpType::F64ConvertUI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult
146{
147 Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::ZExt32, origin(), arg0);
148Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::IToD, origin(), temp2);
149result = temp0;
150 return { };
151}
152
153template<> 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
159template<> 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
165template<> 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
171template<> 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
177template<> 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
183template<> 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
189template<> 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
195template<> 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
201template<> auto B3IRGenerator::addOp<OpType::I64Eqz>(ExpressionType arg0, ExpressionType& result) -> PartialResult
202{
203 Value* temp4 = constant(Int64, 0);
204Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), temp4, arg0);
205result = temp0;
206 return { };
207}
208
209template<> 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
215template<> 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
221template<> 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
227template<> 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
233template<> 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
239template<> 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
245template<> 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
251template<> 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
257template<> 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
263template<> 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
269template<> 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);
272Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::RotR, origin(), arg0, temp3);
273result = temp0;
274 return { };
275}
276
277template<> 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
283template<> 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
289template<> 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
295template<> 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);
298Value* temp12 = constant(Int64, 0x8000000000000000);
299Value* temp4 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp6, temp12);
300Value* temp17 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), arg0);
301Value* temp23 = constant(Int64, 0x7fffffffffffffff);
302Value* temp15 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), temp17, temp23);
303Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), temp4, temp15);
304Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::BitwiseCast, origin(), temp2);
305result = temp0;
306 return { };
307}
308
309template<> 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
315template<> 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);
318Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::RotL, origin(), arg0, temp3);
319result = temp0;
320 return { };
321}
322
323template<> 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
329template<> 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
335template<> 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
341template<> 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
347template<> 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
353template<> 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
359template<> auto B3IRGenerator::addOp<OpType::F32ConvertUI32>(ExpressionType arg0, ExpressionType& result) -> PartialResult
360{
361 Value* temp2 = m_currentBlock->appendNew<Value>(m_proc, B3::ZExt32, origin(), arg0);
362Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::IToF, origin(), temp2);
363result = temp0;
364 return { };
365}
366
367template<> 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
373template<> 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
379template<> 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
385template<> 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
391template<> 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
397template<> 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
403template<> 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
409template<> 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
415template<> 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);
418Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitOr, origin(), arg0, arg1);
419Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1);
420Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1);
421Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1);
422Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg1, temp28);
423Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg0, temp20);
424Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12);
425result = temp0;
426 return { };
427}
428
429template<> 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
435template<> 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
441template<> 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
447template<> 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
453template<> 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
459template<> 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
465template<> 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
471template<> 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
477template<> 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
483template<> 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
489template<> 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
495template<> 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
501template<> 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
507template<> 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
513template<> 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
519template<> 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
525template<> 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
531template<> 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
537template<> 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
543template<> 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
549template<> 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
555template<> 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
561template<> 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
567template<> auto B3IRGenerator::addOp<OpType::I32Eqz>(ExpressionType arg0, ExpressionType& result) -> PartialResult
568{
569 Value* temp4 = constant(Int32, 0);
570Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Equal, origin(), temp4, arg0);
571result = temp0;
572 return { };
573}
574
575template<> 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
581template<> 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);
584Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::ZShr, origin(), arg0, temp3);
585result = temp0;
586 return { };
587}
588
589template<> 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
595template<> 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);
598Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Shl, origin(), arg0, temp3);
599result = temp0;
600 return { };
601}
602
603template<> 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
609template<> 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
615template<> 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
621template<> 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
627template<> 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
633template<> 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
639template<> 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
645template<> 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
651template<> 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);
654Value* temp7 = m_currentBlock->appendNew<Value>(m_proc, B3::BitAnd, origin(), arg0, arg1);
655Value* temp14 = m_currentBlock->appendNew<Value>(m_proc, B3::LessThan, origin(), arg0, arg1);
656Value* temp22 = m_currentBlock->appendNew<Value>(m_proc, B3::GreaterThan, origin(), arg0, arg1);
657Value* temp28 = m_currentBlock->appendNew<Value>(m_proc, B3::Add, origin(), arg0, arg1);
658Value* temp20 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp22, arg0, temp28);
659Value* temp12 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp14, arg1, temp20);
660Value* temp0 = m_currentBlock->appendNew<Value>(m_proc, B3::Select, origin(), temp2, temp7, temp12);
661result = temp0;
662 return { };
663}
664
665template<> 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
671template<> 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
677template<> 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