OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
7 #include "src/globals.h" | 7 #include "src/globals.h" |
8 // UNIMPLEMENTED_ macro for MIPS. | 8 // UNIMPLEMENTED_ macro for MIPS. |
9 #ifdef DEBUG | 9 #ifdef DEBUG |
10 #define UNIMPLEMENTED_MIPS() \ | 10 #define UNIMPLEMENTED_MIPS() \ |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 SWC1 = ((7 << 3) + 1) << kOpcodeShift, | 363 SWC1 = ((7 << 3) + 1) << kOpcodeShift, |
364 SDC1 = ((7 << 3) + 5) << kOpcodeShift, | 364 SDC1 = ((7 << 3) + 5) << kOpcodeShift, |
365 BNEZC = ((7 << 3) + 6) << kOpcodeShift, | 365 BNEZC = ((7 << 3) + 6) << kOpcodeShift, |
366 | 366 |
367 COP1X = ((1 << 4) + 3) << kOpcodeShift | 367 COP1X = ((1 << 4) + 3) << kOpcodeShift |
368 }; | 368 }; |
369 | 369 |
370 enum SecondaryField { | 370 enum SecondaryField { |
371 // SPECIAL Encoding of Function Field. | 371 // SPECIAL Encoding of Function Field. |
372 SLL = ((0 << 3) + 0), | 372 SLL = ((0 << 3) + 0), |
373 MOVCI = ((0 << 3) + 1), | 373 MOVCI = ((0 << 3) + 1), |
374 SRL = ((0 << 3) + 2), | 374 SRL = ((0 << 3) + 2), |
375 SRA = ((0 << 3) + 3), | 375 SRA = ((0 << 3) + 3), |
376 SLLV = ((0 << 3) + 4), | 376 SLLV = ((0 << 3) + 4), |
377 SRLV = ((0 << 3) + 6), | 377 SRLV = ((0 << 3) + 6), |
378 SRAV = ((0 << 3) + 7), | 378 SRAV = ((0 << 3) + 7), |
379 | 379 |
380 JR = ((1 << 3) + 0), | 380 JR = ((1 << 3) + 0), |
381 JALR = ((1 << 3) + 1), | 381 JALR = ((1 << 3) + 1), |
382 MOVZ = ((1 << 3) + 2), | 382 MOVZ = ((1 << 3) + 2), |
383 MOVN = ((1 << 3) + 3), | 383 MOVN = ((1 << 3) + 3), |
384 BREAK = ((1 << 3) + 5), | 384 BREAK = ((1 << 3) + 5), |
385 | 385 |
386 MFHI = ((2 << 3) + 0), | 386 MFHI = ((2 << 3) + 0), |
387 CLZ_R6 = ((2 << 3) + 0), | 387 CLZ_R6 = ((2 << 3) + 0), |
388 CLO_R6 = ((2 << 3) + 1), | 388 CLO_R6 = ((2 << 3) + 1), |
389 MFLO = ((2 << 3) + 2), | 389 MFLO = ((2 << 3) + 2), |
390 | 390 |
391 MULT = ((3 << 3) + 0), | 391 MULT = ((3 << 3) + 0), |
392 MULTU = ((3 << 3) + 1), | 392 MULTU = ((3 << 3) + 1), |
393 DIV = ((3 << 3) + 2), | 393 DIV = ((3 << 3) + 2), |
394 DIVU = ((3 << 3) + 3), | 394 DIVU = ((3 << 3) + 3), |
395 | 395 |
396 ADD = ((4 << 3) + 0), | 396 ADD = ((4 << 3) + 0), |
397 ADDU = ((4 << 3) + 1), | 397 ADDU = ((4 << 3) + 1), |
398 SUB = ((4 << 3) + 2), | 398 SUB = ((4 << 3) + 2), |
399 SUBU = ((4 << 3) + 3), | 399 SUBU = ((4 << 3) + 3), |
400 AND = ((4 << 3) + 4), | 400 AND = ((4 << 3) + 4), |
401 OR = ((4 << 3) + 5), | 401 OR = ((4 << 3) + 5), |
402 XOR = ((4 << 3) + 6), | 402 XOR = ((4 << 3) + 6), |
403 NOR = ((4 << 3) + 7), | 403 NOR = ((4 << 3) + 7), |
404 | 404 |
405 SLT = ((5 << 3) + 2), | 405 SLT = ((5 << 3) + 2), |
406 SLTU = ((5 << 3) + 3), | 406 SLTU = ((5 << 3) + 3), |
407 | 407 |
408 TGE = ((6 << 3) + 0), | 408 TGE = ((6 << 3) + 0), |
409 TGEU = ((6 << 3) + 1), | 409 TGEU = ((6 << 3) + 1), |
410 TLT = ((6 << 3) + 2), | 410 TLT = ((6 << 3) + 2), |
411 TLTU = ((6 << 3) + 3), | 411 TLTU = ((6 << 3) + 3), |
412 TEQ = ((6 << 3) + 4), | 412 TEQ = ((6 << 3) + 4), |
413 SELEQZ_S = ((6 << 3) + 5), | 413 SELEQZ_S = ((6 << 3) + 5), |
414 TNE = ((6 << 3) + 6), | 414 TNE = ((6 << 3) + 6), |
415 SELNEZ_S = ((6 << 3) + 7), | 415 SELNEZ_S = ((6 << 3) + 7), |
416 | 416 |
417 // Multiply integers in r6. | 417 // Multiply integers in r6. |
418 MUL_MUH = ((3 << 3) + 0), // MUL, MUH. | 418 MUL_MUH = ((3 << 3) + 0), // MUL, MUH. |
419 MUL_MUH_U = ((3 << 3) + 1), // MUL_U, MUH_U. | 419 MUL_MUH_U = ((3 << 3) + 1), // MUL_U, MUH_U. |
| 420 RINT = ((3 << 3) + 2), |
420 | 421 |
421 MUL_OP = ((0 << 3) + 2), | 422 MUL_OP = ((0 << 3) + 2), |
422 MUH_OP = ((0 << 3) + 3), | 423 MUH_OP = ((0 << 3) + 3), |
423 DIV_OP = ((0 << 3) + 2), | 424 DIV_OP = ((0 << 3) + 2), |
424 MOD_OP = ((0 << 3) + 3), | 425 MOD_OP = ((0 << 3) + 3), |
425 | 426 |
426 DIV_MOD = ((3 << 3) + 2), | 427 DIV_MOD = ((3 << 3) + 2), |
427 DIV_MOD_U = ((3 << 3) + 3), | 428 DIV_MOD_U = ((3 << 3) + 3), |
428 | 429 |
429 // SPECIAL2 Encoding of Function Field. | 430 // SPECIAL2 Encoding of Function Field. |
430 MUL = ((0 << 3) + 2), | 431 MUL = ((0 << 3) + 2), |
431 CLZ = ((4 << 3) + 0), | 432 CLZ = ((4 << 3) + 0), |
432 CLO = ((4 << 3) + 1), | 433 CLO = ((4 << 3) + 1), |
433 | 434 |
434 // SPECIAL3 Encoding of Function Field. | 435 // SPECIAL3 Encoding of Function Field. |
435 EXT = ((0 << 3) + 0), | 436 EXT = ((0 << 3) + 0), |
436 INS = ((0 << 3) + 4), | 437 INS = ((0 << 3) + 4), |
437 | 438 |
438 // REGIMM encoding of rt Field. | 439 // REGIMM encoding of rt Field. |
439 BLTZ = ((0 << 3) + 0) << 16, | 440 BLTZ = ((0 << 3) + 0) << 16, |
440 BGEZ = ((0 << 3) + 1) << 16, | 441 BGEZ = ((0 << 3) + 1) << 16, |
441 BLTZAL = ((2 << 3) + 0) << 16, | 442 BLTZAL = ((2 << 3) + 0) << 16, |
442 BGEZAL = ((2 << 3) + 1) << 16, | 443 BGEZAL = ((2 << 3) + 1) << 16, |
443 BGEZALL = ((2 << 3) + 3) << 16, | 444 BGEZALL = ((2 << 3) + 3) << 16, |
444 | 445 |
445 // COP1 Encoding of rs Field. | 446 // COP1 Encoding of rs Field. |
446 MFC1 = ((0 << 3) + 0) << 21, | 447 MFC1 = ((0 << 3) + 0) << 21, |
447 CFC1 = ((0 << 3) + 2) << 21, | 448 CFC1 = ((0 << 3) + 2) << 21, |
448 MFHC1 = ((0 << 3) + 3) << 21, | 449 MFHC1 = ((0 << 3) + 3) << 21, |
449 MTC1 = ((0 << 3) + 4) << 21, | 450 MTC1 = ((0 << 3) + 4) << 21, |
450 CTC1 = ((0 << 3) + 6) << 21, | 451 CTC1 = ((0 << 3) + 6) << 21, |
451 MTHC1 = ((0 << 3) + 7) << 21, | 452 MTHC1 = ((0 << 3) + 7) << 21, |
452 BC1 = ((1 << 3) + 0) << 21, | 453 BC1 = ((1 << 3) + 0) << 21, |
453 S = ((2 << 3) + 0) << 21, | 454 S = ((2 << 3) + 0) << 21, |
454 D = ((2 << 3) + 1) << 21, | 455 D = ((2 << 3) + 1) << 21, |
455 W = ((2 << 3) + 4) << 21, | 456 W = ((2 << 3) + 4) << 21, |
456 L = ((2 << 3) + 5) << 21, | 457 L = ((2 << 3) + 5) << 21, |
457 PS = ((2 << 3) + 6) << 21, | 458 PS = ((2 << 3) + 6) << 21, |
458 // COP1 Encoding of Function Field When rs=S. | 459 // COP1 Encoding of Function Field When rs=S. |
459 ROUND_L_S = ((1 << 3) + 0), | 460 ROUND_L_S = ((1 << 3) + 0), |
460 TRUNC_L_S = ((1 << 3) + 1), | 461 TRUNC_L_S = ((1 << 3) + 1), |
461 CEIL_L_S = ((1 << 3) + 2), | 462 CEIL_L_S = ((1 << 3) + 2), |
462 FLOOR_L_S = ((1 << 3) + 3), | 463 FLOOR_L_S = ((1 << 3) + 3), |
463 ROUND_W_S = ((1 << 3) + 4), | 464 ROUND_W_S = ((1 << 3) + 4), |
464 TRUNC_W_S = ((1 << 3) + 5), | 465 TRUNC_W_S = ((1 << 3) + 5), |
465 CEIL_W_S = ((1 << 3) + 6), | 466 CEIL_W_S = ((1 << 3) + 6), |
466 FLOOR_W_S = ((1 << 3) + 7), | 467 FLOOR_W_S = ((1 << 3) + 7), |
467 CVT_D_S = ((4 << 3) + 1), | 468 CVT_D_S = ((4 << 3) + 1), |
468 CVT_W_S = ((4 << 3) + 4), | 469 CVT_W_S = ((4 << 3) + 4), |
469 CVT_L_S = ((4 << 3) + 5), | 470 CVT_L_S = ((4 << 3) + 5), |
470 CVT_PS_S = ((4 << 3) + 6), | 471 CVT_PS_S = ((4 << 3) + 6), |
471 // COP1 Encoding of Function Field When rs=D. | 472 // COP1 Encoding of Function Field When rs=D. |
472 ADD_D = ((0 << 3) + 0), | 473 ADD_D = ((0 << 3) + 0), |
473 SUB_D = ((0 << 3) + 1), | 474 SUB_D = ((0 << 3) + 1), |
474 MUL_D = ((0 << 3) + 2), | 475 MUL_D = ((0 << 3) + 2), |
475 DIV_D = ((0 << 3) + 3), | 476 DIV_D = ((0 << 3) + 3), |
476 SQRT_D = ((0 << 3) + 4), | 477 SQRT_D = ((0 << 3) + 4), |
477 ABS_D = ((0 << 3) + 5), | 478 ABS_D = ((0 << 3) + 5), |
478 MOV_D = ((0 << 3) + 6), | 479 MOV_D = ((0 << 3) + 6), |
479 NEG_D = ((0 << 3) + 7), | 480 NEG_D = ((0 << 3) + 7), |
480 ROUND_L_D = ((1 << 3) + 0), | 481 ROUND_L_D = ((1 << 3) + 0), |
481 TRUNC_L_D = ((1 << 3) + 1), | 482 TRUNC_L_D = ((1 << 3) + 1), |
482 CEIL_L_D = ((1 << 3) + 2), | 483 CEIL_L_D = ((1 << 3) + 2), |
483 FLOOR_L_D = ((1 << 3) + 3), | 484 FLOOR_L_D = ((1 << 3) + 3), |
484 ROUND_W_D = ((1 << 3) + 4), | 485 ROUND_W_D = ((1 << 3) + 4), |
485 TRUNC_W_D = ((1 << 3) + 5), | 486 TRUNC_W_D = ((1 << 3) + 5), |
486 CEIL_W_D = ((1 << 3) + 6), | 487 CEIL_W_D = ((1 << 3) + 6), |
487 FLOOR_W_D = ((1 << 3) + 7), | 488 FLOOR_W_D = ((1 << 3) + 7), |
488 MIN = ((3 << 3) + 4), | 489 MIN = ((3 << 3) + 4), |
489 MINA = ((3 << 3) + 5), | 490 MINA = ((3 << 3) + 5), |
490 MAX = ((3 << 3) + 6), | 491 MAX = ((3 << 3) + 6), |
491 MAXA = ((3 << 3) + 7), | 492 MAXA = ((3 << 3) + 7), |
492 CVT_S_D = ((4 << 3) + 0), | 493 CVT_S_D = ((4 << 3) + 0), |
493 CVT_W_D = ((4 << 3) + 4), | 494 CVT_W_D = ((4 << 3) + 4), |
494 CVT_L_D = ((4 << 3) + 5), | 495 CVT_L_D = ((4 << 3) + 5), |
495 C_F_D = ((6 << 3) + 0), | 496 C_F_D = ((6 << 3) + 0), |
496 C_UN_D = ((6 << 3) + 1), | 497 C_UN_D = ((6 << 3) + 1), |
497 C_EQ_D = ((6 << 3) + 2), | 498 C_EQ_D = ((6 << 3) + 2), |
498 C_UEQ_D = ((6 << 3) + 3), | 499 C_UEQ_D = ((6 << 3) + 3), |
499 C_OLT_D = ((6 << 3) + 4), | 500 C_OLT_D = ((6 << 3) + 4), |
500 C_ULT_D = ((6 << 3) + 5), | 501 C_ULT_D = ((6 << 3) + 5), |
501 C_OLE_D = ((6 << 3) + 6), | 502 C_OLE_D = ((6 << 3) + 6), |
502 C_ULE_D = ((6 << 3) + 7), | 503 C_ULE_D = ((6 << 3) + 7), |
503 // COP1 Encoding of Function Field When rs=W or L. | 504 // COP1 Encoding of Function Field When rs=W or L. |
504 CVT_S_W = ((4 << 3) + 0), | 505 CVT_S_W = ((4 << 3) + 0), |
505 CVT_D_W = ((4 << 3) + 1), | 506 CVT_D_W = ((4 << 3) + 1), |
506 CVT_S_L = ((4 << 3) + 0), | 507 CVT_S_L = ((4 << 3) + 0), |
507 CVT_D_L = ((4 << 3) + 1), | 508 CVT_D_L = ((4 << 3) + 1), |
508 BC1EQZ = ((2 << 2) + 1) << 21, | 509 BC1EQZ = ((2 << 2) + 1) << 21, |
509 BC1NEZ = ((3 << 2) + 1) << 21, | 510 BC1NEZ = ((3 << 2) + 1) << 21, |
510 // COP1 CMP positive predicates Bit 5..4 = 00. | 511 // COP1 CMP positive predicates Bit 5..4 = 00. |
511 CMP_AF = ((0 << 3) + 0), | 512 CMP_AF = ((0 << 3) + 0), |
512 CMP_UN = ((0 << 3) + 1), | 513 CMP_UN = ((0 << 3) + 1), |
513 CMP_EQ = ((0 << 3) + 2), | 514 CMP_EQ = ((0 << 3) + 2), |
514 CMP_UEQ = ((0 << 3) + 3), | 515 CMP_UEQ = ((0 << 3) + 3), |
515 CMP_LT = ((0 << 3) + 4), | 516 CMP_LT = ((0 << 3) + 4), |
516 CMP_ULT = ((0 << 3) + 5), | 517 CMP_ULT = ((0 << 3) + 5), |
517 CMP_LE = ((0 << 3) + 6), | 518 CMP_LE = ((0 << 3) + 6), |
518 CMP_ULE = ((0 << 3) + 7), | 519 CMP_ULE = ((0 << 3) + 7), |
519 CMP_SAF = ((1 << 3) + 0), | 520 CMP_SAF = ((1 << 3) + 0), |
520 CMP_SUN = ((1 << 3) + 1), | 521 CMP_SUN = ((1 << 3) + 1), |
521 CMP_SEQ = ((1 << 3) + 2), | 522 CMP_SEQ = ((1 << 3) + 2), |
522 CMP_SUEQ = ((1 << 3) + 3), | 523 CMP_SUEQ = ((1 << 3) + 3), |
523 CMP_SSLT = ((1 << 3) + 4), | 524 CMP_SSLT = ((1 << 3) + 4), |
524 CMP_SSULT = ((1 << 3) + 5), | 525 CMP_SSULT = ((1 << 3) + 5), |
525 CMP_SLE = ((1 << 3) + 6), | 526 CMP_SLE = ((1 << 3) + 6), |
526 CMP_SULE = ((1 << 3) + 7), | 527 CMP_SULE = ((1 << 3) + 7), |
527 // COP1 CMP negative predicates Bit 5..4 = 01. | 528 // COP1 CMP negative predicates Bit 5..4 = 01. |
528 CMP_AT = ((2 << 3) + 0), // Reserved, not implemented. | 529 CMP_AT = ((2 << 3) + 0), // Reserved, not implemented. |
529 CMP_OR = ((2 << 3) + 1), | 530 CMP_OR = ((2 << 3) + 1), |
530 CMP_UNE = ((2 << 3) + 2), | 531 CMP_UNE = ((2 << 3) + 2), |
531 CMP_NE = ((2 << 3) + 3), | 532 CMP_NE = ((2 << 3) + 3), |
532 CMP_UGE = ((2 << 3) + 4), // Reserved, not implemented. | 533 CMP_UGE = ((2 << 3) + 4), // Reserved, not implemented. |
533 CMP_OGE = ((2 << 3) + 5), // Reserved, not implemented. | 534 CMP_OGE = ((2 << 3) + 5), // Reserved, not implemented. |
534 CMP_UGT = ((2 << 3) + 6), // Reserved, not implemented. | 535 CMP_UGT = ((2 << 3) + 6), // Reserved, not implemented. |
535 CMP_OGT = ((2 << 3) + 7), // Reserved, not implemented. | 536 CMP_OGT = ((2 << 3) + 7), // Reserved, not implemented. |
536 CMP_SAT = ((3 << 3) + 0), // Reserved, not implemented. | 537 CMP_SAT = ((3 << 3) + 0), // Reserved, not implemented. |
537 CMP_SOR = ((3 << 3) + 1), | 538 CMP_SOR = ((3 << 3) + 1), |
538 CMP_SUNE = ((3 << 3) + 2), | 539 CMP_SUNE = ((3 << 3) + 2), |
539 CMP_SNE = ((3 << 3) + 3), | 540 CMP_SNE = ((3 << 3) + 3), |
540 CMP_SUGE = ((3 << 3) + 4), // Reserved, not implemented. | 541 CMP_SUGE = ((3 << 3) + 4), // Reserved, not implemented. |
541 CMP_SOGE = ((3 << 3) + 5), // Reserved, not implemented. | 542 CMP_SOGE = ((3 << 3) + 5), // Reserved, not implemented. |
542 CMP_SUGT = ((3 << 3) + 6), // Reserved, not implemented. | 543 CMP_SUGT = ((3 << 3) + 6), // Reserved, not implemented. |
543 CMP_SOGT = ((3 << 3) + 7), // Reserved, not implemented. | 544 CMP_SOGT = ((3 << 3) + 7), // Reserved, not implemented. |
544 | 545 |
545 SEL = ((2 << 3) + 0), | 546 SEL = ((2 << 3) + 0), |
546 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. | 547 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. |
547 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. | 548 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. |
548 // COP1 Encoding of Function Field When rs=PS. | 549 // COP1 Encoding of Function Field When rs=PS. |
549 // COP1X Encoding of Function Field. | 550 // COP1X Encoding of Function Field. |
550 MADD_D = ((4 << 3) + 1), | 551 MADD_D = ((4 << 3) + 1), |
551 | 552 |
552 NULLSF = 0 | 553 NULLSF = 0 |
553 }; | 554 }; |
554 | 555 |
555 | 556 |
556 // ----- Emulated conditions. | 557 // ----- Emulated conditions. |
557 // On MIPS we use this enum to abstract from conditionnal branch instructions. | 558 // On MIPS we use this enum to abstract from conditionnal branch instructions. |
558 // The 'U' prefix is used to specify unsigned comparisons. | 559 // The 'U' prefix is used to specify unsigned comparisons. |
559 // Oppposite conditions must be paired as odd/even numbers | 560 // Oppposite conditions must be paired as odd/even numbers |
560 // because 'NegateCondition' function flips LSB to negate condition. | 561 // because 'NegateCondition' function flips LSB to negate condition. |
561 enum Condition { | 562 enum Condition { |
562 // Any value < 0 is considered no_condition. | 563 // Any value < 0 is considered no_condition. |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 // JS argument slots size. | 929 // JS argument slots size. |
929 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; | 930 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; |
930 // Assembly builtins argument slots size. | 931 // Assembly builtins argument slots size. |
931 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; | 932 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; |
932 | 933 |
933 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 934 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
934 | 935 |
935 } } // namespace v8::internal | 936 } } // namespace v8::internal |
936 | 937 |
937 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 938 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
OLD | NEW |