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 WASM_BLOCK(count, ...) kExprBlock, __VA_ARGS__, kExprEnd |
62 #define WASM_INFINITE_LOOP kExprLoop, 1, kExprBr, 0, kExprNop | 62 #define WASM_INFINITE_LOOP kExprLoop, kExprNop, kExprBr, 0, kExprEnd |
63 #define WASM_LOOP(count, ...) kExprLoop, static_cast<byte>(count), __VA_ARGS__ | 63 #define WASM_LOOP(count, ...) kExprLoop, __VA_ARGS__, kExprEnd |
64 #define WASM_IF(cond, tstmt) kExprIf, cond, tstmt | 64 #define WASM_IF(cond, tstmt) cond, kExprIf, tstmt, kExprEnd |
65 #define WASM_IF_ELSE(cond, tstmt, fstmt) kExprIfElse, cond, tstmt, fstmt | 65 #define WASM_IF_ELSE(cond, tstmt, fstmt) \ |
66 #define WASM_SELECT(cond, tval, fval) kExprSelect, cond, tval, fval | 66 cond, kExprIf, tstmt, kExprElse, fstmt, kExprEnd |
67 #define WASM_BR(depth) kExprBr, static_cast<byte>(depth), kExprNop | 67 #define WASM_SELECT(cond, tval, fval) cond, tval, fval, kExprSelect |
binji
2016/03/29 18:04:34
this should be tval, fval, cond, kExprSelect
(the
titzer
2016/03/30 08:37:23
Good catch. Names were wrong, order was right.
| |
68 #define WASM_BR(depth) kExprNop, kExprBr, static_cast<byte>(depth) | |
68 #define WASM_BR_IF(depth, cond) \ | 69 #define WASM_BR_IF(depth, cond) \ |
69 kExprBrIf, static_cast<byte>(depth), kExprNop, cond | 70 kExprNop, cond, kExprBrIf, static_cast<byte>(depth) |
70 #define WASM_BRV(depth, val) kExprBr, static_cast<byte>(depth), val | 71 #define WASM_BRV(depth, val) val, kExprBr, static_cast<byte>(depth) |
71 #define WASM_BRV_IF(depth, val, cond) \ | 72 #define WASM_BRV_IF(depth, val, cond) \ |
72 kExprBrIf, static_cast<byte>(depth), val, cond | 73 val, cond, kExprBrIf, static_cast<byte>(depth) |
73 #define WASM_BREAK(depth) kExprBr, static_cast<byte>(depth + 1), kExprNop | 74 #define WASM_BREAK(depth) kExprNop, kExprBr, static_cast<byte>(depth + 1) |
74 #define WASM_CONTINUE(depth) kExprBr, static_cast<byte>(depth), kExprNop | 75 #define WASM_CONTINUE(depth) kExprNop, kExprBr, static_cast<byte>(depth) |
75 #define WASM_BREAKV(depth, val) kExprBr, static_cast<byte>(depth + 1), val | 76 #define WASM_BREAKV(depth, val) val, kExprBr, static_cast<byte>(depth + 1) |
76 #define WASM_RETURN0 kExprReturn | 77 #define WASM_RETURN0 kExprReturn |
77 #define WASM_RETURN(...) kExprReturn, __VA_ARGS__ | 78 #define WASM_RETURN(...) __VA_ARGS__, kExprReturn |
78 #define WASM_UNREACHABLE kExprUnreachable | 79 #define WASM_UNREACHABLE kExprUnreachable |
79 | 80 |
80 #define WASM_BR_TABLE(key, count, ...) \ | 81 #define WASM_BR_TABLE(key, count, ...) \ |
81 kExprBrTable, U32V_1(count), __VA_ARGS__, key | 82 key, kExprBrTable, U32V_1(count), __VA_ARGS__ |
82 | 83 |
83 #define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8) | 84 #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) | 85 #define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8) |
85 | 86 |
86 //------------------------------------------------------------------------------ | 87 //------------------------------------------------------------------------------ |
87 // Misc expressions. | 88 // Misc expressions. |
88 //------------------------------------------------------------------------------ | 89 //------------------------------------------------------------------------------ |
89 #define WASM_ID(...) __VA_ARGS__ | 90 #define WASM_ID(...) __VA_ARGS__ |
90 #define WASM_ZERO kExprI8Const, 0 | 91 #define WASM_ZERO kExprI8Const, 0 |
91 #define WASM_ONE kExprI8Const, 1 | 92 #define WASM_ONE kExprI8Const, 1 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 #define WASM_F64(val) \ | 316 #define WASM_F64(val) \ |
316 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ | 317 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ |
317 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ | 318 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ |
318 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ | 319 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ |
319 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ | 320 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ |
320 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ | 321 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ |
321 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ | 322 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ |
322 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ | 323 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ |
323 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) | 324 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) |
324 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) | 325 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) |
325 #define WASM_SET_LOCAL(index, val) kExprSetLocal, static_cast<byte>(index), val | 326 #define WASM_SET_LOCAL(index, val) val, kExprSetLocal, static_cast<byte>(index) |
326 #define WASM_LOAD_GLOBAL(index) kExprLoadGlobal, static_cast<byte>(index) | 327 #define WASM_LOAD_GLOBAL(index) kExprLoadGlobal, static_cast<byte>(index) |
327 #define WASM_STORE_GLOBAL(index, val) \ | 328 #define WASM_STORE_GLOBAL(index, val) \ |
328 kExprStoreGlobal, static_cast<byte>(index), val | 329 val, kExprStoreGlobal, static_cast<byte>(index) |
329 #define WASM_LOAD_MEM(type, index) \ | 330 #define WASM_LOAD_MEM(type, index) \ |
330 static_cast<byte>( \ | 331 index, static_cast<byte>( \ |
331 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 332 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
332 ZERO_ALIGNMENT, ZERO_OFFSET, index | 333 ZERO_ALIGNMENT, ZERO_OFFSET |
333 #define WASM_STORE_MEM(type, index, val) \ | 334 #define WASM_STORE_MEM(type, index, val) \ |
334 static_cast<byte>( \ | 335 index, val, \ |
335 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 336 static_cast<byte>( \ |
336 ZERO_ALIGNMENT, ZERO_OFFSET, index, val | 337 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ |
337 #define WASM_LOAD_MEM_OFFSET(type, offset, index) \ | 338 ZERO_ALIGNMENT, ZERO_OFFSET |
338 static_cast<byte>( \ | 339 #define WASM_LOAD_MEM_OFFSET(type, offset, index) \ |
339 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 340 index, static_cast<byte>( \ |
340 ZERO_ALIGNMENT, U32V_1(offset), index | 341 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
341 #define WASM_STORE_MEM_OFFSET(type, offset, index, val) \ | 342 ZERO_ALIGNMENT, static_cast<byte>(offset) |
342 static_cast<byte>( \ | 343 #define WASM_STORE_MEM_OFFSET(type, offset, index, val) \ |
343 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 344 index, val, \ |
344 ZERO_ALIGNMENT, U32V_1(offset), index, val | 345 static_cast<byte>( \ |
346 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | |
347 ZERO_ALIGNMENT, static_cast<byte>(offset) | |
345 #define WASM_CALL_FUNCTION(index, ...) \ | 348 #define WASM_CALL_FUNCTION(index, ...) \ |
346 kExprCallFunction, static_cast<byte>(index), __VA_ARGS__ | 349 __VA_ARGS__, kExprCallFunction, static_cast<byte>(index) |
347 #define WASM_CALL_IMPORT(index, ...) \ | 350 #define WASM_CALL_IMPORT(index, ...) \ |
348 kExprCallImport, static_cast<byte>(index), __VA_ARGS__ | 351 __VA_ARGS__, kExprCallImport, static_cast<byte>(index), |
349 #define WASM_CALL_INDIRECT(index, func, ...) \ | 352 #define WASM_CALL_INDIRECT(index, func, ...) \ |
350 kExprCallIndirect, static_cast<byte>(index), func, __VA_ARGS__ | 353 func, __VA_ARGS__, kExprCallIndirect, static_cast<byte>(index) |
351 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) | 354 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) |
352 #define WASM_CALL_IMPORT0(index) kExprCallImport, static_cast<byte>(index) | 355 #define WASM_CALL_IMPORT0(index) kExprCallImport, static_cast<byte>(index) |
353 #define WASM_CALL_INDIRECT0(index, func) \ | 356 #define WASM_CALL_INDIRECT0(index, func) \ |
354 kExprCallIndirect, static_cast<byte>(index), func | 357 func, kExprCallIndirect, static_cast<byte>(index) |
355 #define WASM_NOT(x) kExprI32Eqz, x | 358 #define WASM_NOT(x) x, kExprI32Eqz |
356 | 359 |
357 //------------------------------------------------------------------------------ | 360 //------------------------------------------------------------------------------ |
358 // Constructs that are composed of multiple bytecodes. | 361 // Constructs that are composed of multiple bytecodes. |
359 //------------------------------------------------------------------------------ | 362 //------------------------------------------------------------------------------ |
360 #define WASM_WHILE(x, y) kExprLoop, 1, kExprIf, x, kExprBr, 0, y | 363 #define WASM_WHILE(x, y) \ |
361 #define WASM_INC_LOCAL(index) \ | 364 kExprLoop, x, kExprIf, y, kExprBr, 0, kExprEnd, kExprEnd |
362 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ | 365 #define WASM_INC_LOCAL(index) \ |
363 static_cast<byte>(index), kExprI8Const, 1 | 366 kExprGetLocal, static_cast<byte>(index), kExprI8Const, 1, kExprI32Add, \ |
364 #define WASM_INC_LOCAL_BY(index, count) \ | 367 kExprSetLocal, static_cast<byte>(index) |
365 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ | 368 #define WASM_INC_LOCAL_BY(index, count) \ |
366 static_cast<byte>(index), kExprI8Const, static_cast<int8_t>(count) | 369 kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ |
367 | 370 static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ |
368 #define WASM_UNOP(opcode, x) static_cast<byte>(opcode), x | 371 static_cast<byte>(index) |
369 #define WASM_BINOP(opcode, x, y) static_cast<byte>(opcode), x, y | 372 #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) |
373 #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) | |
370 | 374 |
371 //------------------------------------------------------------------------------ | 375 //------------------------------------------------------------------------------ |
372 // Int32 operations | 376 // Int32 operations |
373 //------------------------------------------------------------------------------ | 377 //------------------------------------------------------------------------------ |
374 #define WASM_I32_ADD(x, y) kExprI32Add, x, y | 378 #define WASM_I32_ADD(x, y) x, y, kExprI32Add |
375 #define WASM_I32_SUB(x, y) kExprI32Sub, x, y | 379 #define WASM_I32_SUB(x, y) x, y, kExprI32Sub |
376 #define WASM_I32_MUL(x, y) kExprI32Mul, x, y | 380 #define WASM_I32_MUL(x, y) x, y, kExprI32Mul |
377 #define WASM_I32_DIVS(x, y) kExprI32DivS, x, y | 381 #define WASM_I32_DIVS(x, y) x, y, kExprI32DivS |
378 #define WASM_I32_DIVU(x, y) kExprI32DivU, x, y | 382 #define WASM_I32_DIVU(x, y) x, y, kExprI32DivU |
379 #define WASM_I32_REMS(x, y) kExprI32RemS, x, y | 383 #define WASM_I32_REMS(x, y) x, y, kExprI32RemS |
380 #define WASM_I32_REMU(x, y) kExprI32RemU, x, y | 384 #define WASM_I32_REMU(x, y) x, y, kExprI32RemU |
381 #define WASM_I32_AND(x, y) kExprI32And, x, y | 385 #define WASM_I32_AND(x, y) x, y, kExprI32And |
382 #define WASM_I32_IOR(x, y) kExprI32Ior, x, y | 386 #define WASM_I32_IOR(x, y) x, y, kExprI32Ior |
383 #define WASM_I32_XOR(x, y) kExprI32Xor, x, y | 387 #define WASM_I32_XOR(x, y) x, y, kExprI32Xor |
384 #define WASM_I32_SHL(x, y) kExprI32Shl, x, y | 388 #define WASM_I32_SHL(x, y) x, y, kExprI32Shl |
385 #define WASM_I32_SHR(x, y) kExprI32ShrU, x, y | 389 #define WASM_I32_SHR(x, y) x, y, kExprI32ShrU |
386 #define WASM_I32_SAR(x, y) kExprI32ShrS, x, y | 390 #define WASM_I32_SAR(x, y) x, y, kExprI32ShrS |
387 #define WASM_I32_ROR(x, y) kExprI32Ror, x, y | 391 #define WASM_I32_ROR(x, y) x, y, kExprI32Ror |
388 #define WASM_I32_ROL(x, y) kExprI32Rol, x, y | 392 #define WASM_I32_ROL(x, y) x, y, kExprI32Rol |
389 #define WASM_I32_EQ(x, y) kExprI32Eq, x, y | 393 #define WASM_I32_EQ(x, y) x, y, kExprI32Eq |
390 #define WASM_I32_NE(x, y) kExprI32Ne, x, y | 394 #define WASM_I32_NE(x, y) x, y, kExprI32Ne |
391 #define WASM_I32_LTS(x, y) kExprI32LtS, x, y | 395 #define WASM_I32_LTS(x, y) x, y, kExprI32LtS |
392 #define WASM_I32_LES(x, y) kExprI32LeS, x, y | 396 #define WASM_I32_LES(x, y) x, y, kExprI32LeS |
393 #define WASM_I32_LTU(x, y) kExprI32LtU, x, y | 397 #define WASM_I32_LTU(x, y) x, y, kExprI32LtU |
394 #define WASM_I32_LEU(x, y) kExprI32LeU, x, y | 398 #define WASM_I32_LEU(x, y) x, y, kExprI32LeU |
395 #define WASM_I32_GTS(x, y) kExprI32GtS, x, y | 399 #define WASM_I32_GTS(x, y) x, y, kExprI32GtS |
396 #define WASM_I32_GES(x, y) kExprI32GeS, x, y | 400 #define WASM_I32_GES(x, y) x, y, kExprI32GeS |
397 #define WASM_I32_GTU(x, y) kExprI32GtU, x, y | 401 #define WASM_I32_GTU(x, y) x, y, kExprI32GtU |
398 #define WASM_I32_GEU(x, y) kExprI32GeU, x, y | 402 #define WASM_I32_GEU(x, y) x, y, kExprI32GeU |
399 #define WASM_I32_CLZ(x) kExprI32Clz, x | 403 #define WASM_I32_CLZ(x) x, kExprI32Clz |
400 #define WASM_I32_CTZ(x) kExprI32Ctz, x | 404 #define WASM_I32_CTZ(x) x, kExprI32Ctz |
401 #define WASM_I32_POPCNT(x) kExprI32Popcnt, x | 405 #define WASM_I32_POPCNT(x) x, kExprI32Popcnt |
402 #define WASM_I32_EQZ(x) kExprI32Eqz, x | 406 #define WASM_I32_EQZ(x) x, kExprI32Eqz |
403 | 407 |
404 //------------------------------------------------------------------------------ | 408 //------------------------------------------------------------------------------ |
405 // Int64 operations | 409 // Int64 operations |
406 //------------------------------------------------------------------------------ | 410 //------------------------------------------------------------------------------ |
407 #define WASM_I64_ADD(x, y) kExprI64Add, x, y | 411 #define WASM_I64_ADD(x, y) x, y, kExprI64Add |
408 #define WASM_I64_SUB(x, y) kExprI64Sub, x, y | 412 #define WASM_I64_SUB(x, y) x, y, kExprI64Sub |
409 #define WASM_I64_MUL(x, y) kExprI64Mul, x, y | 413 #define WASM_I64_MUL(x, y) x, y, kExprI64Mul |
410 #define WASM_I64_DIVS(x, y) kExprI64DivS, x, y | 414 #define WASM_I64_DIVS(x, y) x, y, kExprI64DivS |
411 #define WASM_I64_DIVU(x, y) kExprI64DivU, x, y | 415 #define WASM_I64_DIVU(x, y) x, y, kExprI64DivU |
412 #define WASM_I64_REMS(x, y) kExprI64RemS, x, y | 416 #define WASM_I64_REMS(x, y) x, y, kExprI64RemS |
413 #define WASM_I64_REMU(x, y) kExprI64RemU, x, y | 417 #define WASM_I64_REMU(x, y) x, y, kExprI64RemU |
414 #define WASM_I64_AND(x, y) kExprI64And, x, y | 418 #define WASM_I64_AND(x, y) x, y, kExprI64And |
415 #define WASM_I64_IOR(x, y) kExprI64Ior, x, y | 419 #define WASM_I64_IOR(x, y) x, y, kExprI64Ior |
416 #define WASM_I64_XOR(x, y) kExprI64Xor, x, y | 420 #define WASM_I64_XOR(x, y) x, y, kExprI64Xor |
417 #define WASM_I64_SHL(x, y) kExprI64Shl, x, y | 421 #define WASM_I64_SHL(x, y) x, y, kExprI64Shl |
418 #define WASM_I64_SHR(x, y) kExprI64ShrU, x, y | 422 #define WASM_I64_SHR(x, y) x, y, kExprI64ShrU |
419 #define WASM_I64_SAR(x, y) kExprI64ShrS, x, y | 423 #define WASM_I64_SAR(x, y) x, y, kExprI64ShrS |
420 #define WASM_I64_ROR(x, y) kExprI64Ror, x, y | 424 #define WASM_I64_ROR(x, y) x, y, kExprI64Ror |
421 #define WASM_I64_ROL(x, y) kExprI64Rol, x, y | 425 #define WASM_I64_ROL(x, y) x, y, kExprI64Rol |
422 #define WASM_I64_EQ(x, y) kExprI64Eq, x, y | 426 #define WASM_I64_EQ(x, y) x, y, kExprI64Eq |
423 #define WASM_I64_NE(x, y) kExprI64Ne, x, y | 427 #define WASM_I64_NE(x, y) x, y, kExprI64Ne |
424 #define WASM_I64_LTS(x, y) kExprI64LtS, x, y | 428 #define WASM_I64_LTS(x, y) x, y, kExprI64LtS |
425 #define WASM_I64_LES(x, y) kExprI64LeS, x, y | 429 #define WASM_I64_LES(x, y) x, y, kExprI64LeS |
426 #define WASM_I64_LTU(x, y) kExprI64LtU, x, y | 430 #define WASM_I64_LTU(x, y) x, y, kExprI64LtU |
427 #define WASM_I64_LEU(x, y) kExprI64LeU, x, y | 431 #define WASM_I64_LEU(x, y) x, y, kExprI64LeU |
428 #define WASM_I64_GTS(x, y) kExprI64GtS, x, y | 432 #define WASM_I64_GTS(x, y) x, y, kExprI64GtS |
429 #define WASM_I64_GES(x, y) kExprI64GeS, x, y | 433 #define WASM_I64_GES(x, y) x, y, kExprI64GeS |
430 #define WASM_I64_GTU(x, y) kExprI64GtU, x, y | 434 #define WASM_I64_GTU(x, y) x, y, kExprI64GtU |
431 #define WASM_I64_GEU(x, y) kExprI64GeU, x, y | 435 #define WASM_I64_GEU(x, y) x, y, kExprI64GeU |
432 #define WASM_I64_CLZ(x) kExprI64Clz, x | 436 #define WASM_I64_CLZ(x) x, kExprI64Clz |
433 #define WASM_I64_CTZ(x) kExprI64Ctz, x | 437 #define WASM_I64_CTZ(x) x, kExprI64Ctz |
434 #define WASM_I64_POPCNT(x) kExprI64Popcnt, x | 438 #define WASM_I64_POPCNT(x) x, kExprI64Popcnt |
435 #define WASM_I64_EQZ(x) kExprI64Eqz, x | 439 #define WASM_I64_EQZ(x) x, kExprI64Eqz |
436 | 440 |
437 //------------------------------------------------------------------------------ | 441 //------------------------------------------------------------------------------ |
438 // Float32 operations | 442 // Float32 operations |
439 //------------------------------------------------------------------------------ | 443 //------------------------------------------------------------------------------ |
440 #define WASM_F32_ADD(x, y) kExprF32Add, x, y | 444 #define WASM_F32_ADD(x, y) x, y, kExprF32Add |
441 #define WASM_F32_SUB(x, y) kExprF32Sub, x, y | 445 #define WASM_F32_SUB(x, y) x, y, kExprF32Sub |
442 #define WASM_F32_MUL(x, y) kExprF32Mul, x, y | 446 #define WASM_F32_MUL(x, y) x, y, kExprF32Mul |
443 #define WASM_F32_DIV(x, y) kExprF32Div, x, y | 447 #define WASM_F32_DIV(x, y) x, y, kExprF32Div |
444 #define WASM_F32_MIN(x, y) kExprF32Min, x, y | 448 #define WASM_F32_MIN(x, y) x, y, kExprF32Min |
445 #define WASM_F32_MAX(x, y) kExprF32Max, x, y | 449 #define WASM_F32_MAX(x, y) x, y, kExprF32Max |
446 #define WASM_F32_ABS(x) kExprF32Abs, x | 450 #define WASM_F32_ABS(x) x, kExprF32Abs |
447 #define WASM_F32_NEG(x) kExprF32Neg, x | 451 #define WASM_F32_NEG(x) x, kExprF32Neg |
448 #define WASM_F32_COPYSIGN(x, y) kExprF32CopySign, x, y | 452 #define WASM_F32_COPYSIGN(x, y) x, y, kExprF32CopySign |
449 #define WASM_F32_CEIL(x) kExprF32Ceil, x | 453 #define WASM_F32_CEIL(x) x, kExprF32Ceil |
450 #define WASM_F32_FLOOR(x) kExprF32Floor, x | 454 #define WASM_F32_FLOOR(x) x, kExprF32Floor |
451 #define WASM_F32_TRUNC(x) kExprF32Trunc, x | 455 #define WASM_F32_TRUNC(x) x, kExprF32Trunc |
452 #define WASM_F32_NEARESTINT(x) kExprF32NearestInt, x | 456 #define WASM_F32_NEARESTINT(x) x, kExprF32NearestInt |
453 #define WASM_F32_SQRT(x) kExprF32Sqrt, x | 457 #define WASM_F32_SQRT(x) x, kExprF32Sqrt |
454 #define WASM_F32_EQ(x, y) kExprF32Eq, x, y | 458 #define WASM_F32_EQ(x, y) x, y, kExprF32Eq |
455 #define WASM_F32_NE(x, y) kExprF32Ne, x, y | 459 #define WASM_F32_NE(x, y) x, y, kExprF32Ne |
456 #define WASM_F32_LT(x, y) kExprF32Lt, x, y | 460 #define WASM_F32_LT(x, y) x, y, kExprF32Lt |
457 #define WASM_F32_LE(x, y) kExprF32Le, x, y | 461 #define WASM_F32_LE(x, y) x, y, kExprF32Le |
458 #define WASM_F32_GT(x, y) kExprF32Gt, x, y | 462 #define WASM_F32_GT(x, y) x, y, kExprF32Gt |
459 #define WASM_F32_GE(x, y) kExprF32Ge, x, y | 463 #define WASM_F32_GE(x, y) x, y, kExprF32Ge |
460 | 464 |
461 //------------------------------------------------------------------------------ | 465 //------------------------------------------------------------------------------ |
462 // Float64 operations | 466 // Float64 operations |
463 //------------------------------------------------------------------------------ | 467 //------------------------------------------------------------------------------ |
464 #define WASM_F64_ADD(x, y) kExprF64Add, x, y | 468 #define WASM_F64_ADD(x, y) x, y, kExprF64Add |
465 #define WASM_F64_SUB(x, y) kExprF64Sub, x, y | 469 #define WASM_F64_SUB(x, y) x, y, kExprF64Sub |
466 #define WASM_F64_MUL(x, y) kExprF64Mul, x, y | 470 #define WASM_F64_MUL(x, y) x, y, kExprF64Mul |
467 #define WASM_F64_DIV(x, y) kExprF64Div, x, y | 471 #define WASM_F64_DIV(x, y) x, y, kExprF64Div |
468 #define WASM_F64_MIN(x, y) kExprF64Min, x, y | 472 #define WASM_F64_MIN(x, y) x, y, kExprF64Min |
469 #define WASM_F64_MAX(x, y) kExprF64Max, x, y | 473 #define WASM_F64_MAX(x, y) x, y, kExprF64Max |
470 #define WASM_F64_ABS(x) kExprF64Abs, x | 474 #define WASM_F64_ABS(x) x, kExprF64Abs |
471 #define WASM_F64_NEG(x) kExprF64Neg, x | 475 #define WASM_F64_NEG(x) x, kExprF64Neg |
472 #define WASM_F64_COPYSIGN(x, y) kExprF64CopySign, x, y | 476 #define WASM_F64_COPYSIGN(x, y) x, y, kExprF64CopySign |
473 #define WASM_F64_CEIL(x) kExprF64Ceil, x | 477 #define WASM_F64_CEIL(x) x, kExprF64Ceil |
474 #define WASM_F64_FLOOR(x) kExprF64Floor, x | 478 #define WASM_F64_FLOOR(x) x, kExprF64Floor |
475 #define WASM_F64_TRUNC(x) kExprF64Trunc, x | 479 #define WASM_F64_TRUNC(x) x, kExprF64Trunc |
476 #define WASM_F64_NEARESTINT(x) kExprF64NearestInt, x | 480 #define WASM_F64_NEARESTINT(x) x, kExprF64NearestInt |
477 #define WASM_F64_SQRT(x) kExprF64Sqrt, x | 481 #define WASM_F64_SQRT(x) x, kExprF64Sqrt |
478 #define WASM_F64_EQ(x, y) kExprF64Eq, x, y | 482 #define WASM_F64_EQ(x, y) x, y, kExprF64Eq |
479 #define WASM_F64_NE(x, y) kExprF64Ne, x, y | 483 #define WASM_F64_NE(x, y) x, y, kExprF64Ne |
480 #define WASM_F64_LT(x, y) kExprF64Lt, x, y | 484 #define WASM_F64_LT(x, y) x, y, kExprF64Lt |
481 #define WASM_F64_LE(x, y) kExprF64Le, x, y | 485 #define WASM_F64_LE(x, y) x, y, kExprF64Le |
482 #define WASM_F64_GT(x, y) kExprF64Gt, x, y | 486 #define WASM_F64_GT(x, y) x, y, kExprF64Gt |
483 #define WASM_F64_GE(x, y) kExprF64Ge, x, y | 487 #define WASM_F64_GE(x, y) x, y, kExprF64Ge |
484 | 488 |
485 //------------------------------------------------------------------------------ | 489 //------------------------------------------------------------------------------ |
486 // Type conversions. | 490 // Type conversions. |
487 //------------------------------------------------------------------------------ | 491 //------------------------------------------------------------------------------ |
488 #define WASM_I32_SCONVERT_F32(x) kExprI32SConvertF32, x | 492 #define WASM_I32_SCONVERT_F32(x) x, kExprI32SConvertF32 |
489 #define WASM_I32_SCONVERT_F64(x) kExprI32SConvertF64, x | 493 #define WASM_I32_SCONVERT_F64(x) x, kExprI32SConvertF64 |
490 #define WASM_I32_UCONVERT_F32(x) kExprI32UConvertF32, x | 494 #define WASM_I32_UCONVERT_F32(x) x, kExprI32UConvertF32 |
491 #define WASM_I32_UCONVERT_F64(x) kExprI32UConvertF64, x | 495 #define WASM_I32_UCONVERT_F64(x) x, kExprI32UConvertF64 |
492 #define WASM_I32_CONVERT_I64(x) kExprI32ConvertI64, x | 496 #define WASM_I32_CONVERT_I64(x) x, kExprI32ConvertI64 |
493 #define WASM_I64_SCONVERT_F32(x) kExprI64SConvertF32, x | 497 #define WASM_I64_SCONVERT_F32(x) x, kExprI64SConvertF32 |
494 #define WASM_I64_SCONVERT_F64(x) kExprI64SConvertF64, x | 498 #define WASM_I64_SCONVERT_F64(x) x, kExprI64SConvertF64 |
495 #define WASM_I64_UCONVERT_F32(x) kExprI64UConvertF32, x | 499 #define WASM_I64_UCONVERT_F32(x) x, kExprI64UConvertF32 |
496 #define WASM_I64_UCONVERT_F64(x) kExprI64UConvertF64, x | 500 #define WASM_I64_UCONVERT_F64(x) x, kExprI64UConvertF64 |
497 #define WASM_I64_SCONVERT_I32(x) kExprI64SConvertI32, x | 501 #define WASM_I64_SCONVERT_I32(x) x, kExprI64SConvertI32 |
498 #define WASM_I64_UCONVERT_I32(x) kExprI64UConvertI32, x | 502 #define WASM_I64_UCONVERT_I32(x) x, kExprI64UConvertI32 |
499 #define WASM_F32_SCONVERT_I32(x) kExprF32SConvertI32, x | 503 #define WASM_F32_SCONVERT_I32(x) x, kExprF32SConvertI32 |
500 #define WASM_F32_UCONVERT_I32(x) kExprF32UConvertI32, x | 504 #define WASM_F32_UCONVERT_I32(x) x, kExprF32UConvertI32 |
501 #define WASM_F32_SCONVERT_I64(x) kExprF32SConvertI64, x | 505 #define WASM_F32_SCONVERT_I64(x) x, kExprF32SConvertI64 |
502 #define WASM_F32_UCONVERT_I64(x) kExprF32UConvertI64, x | 506 #define WASM_F32_UCONVERT_I64(x) x, kExprF32UConvertI64 |
503 #define WASM_F32_CONVERT_F64(x) kExprF32ConvertF64, x | 507 #define WASM_F32_CONVERT_F64(x) x, kExprF32ConvertF64 |
504 #define WASM_F32_REINTERPRET_I32(x) kExprF32ReinterpretI32, x | 508 #define WASM_F32_REINTERPRET_I32(x) x, kExprF32ReinterpretI32 |
505 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x | 509 #define WASM_F64_SCONVERT_I32(x) x, kExprF64SConvertI32 |
506 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x | 510 #define WASM_F64_UCONVERT_I32(x) x, kExprF64UConvertI32 |
507 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x | 511 #define WASM_F64_SCONVERT_I64(x) x, kExprF64SConvertI64 |
508 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x | 512 #define WASM_F64_UCONVERT_I64(x) x, kExprF64UConvertI64 |
509 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x | 513 #define WASM_F64_CONVERT_F32(x) x, kExprF64ConvertF32 |
510 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x | 514 #define WASM_F64_REINTERPRET_I64(x) x, kExprF64ReinterpretI64 |
511 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x | 515 #define WASM_I32_REINTERPRET_F32(x) x, kExprI32ReinterpretF32 |
512 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x | 516 #define WASM_I64_REINTERPRET_F64(x) x, kExprI64ReinterpretF64 |
513 | 517 |
514 #endif // V8_WASM_MACRO_GEN_H_ | 518 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |