OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_WASM_MACRO_GEN_H_ | 5 #ifndef V8_WASM_MACRO_GEN_H_ |
6 #define V8_WASM_MACRO_GEN_H_ | 6 #define V8_WASM_MACRO_GEN_H_ |
7 | 7 |
8 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
9 | 9 |
10 #define U32_LE(v) \ | 10 #define U32_LE(v) \ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static_cast<byte>((((x) >> 21) & MASK_7) | 0x80), \ | 51 static_cast<byte>((((x) >> 21) & MASK_7) | 0x80), \ |
52 static_cast<byte>((((x) >> 28) & MASK_7)) | 52 static_cast<byte>((((x) >> 28) & MASK_7)) |
53 | 53 |
54 // Convenience macros for building Wasm bytecode directly into a byte array. | 54 // Convenience macros for building Wasm bytecode directly into a byte array. |
55 | 55 |
56 //------------------------------------------------------------------------------ | 56 //------------------------------------------------------------------------------ |
57 // Control. | 57 // Control. |
58 //------------------------------------------------------------------------------ | 58 //------------------------------------------------------------------------------ |
59 #define WASM_NOP kExprNop | 59 #define WASM_NOP kExprNop |
60 | 60 |
61 #define WASM_BLOCK(count, ...) kExprBlock, static_cast<byte>(count), __VA_ARGS__ | 61 #define ARITY_0 0 |
62 #define WASM_INFINITE_LOOP kExprLoop, 1, kExprBr, 0, kExprNop | 62 #define ARITY_1 1 |
63 #define WASM_LOOP(count, ...) kExprLoop, static_cast<byte>(count), __VA_ARGS__ | 63 #define DEPTH_0 0 |
64 #define WASM_IF(cond, tstmt) kExprIf, cond, tstmt | 64 #define DEPTH_1 1 |
65 #define WASM_IF_ELSE(cond, tstmt, fstmt) kExprIfElse, cond, tstmt, fstmt | 65 |
66 #define WASM_SELECT(cond, tval, fval) kExprSelect, cond, tval, fval | 66 #define WASM_BLOCK(count, ...) kExprBlock, __VA_ARGS__, kExprEnd |
67 #define WASM_BR(depth) kExprBr, static_cast<byte>(depth), kExprNop | 67 #define WASM_INFINITE_LOOP \ |
| 68 kExprLoop, kExprNop, kExprBr, ARITY_0, DEPTH_0, kExprEnd |
| 69 #define WASM_LOOP(count, ...) kExprLoop, __VA_ARGS__, kExprEnd |
| 70 #define WASM_IF(cond, tstmt) cond, kExprIf, tstmt, kExprEnd |
| 71 #define WASM_IF_ELSE(cond, tstmt, fstmt) \ |
| 72 cond, kExprIf, tstmt, kExprElse, fstmt, kExprEnd |
| 73 #define WASM_SELECT(tval, fval, cond) tval, fval, cond, kExprSelect |
| 74 #define WASM_BR(depth) kExprNop, kExprBr, ARITY_0, static_cast<byte>(depth) |
68 #define WASM_BR_IF(depth, cond) \ | 75 #define WASM_BR_IF(depth, cond) \ |
69 kExprBrIf, static_cast<byte>(depth), kExprNop, cond | 76 cond, kExprBrIf, ARITY_0, static_cast<byte>(depth) |
70 #define WASM_BRV(depth, val) kExprBr, static_cast<byte>(depth), val | 77 #define WASM_BRV(depth, val) val, kExprBr, ARITY_1, static_cast<byte>(depth) |
71 #define WASM_BRV_IF(depth, val, cond) \ | 78 #define WASM_BRV_IF(depth, val, cond) \ |
72 kExprBrIf, static_cast<byte>(depth), val, cond | 79 val, cond, kExprBrIf, ARITY_1, static_cast<byte>(depth) |
73 #define WASM_BREAK(depth) kExprBr, static_cast<byte>(depth + 1), kExprNop | 80 #define WASM_BREAK(depth) \ |
74 #define WASM_CONTINUE(depth) kExprBr, static_cast<byte>(depth), kExprNop | 81 kExprNop, kExprBr, ARITY_0, static_cast<byte>(depth + 1) |
75 #define WASM_BREAKV(depth, val) kExprBr, static_cast<byte>(depth + 1), val | 82 #define WASM_CONTINUE(depth) \ |
76 #define WASM_RETURN0 kExprReturn | 83 kExprNop, kExprBr, ARITY_0, static_cast<byte>(depth) |
77 #define WASM_RETURN(...) kExprReturn, __VA_ARGS__ | 84 #define WASM_BREAKV(depth, val) \ |
| 85 val, kExprBr, ARITY_1, static_cast<byte>(depth + 1) |
| 86 #define WASM_RETURN0 kExprReturn, ARITY_0 |
| 87 #define WASM_RETURN1(val) val, kExprReturn, ARITY_1 |
| 88 #define WASM_RETURNN(count, ...) __VA_ARGS__, kExprReturn, count |
78 #define WASM_UNREACHABLE kExprUnreachable | 89 #define WASM_UNREACHABLE kExprUnreachable |
79 | 90 |
80 #define WASM_BR_TABLE(key, count, ...) \ | 91 #define WASM_BR_TABLE(key, count, ...) \ |
81 kExprBrTable, U32V_1(count), __VA_ARGS__, key | 92 key, kExprBrTable, ARITY_0, U32V_1(count), __VA_ARGS__ |
| 93 |
| 94 #define WASM_BR_TABLEV(val, key, count, ...) \ |
| 95 val, key, kExprBrTable, ARITY_1, U32V_1(count), __VA_ARGS__ |
82 | 96 |
83 #define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8) | 97 #define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8) |
84 #define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8) | 98 #define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8) |
85 | 99 |
86 //------------------------------------------------------------------------------ | 100 //------------------------------------------------------------------------------ |
87 // Misc expressions. | 101 // Misc expressions. |
88 //------------------------------------------------------------------------------ | 102 //------------------------------------------------------------------------------ |
89 #define WASM_ID(...) __VA_ARGS__ | 103 #define WASM_ID(...) __VA_ARGS__ |
90 #define WASM_ZERO kExprI8Const, 0 | 104 #define WASM_ZERO kExprI8Const, 0 |
91 #define WASM_ONE kExprI8Const, 1 | 105 #define WASM_ONE kExprI8Const, 1 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 #define WASM_F64(val) \ | 329 #define WASM_F64(val) \ |
316 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ | 330 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ |
317 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ | 331 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ |
318 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ | 332 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ |
319 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ | 333 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ |
320 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ | 334 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ |
321 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ | 335 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ |
322 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ | 336 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ |
323 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) | 337 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) |
324 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) | 338 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) |
325 #define WASM_SET_LOCAL(index, val) kExprSetLocal, static_cast<byte>(index), val | 339 #define WASM_SET_LOCAL(index, val) val, kExprSetLocal, static_cast<byte>(index) |
326 #define WASM_LOAD_GLOBAL(index) kExprLoadGlobal, static_cast<byte>(index) | 340 #define WASM_LOAD_GLOBAL(index) kExprLoadGlobal, static_cast<byte>(index) |
327 #define WASM_STORE_GLOBAL(index, val) \ | 341 #define WASM_STORE_GLOBAL(index, val) \ |
328 kExprStoreGlobal, static_cast<byte>(index), val | 342 val, kExprStoreGlobal, static_cast<byte>(index) |
329 #define WASM_LOAD_MEM(type, index) \ | 343 #define WASM_LOAD_MEM(type, index) \ |
330 static_cast<byte>( \ | 344 index, static_cast<byte>( \ |
331 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 345 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
332 ZERO_ALIGNMENT, ZERO_OFFSET, index | 346 ZERO_ALIGNMENT, ZERO_OFFSET |
333 #define WASM_STORE_MEM(type, index, val) \ | 347 #define WASM_STORE_MEM(type, index, val) \ |
334 static_cast<byte>( \ | 348 index, val, \ |
335 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 349 static_cast<byte>( \ |
336 ZERO_ALIGNMENT, ZERO_OFFSET, index, val | 350 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ |
337 #define WASM_LOAD_MEM_OFFSET(type, offset, index) \ | 351 ZERO_ALIGNMENT, ZERO_OFFSET |
338 static_cast<byte>( \ | 352 #define WASM_LOAD_MEM_OFFSET(type, offset, index) \ |
339 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 353 index, static_cast<byte>( \ |
340 ZERO_ALIGNMENT, U32V_1(offset), index | 354 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
341 #define WASM_STORE_MEM_OFFSET(type, offset, index, val) \ | 355 ZERO_ALIGNMENT, static_cast<byte>(offset) |
342 static_cast<byte>( \ | 356 #define WASM_STORE_MEM_OFFSET(type, offset, index, val) \ |
343 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 357 index, val, \ |
344 ZERO_ALIGNMENT, U32V_1(offset), index, val | 358 static_cast<byte>( \ |
345 #define WASM_CALL_FUNCTION(index, ...) \ | 359 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ |
346 kExprCallFunction, static_cast<byte>(index), __VA_ARGS__ | 360 ZERO_ALIGNMENT, static_cast<byte>(offset) |
347 #define WASM_CALL_IMPORT(index, ...) \ | 361 |
348 kExprCallImport, static_cast<byte>(index), __VA_ARGS__ | 362 #define WASM_CALL_FUNCTION0(index) \ |
349 #define WASM_CALL_INDIRECT(index, func, ...) \ | 363 kExprCallFunction, 0, static_cast<byte>(index) |
350 kExprCallIndirect, static_cast<byte>(index), func, __VA_ARGS__ | 364 #define WASM_CALL_FUNCTION1(index, a) \ |
351 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) | 365 a, kExprCallFunction, 1, static_cast<byte>(index) |
352 #define WASM_CALL_IMPORT0(index) kExprCallImport, static_cast<byte>(index) | 366 #define WASM_CALL_FUNCTION2(index, a, b) \ |
| 367 a, b, kExprCallFunction, 2, static_cast<byte>(index) |
| 368 #define WASM_CALL_FUNCTION3(index, a, b, c) \ |
| 369 a, b, c, kExprCallFunction, 3, static_cast<byte>(index) |
| 370 #define WASM_CALL_FUNCTION4(index, a, b, c, d) \ |
| 371 a, b, c, d, kExprCallFunction, 4, static_cast<byte>(index) |
| 372 #define WASM_CALL_FUNCTION5(index, a, b, c, d, e) \ |
| 373 kExprCallFunction, 5, static_cast<byte>(index) |
| 374 #define WASM_CALL_FUNCTIONN(arity, index, ...) \ |
| 375 __VA_ARGS__, kExprCallFunction, arity, static_cast<byte>(index) |
| 376 |
| 377 #define WASM_CALL_IMPORT0(index) kExprCallImport, 0, static_cast<byte>(index) |
| 378 #define WASM_CALL_IMPORT1(index, a) \ |
| 379 a, kExprCallImport, 1, static_cast<byte>(index) |
| 380 #define WASM_CALL_IMPORT2(index, a, b) \ |
| 381 a, b, kExprCallImport, 2, static_cast<byte>(index) |
| 382 #define WASM_CALL_IMPORT3(index, a, b, c) \ |
| 383 a, b, c, kExprCallImport, 3, static_cast<byte>(index) |
| 384 #define WASM_CALL_IMPORT4(index, a, b, c, d) \ |
| 385 a, b, c, d, kExprCallImport, 4, static_cast<byte>(index) |
| 386 #define WASM_CALL_IMPORT5(index, a, b, c, d, e) \ |
| 387 a, b, c, d, e, kExprCallImport, 5, static_cast<byte>(index) |
| 388 #define WASM_CALL_IMPORTN(arity, index, ...) \ |
| 389 __VA_ARGS__, kExprCallImport, U32V_1(arity), static_cast<byte>(index), |
| 390 |
353 #define WASM_CALL_INDIRECT0(index, func) \ | 391 #define WASM_CALL_INDIRECT0(index, func) \ |
354 kExprCallIndirect, static_cast<byte>(index), func | 392 func, kExprCallIndirect, 0, static_cast<byte>(index) |
355 #define WASM_NOT(x) kExprI32Eqz, x | 393 #define WASM_CALL_INDIRECT1(index, func, a) \ |
| 394 func, a, kExprCallIndirect, 1, static_cast<byte>(index) |
| 395 #define WASM_CALL_INDIRECT2(index, func, a, b) \ |
| 396 func, a, b, kExprCallIndirect, 2, static_cast<byte>(index) |
| 397 #define WASM_CALL_INDIRECT3(index, func, a, b, c) \ |
| 398 func, a, b, c, kExprCallIndirect, 3, static_cast<byte>(index) |
| 399 #define WASM_CALL_INDIRECT4(index, func, a, b, c, d) \ |
| 400 func, a, b, c, d, kExprCallIndirect, 4, static_cast<byte>(index) |
| 401 #define WASM_CALL_INDIRECT5(index, func, a, b, c, d, e) \ |
| 402 func, a, b, c, d, e, kExprCallIndirect, 5, static_cast<byte>(index) |
| 403 #define WASM_CALL_INDIRECTN(arity, index, func, ...) \ |
| 404 func, __VA_ARGS__, kExprCallIndirect, U32V_1(arity), static_cast<byte>(index) |
| 405 |
| 406 #define WASM_NOT(x) x, kExprI32Eqz |
| 407 #define WASM_SEQ(...) __VA_ARGS__ |
356 | 408 |
357 //------------------------------------------------------------------------------ | 409 //------------------------------------------------------------------------------ |
358 // Constructs that are composed of multiple bytecodes. | 410 // Constructs that are composed of multiple bytecodes. |
359 //------------------------------------------------------------------------------ | 411 //------------------------------------------------------------------------------ |
360 #define WASM_WHILE(x, y) kExprLoop, 1, kExprIf, x, kExprBr, 0, y | 412 #define WASM_WHILE(x, y) \ |
361 #define WASM_INC_LOCAL(index) \ | 413 kExprLoop, x, kExprIf, y, kExprBr, ARITY_1, DEPTH_1, kExprEnd, kExprEnd |
362 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ | 414 #define WASM_INC_LOCAL(index) \ |
363 static_cast<byte>(index), kExprI8Const, 1 | 415 kExprGetLocal, static_cast<byte>(index), kExprI8Const, 1, kExprI32Add, \ |
364 #define WASM_INC_LOCAL_BY(index, count) \ | 416 kExprSetLocal, static_cast<byte>(index) |
365 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ | 417 #define WASM_INC_LOCAL_BY(index, count) \ |
366 static_cast<byte>(index), kExprI8Const, static_cast<int8_t>(count) | 418 kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ |
367 | 419 static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ |
368 #define WASM_UNOP(opcode, x) static_cast<byte>(opcode), x | 420 static_cast<byte>(index) |
369 #define WASM_BINOP(opcode, x, y) static_cast<byte>(opcode), x, y | 421 #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) |
| 422 #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) |
370 | 423 |
371 //------------------------------------------------------------------------------ | 424 //------------------------------------------------------------------------------ |
372 // Int32 operations | 425 // Int32 operations |
373 //------------------------------------------------------------------------------ | 426 //------------------------------------------------------------------------------ |
374 #define WASM_I32_ADD(x, y) kExprI32Add, x, y | 427 #define WASM_I32_ADD(x, y) x, y, kExprI32Add |
375 #define WASM_I32_SUB(x, y) kExprI32Sub, x, y | 428 #define WASM_I32_SUB(x, y) x, y, kExprI32Sub |
376 #define WASM_I32_MUL(x, y) kExprI32Mul, x, y | 429 #define WASM_I32_MUL(x, y) x, y, kExprI32Mul |
377 #define WASM_I32_DIVS(x, y) kExprI32DivS, x, y | 430 #define WASM_I32_DIVS(x, y) x, y, kExprI32DivS |
378 #define WASM_I32_DIVU(x, y) kExprI32DivU, x, y | 431 #define WASM_I32_DIVU(x, y) x, y, kExprI32DivU |
379 #define WASM_I32_REMS(x, y) kExprI32RemS, x, y | 432 #define WASM_I32_REMS(x, y) x, y, kExprI32RemS |
380 #define WASM_I32_REMU(x, y) kExprI32RemU, x, y | 433 #define WASM_I32_REMU(x, y) x, y, kExprI32RemU |
381 #define WASM_I32_AND(x, y) kExprI32And, x, y | 434 #define WASM_I32_AND(x, y) x, y, kExprI32And |
382 #define WASM_I32_IOR(x, y) kExprI32Ior, x, y | 435 #define WASM_I32_IOR(x, y) x, y, kExprI32Ior |
383 #define WASM_I32_XOR(x, y) kExprI32Xor, x, y | 436 #define WASM_I32_XOR(x, y) x, y, kExprI32Xor |
384 #define WASM_I32_SHL(x, y) kExprI32Shl, x, y | 437 #define WASM_I32_SHL(x, y) x, y, kExprI32Shl |
385 #define WASM_I32_SHR(x, y) kExprI32ShrU, x, y | 438 #define WASM_I32_SHR(x, y) x, y, kExprI32ShrU |
386 #define WASM_I32_SAR(x, y) kExprI32ShrS, x, y | 439 #define WASM_I32_SAR(x, y) x, y, kExprI32ShrS |
387 #define WASM_I32_ROR(x, y) kExprI32Ror, x, y | 440 #define WASM_I32_ROR(x, y) x, y, kExprI32Ror |
388 #define WASM_I32_ROL(x, y) kExprI32Rol, x, y | 441 #define WASM_I32_ROL(x, y) x, y, kExprI32Rol |
389 #define WASM_I32_EQ(x, y) kExprI32Eq, x, y | 442 #define WASM_I32_EQ(x, y) x, y, kExprI32Eq |
390 #define WASM_I32_NE(x, y) kExprI32Ne, x, y | 443 #define WASM_I32_NE(x, y) x, y, kExprI32Ne |
391 #define WASM_I32_LTS(x, y) kExprI32LtS, x, y | 444 #define WASM_I32_LTS(x, y) x, y, kExprI32LtS |
392 #define WASM_I32_LES(x, y) kExprI32LeS, x, y | 445 #define WASM_I32_LES(x, y) x, y, kExprI32LeS |
393 #define WASM_I32_LTU(x, y) kExprI32LtU, x, y | 446 #define WASM_I32_LTU(x, y) x, y, kExprI32LtU |
394 #define WASM_I32_LEU(x, y) kExprI32LeU, x, y | 447 #define WASM_I32_LEU(x, y) x, y, kExprI32LeU |
395 #define WASM_I32_GTS(x, y) kExprI32GtS, x, y | 448 #define WASM_I32_GTS(x, y) x, y, kExprI32GtS |
396 #define WASM_I32_GES(x, y) kExprI32GeS, x, y | 449 #define WASM_I32_GES(x, y) x, y, kExprI32GeS |
397 #define WASM_I32_GTU(x, y) kExprI32GtU, x, y | 450 #define WASM_I32_GTU(x, y) x, y, kExprI32GtU |
398 #define WASM_I32_GEU(x, y) kExprI32GeU, x, y | 451 #define WASM_I32_GEU(x, y) x, y, kExprI32GeU |
399 #define WASM_I32_CLZ(x) kExprI32Clz, x | 452 #define WASM_I32_CLZ(x) x, kExprI32Clz |
400 #define WASM_I32_CTZ(x) kExprI32Ctz, x | 453 #define WASM_I32_CTZ(x) x, kExprI32Ctz |
401 #define WASM_I32_POPCNT(x) kExprI32Popcnt, x | 454 #define WASM_I32_POPCNT(x) x, kExprI32Popcnt |
402 #define WASM_I32_EQZ(x) kExprI32Eqz, x | 455 #define WASM_I32_EQZ(x) x, kExprI32Eqz |
403 | 456 |
404 //------------------------------------------------------------------------------ | 457 //------------------------------------------------------------------------------ |
405 // Int64 operations | 458 // Int64 operations |
406 //------------------------------------------------------------------------------ | 459 //------------------------------------------------------------------------------ |
407 #define WASM_I64_ADD(x, y) kExprI64Add, x, y | 460 #define WASM_I64_ADD(x, y) x, y, kExprI64Add |
408 #define WASM_I64_SUB(x, y) kExprI64Sub, x, y | 461 #define WASM_I64_SUB(x, y) x, y, kExprI64Sub |
409 #define WASM_I64_MUL(x, y) kExprI64Mul, x, y | 462 #define WASM_I64_MUL(x, y) x, y, kExprI64Mul |
410 #define WASM_I64_DIVS(x, y) kExprI64DivS, x, y | 463 #define WASM_I64_DIVS(x, y) x, y, kExprI64DivS |
411 #define WASM_I64_DIVU(x, y) kExprI64DivU, x, y | 464 #define WASM_I64_DIVU(x, y) x, y, kExprI64DivU |
412 #define WASM_I64_REMS(x, y) kExprI64RemS, x, y | 465 #define WASM_I64_REMS(x, y) x, y, kExprI64RemS |
413 #define WASM_I64_REMU(x, y) kExprI64RemU, x, y | 466 #define WASM_I64_REMU(x, y) x, y, kExprI64RemU |
414 #define WASM_I64_AND(x, y) kExprI64And, x, y | 467 #define WASM_I64_AND(x, y) x, y, kExprI64And |
415 #define WASM_I64_IOR(x, y) kExprI64Ior, x, y | 468 #define WASM_I64_IOR(x, y) x, y, kExprI64Ior |
416 #define WASM_I64_XOR(x, y) kExprI64Xor, x, y | 469 #define WASM_I64_XOR(x, y) x, y, kExprI64Xor |
417 #define WASM_I64_SHL(x, y) kExprI64Shl, x, y | 470 #define WASM_I64_SHL(x, y) x, y, kExprI64Shl |
418 #define WASM_I64_SHR(x, y) kExprI64ShrU, x, y | 471 #define WASM_I64_SHR(x, y) x, y, kExprI64ShrU |
419 #define WASM_I64_SAR(x, y) kExprI64ShrS, x, y | 472 #define WASM_I64_SAR(x, y) x, y, kExprI64ShrS |
420 #define WASM_I64_ROR(x, y) kExprI64Ror, x, y | 473 #define WASM_I64_ROR(x, y) x, y, kExprI64Ror |
421 #define WASM_I64_ROL(x, y) kExprI64Rol, x, y | 474 #define WASM_I64_ROL(x, y) x, y, kExprI64Rol |
422 #define WASM_I64_EQ(x, y) kExprI64Eq, x, y | 475 #define WASM_I64_EQ(x, y) x, y, kExprI64Eq |
423 #define WASM_I64_NE(x, y) kExprI64Ne, x, y | 476 #define WASM_I64_NE(x, y) x, y, kExprI64Ne |
424 #define WASM_I64_LTS(x, y) kExprI64LtS, x, y | 477 #define WASM_I64_LTS(x, y) x, y, kExprI64LtS |
425 #define WASM_I64_LES(x, y) kExprI64LeS, x, y | 478 #define WASM_I64_LES(x, y) x, y, kExprI64LeS |
426 #define WASM_I64_LTU(x, y) kExprI64LtU, x, y | 479 #define WASM_I64_LTU(x, y) x, y, kExprI64LtU |
427 #define WASM_I64_LEU(x, y) kExprI64LeU, x, y | 480 #define WASM_I64_LEU(x, y) x, y, kExprI64LeU |
428 #define WASM_I64_GTS(x, y) kExprI64GtS, x, y | 481 #define WASM_I64_GTS(x, y) x, y, kExprI64GtS |
429 #define WASM_I64_GES(x, y) kExprI64GeS, x, y | 482 #define WASM_I64_GES(x, y) x, y, kExprI64GeS |
430 #define WASM_I64_GTU(x, y) kExprI64GtU, x, y | 483 #define WASM_I64_GTU(x, y) x, y, kExprI64GtU |
431 #define WASM_I64_GEU(x, y) kExprI64GeU, x, y | 484 #define WASM_I64_GEU(x, y) x, y, kExprI64GeU |
432 #define WASM_I64_CLZ(x) kExprI64Clz, x | 485 #define WASM_I64_CLZ(x) x, kExprI64Clz |
433 #define WASM_I64_CTZ(x) kExprI64Ctz, x | 486 #define WASM_I64_CTZ(x) x, kExprI64Ctz |
434 #define WASM_I64_POPCNT(x) kExprI64Popcnt, x | 487 #define WASM_I64_POPCNT(x) x, kExprI64Popcnt |
435 #define WASM_I64_EQZ(x) kExprI64Eqz, x | 488 #define WASM_I64_EQZ(x) x, kExprI64Eqz |
436 | 489 |
437 //------------------------------------------------------------------------------ | 490 //------------------------------------------------------------------------------ |
438 // Float32 operations | 491 // Float32 operations |
439 //------------------------------------------------------------------------------ | 492 //------------------------------------------------------------------------------ |
440 #define WASM_F32_ADD(x, y) kExprF32Add, x, y | 493 #define WASM_F32_ADD(x, y) x, y, kExprF32Add |
441 #define WASM_F32_SUB(x, y) kExprF32Sub, x, y | 494 #define WASM_F32_SUB(x, y) x, y, kExprF32Sub |
442 #define WASM_F32_MUL(x, y) kExprF32Mul, x, y | 495 #define WASM_F32_MUL(x, y) x, y, kExprF32Mul |
443 #define WASM_F32_DIV(x, y) kExprF32Div, x, y | 496 #define WASM_F32_DIV(x, y) x, y, kExprF32Div |
444 #define WASM_F32_MIN(x, y) kExprF32Min, x, y | 497 #define WASM_F32_MIN(x, y) x, y, kExprF32Min |
445 #define WASM_F32_MAX(x, y) kExprF32Max, x, y | 498 #define WASM_F32_MAX(x, y) x, y, kExprF32Max |
446 #define WASM_F32_ABS(x) kExprF32Abs, x | 499 #define WASM_F32_ABS(x) x, kExprF32Abs |
447 #define WASM_F32_NEG(x) kExprF32Neg, x | 500 #define WASM_F32_NEG(x) x, kExprF32Neg |
448 #define WASM_F32_COPYSIGN(x, y) kExprF32CopySign, x, y | 501 #define WASM_F32_COPYSIGN(x, y) x, y, kExprF32CopySign |
449 #define WASM_F32_CEIL(x) kExprF32Ceil, x | 502 #define WASM_F32_CEIL(x) x, kExprF32Ceil |
450 #define WASM_F32_FLOOR(x) kExprF32Floor, x | 503 #define WASM_F32_FLOOR(x) x, kExprF32Floor |
451 #define WASM_F32_TRUNC(x) kExprF32Trunc, x | 504 #define WASM_F32_TRUNC(x) x, kExprF32Trunc |
452 #define WASM_F32_NEARESTINT(x) kExprF32NearestInt, x | 505 #define WASM_F32_NEARESTINT(x) x, kExprF32NearestInt |
453 #define WASM_F32_SQRT(x) kExprF32Sqrt, x | 506 #define WASM_F32_SQRT(x) x, kExprF32Sqrt |
454 #define WASM_F32_EQ(x, y) kExprF32Eq, x, y | 507 #define WASM_F32_EQ(x, y) x, y, kExprF32Eq |
455 #define WASM_F32_NE(x, y) kExprF32Ne, x, y | 508 #define WASM_F32_NE(x, y) x, y, kExprF32Ne |
456 #define WASM_F32_LT(x, y) kExprF32Lt, x, y | 509 #define WASM_F32_LT(x, y) x, y, kExprF32Lt |
457 #define WASM_F32_LE(x, y) kExprF32Le, x, y | 510 #define WASM_F32_LE(x, y) x, y, kExprF32Le |
458 #define WASM_F32_GT(x, y) kExprF32Gt, x, y | 511 #define WASM_F32_GT(x, y) x, y, kExprF32Gt |
459 #define WASM_F32_GE(x, y) kExprF32Ge, x, y | 512 #define WASM_F32_GE(x, y) x, y, kExprF32Ge |
460 | 513 |
461 //------------------------------------------------------------------------------ | 514 //------------------------------------------------------------------------------ |
462 // Float64 operations | 515 // Float64 operations |
463 //------------------------------------------------------------------------------ | 516 //------------------------------------------------------------------------------ |
464 #define WASM_F64_ADD(x, y) kExprF64Add, x, y | 517 #define WASM_F64_ADD(x, y) x, y, kExprF64Add |
465 #define WASM_F64_SUB(x, y) kExprF64Sub, x, y | 518 #define WASM_F64_SUB(x, y) x, y, kExprF64Sub |
466 #define WASM_F64_MUL(x, y) kExprF64Mul, x, y | 519 #define WASM_F64_MUL(x, y) x, y, kExprF64Mul |
467 #define WASM_F64_DIV(x, y) kExprF64Div, x, y | 520 #define WASM_F64_DIV(x, y) x, y, kExprF64Div |
468 #define WASM_F64_MIN(x, y) kExprF64Min, x, y | 521 #define WASM_F64_MIN(x, y) x, y, kExprF64Min |
469 #define WASM_F64_MAX(x, y) kExprF64Max, x, y | 522 #define WASM_F64_MAX(x, y) x, y, kExprF64Max |
470 #define WASM_F64_ABS(x) kExprF64Abs, x | 523 #define WASM_F64_ABS(x) x, kExprF64Abs |
471 #define WASM_F64_NEG(x) kExprF64Neg, x | 524 #define WASM_F64_NEG(x) x, kExprF64Neg |
472 #define WASM_F64_COPYSIGN(x, y) kExprF64CopySign, x, y | 525 #define WASM_F64_COPYSIGN(x, y) x, y, kExprF64CopySign |
473 #define WASM_F64_CEIL(x) kExprF64Ceil, x | 526 #define WASM_F64_CEIL(x) x, kExprF64Ceil |
474 #define WASM_F64_FLOOR(x) kExprF64Floor, x | 527 #define WASM_F64_FLOOR(x) x, kExprF64Floor |
475 #define WASM_F64_TRUNC(x) kExprF64Trunc, x | 528 #define WASM_F64_TRUNC(x) x, kExprF64Trunc |
476 #define WASM_F64_NEARESTINT(x) kExprF64NearestInt, x | 529 #define WASM_F64_NEARESTINT(x) x, kExprF64NearestInt |
477 #define WASM_F64_SQRT(x) kExprF64Sqrt, x | 530 #define WASM_F64_SQRT(x) x, kExprF64Sqrt |
478 #define WASM_F64_EQ(x, y) kExprF64Eq, x, y | 531 #define WASM_F64_EQ(x, y) x, y, kExprF64Eq |
479 #define WASM_F64_NE(x, y) kExprF64Ne, x, y | 532 #define WASM_F64_NE(x, y) x, y, kExprF64Ne |
480 #define WASM_F64_LT(x, y) kExprF64Lt, x, y | 533 #define WASM_F64_LT(x, y) x, y, kExprF64Lt |
481 #define WASM_F64_LE(x, y) kExprF64Le, x, y | 534 #define WASM_F64_LE(x, y) x, y, kExprF64Le |
482 #define WASM_F64_GT(x, y) kExprF64Gt, x, y | 535 #define WASM_F64_GT(x, y) x, y, kExprF64Gt |
483 #define WASM_F64_GE(x, y) kExprF64Ge, x, y | 536 #define WASM_F64_GE(x, y) x, y, kExprF64Ge |
484 | 537 |
485 //------------------------------------------------------------------------------ | 538 //------------------------------------------------------------------------------ |
486 // Type conversions. | 539 // Type conversions. |
487 //------------------------------------------------------------------------------ | 540 //------------------------------------------------------------------------------ |
488 #define WASM_I32_SCONVERT_F32(x) kExprI32SConvertF32, x | 541 #define WASM_I32_SCONVERT_F32(x) x, kExprI32SConvertF32 |
489 #define WASM_I32_SCONVERT_F64(x) kExprI32SConvertF64, x | 542 #define WASM_I32_SCONVERT_F64(x) x, kExprI32SConvertF64 |
490 #define WASM_I32_UCONVERT_F32(x) kExprI32UConvertF32, x | 543 #define WASM_I32_UCONVERT_F32(x) x, kExprI32UConvertF32 |
491 #define WASM_I32_UCONVERT_F64(x) kExprI32UConvertF64, x | 544 #define WASM_I32_UCONVERT_F64(x) x, kExprI32UConvertF64 |
492 #define WASM_I32_CONVERT_I64(x) kExprI32ConvertI64, x | 545 #define WASM_I32_CONVERT_I64(x) x, kExprI32ConvertI64 |
493 #define WASM_I64_SCONVERT_F32(x) kExprI64SConvertF32, x | 546 #define WASM_I64_SCONVERT_F32(x) x, kExprI64SConvertF32 |
494 #define WASM_I64_SCONVERT_F64(x) kExprI64SConvertF64, x | 547 #define WASM_I64_SCONVERT_F64(x) x, kExprI64SConvertF64 |
495 #define WASM_I64_UCONVERT_F32(x) kExprI64UConvertF32, x | 548 #define WASM_I64_UCONVERT_F32(x) x, kExprI64UConvertF32 |
496 #define WASM_I64_UCONVERT_F64(x) kExprI64UConvertF64, x | 549 #define WASM_I64_UCONVERT_F64(x) x, kExprI64UConvertF64 |
497 #define WASM_I64_SCONVERT_I32(x) kExprI64SConvertI32, x | 550 #define WASM_I64_SCONVERT_I32(x) x, kExprI64SConvertI32 |
498 #define WASM_I64_UCONVERT_I32(x) kExprI64UConvertI32, x | 551 #define WASM_I64_UCONVERT_I32(x) x, kExprI64UConvertI32 |
499 #define WASM_F32_SCONVERT_I32(x) kExprF32SConvertI32, x | 552 #define WASM_F32_SCONVERT_I32(x) x, kExprF32SConvertI32 |
500 #define WASM_F32_UCONVERT_I32(x) kExprF32UConvertI32, x | 553 #define WASM_F32_UCONVERT_I32(x) x, kExprF32UConvertI32 |
501 #define WASM_F32_SCONVERT_I64(x) kExprF32SConvertI64, x | 554 #define WASM_F32_SCONVERT_I64(x) x, kExprF32SConvertI64 |
502 #define WASM_F32_UCONVERT_I64(x) kExprF32UConvertI64, x | 555 #define WASM_F32_UCONVERT_I64(x) x, kExprF32UConvertI64 |
503 #define WASM_F32_CONVERT_F64(x) kExprF32ConvertF64, x | 556 #define WASM_F32_CONVERT_F64(x) x, kExprF32ConvertF64 |
504 #define WASM_F32_REINTERPRET_I32(x) kExprF32ReinterpretI32, x | 557 #define WASM_F32_REINTERPRET_I32(x) x, kExprF32ReinterpretI32 |
505 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x | 558 #define WASM_F64_SCONVERT_I32(x) x, kExprF64SConvertI32 |
506 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x | 559 #define WASM_F64_UCONVERT_I32(x) x, kExprF64UConvertI32 |
507 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x | 560 #define WASM_F64_SCONVERT_I64(x) x, kExprF64SConvertI64 |
508 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x | 561 #define WASM_F64_UCONVERT_I64(x) x, kExprF64UConvertI64 |
509 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x | 562 #define WASM_F64_CONVERT_F32(x) x, kExprF64ConvertF32 |
510 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x | 563 #define WASM_F64_REINTERPRET_I64(x) x, kExprF64ReinterpretI64 |
511 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x | 564 #define WASM_I32_REINTERPRET_F32(x) x, kExprI32ReinterpretF32 |
512 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x | 565 #define WASM_I64_REINTERPRET_F64(x) x, kExprI64ReinterpretF64 |
513 | 566 |
514 #endif // V8_WASM_MACRO_GEN_H_ | 567 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |