branch.c (5f9f41c474befb4ebbc40b27f65bb7d649241581) | branch.c (319824eabc3f1c1aab67f408d66f384fbb996ee2) |
---|---|
1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1996, 97, 2000, 2001 by Ralf Baechle 7 * Copyright (C) 2001 MIPS Technologies, Inc. 8 */ --- 417 unchanged lines hidden (view full) --- 426 427 /* 428 * This group contains: 429 * bltz_op, bgez_op, bltzl_op, bgezl_op, 430 * bltzal_op, bgezal_op, bltzall_op, bgezall_op. 431 */ 432 case bcond_op: 433 switch (insn.i_format.rt) { | 1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1996, 97, 2000, 2001 by Ralf Baechle 7 * Copyright (C) 2001 MIPS Technologies, Inc. 8 */ --- 417 unchanged lines hidden (view full) --- 426 427 /* 428 * This group contains: 429 * bltz_op, bgez_op, bltzl_op, bgezl_op, 430 * bltzal_op, bgezal_op, bltzall_op, bgezall_op. 431 */ 432 case bcond_op: 433 switch (insn.i_format.rt) { |
434 case bltz_op: | |
435 case bltzl_op: | 434 case bltzl_op: |
435 if (NO_R6EMU) 436 goto sigill_r6; 437 case bltz_op: |
|
436 if ((long)regs->regs[insn.i_format.rs] < 0) { 437 epc = epc + 4 + (insn.i_format.simmediate << 2); 438 if (insn.i_format.rt == bltzl_op) 439 ret = BRANCH_LIKELY_TAKEN; 440 } else 441 epc += 8; 442 regs->cp0_epc = epc; 443 break; 444 | 438 if ((long)regs->regs[insn.i_format.rs] < 0) { 439 epc = epc + 4 + (insn.i_format.simmediate << 2); 440 if (insn.i_format.rt == bltzl_op) 441 ret = BRANCH_LIKELY_TAKEN; 442 } else 443 epc += 8; 444 regs->cp0_epc = epc; 445 break; 446 |
445 case bgez_op: | |
446 case bgezl_op: | 447 case bgezl_op: |
448 if (NO_R6EMU) 449 goto sigill_r6; 450 case bgez_op: |
|
447 if ((long)regs->regs[insn.i_format.rs] >= 0) { 448 epc = epc + 4 + (insn.i_format.simmediate << 2); 449 if (insn.i_format.rt == bgezl_op) 450 ret = BRANCH_LIKELY_TAKEN; 451 } else 452 epc += 8; 453 regs->cp0_epc = epc; 454 break; 455 456 case bltzal_op: 457 case bltzall_op: | 451 if ((long)regs->regs[insn.i_format.rs] >= 0) { 452 epc = epc + 4 + (insn.i_format.simmediate << 2); 453 if (insn.i_format.rt == bgezl_op) 454 ret = BRANCH_LIKELY_TAKEN; 455 } else 456 epc += 8; 457 regs->cp0_epc = epc; 458 break; 459 460 case bltzal_op: 461 case bltzall_op: |
462 if (NO_R6EMU && (insn.i_format.rs || 463 insn.i_format.rt == bltzall_op)) { 464 ret = -SIGILL; 465 break; 466 } |
|
458 regs->regs[31] = epc + 8; | 467 regs->regs[31] = epc + 8; |
468 /* 469 * OK we are here either because we hit a NAL 470 * instruction or because we are emulating an 471 * old bltzal{,l} one. Lets figure out what the 472 * case really is. 473 */ 474 if (!insn.i_format.rs) { 475 /* 476 * NAL or BLTZAL with rs == 0 477 * Doesn't matter if we are R6 or not. The 478 * result is the same 479 */ 480 regs->cp0_epc += 4 + 481 (insn.i_format.simmediate << 2); 482 break; 483 } 484 /* Now do the real thing for non-R6 BLTZAL{,L} */ |
|
459 if ((long)regs->regs[insn.i_format.rs] < 0) { 460 epc = epc + 4 + (insn.i_format.simmediate << 2); 461 if (insn.i_format.rt == bltzall_op) 462 ret = BRANCH_LIKELY_TAKEN; 463 } else 464 epc += 8; 465 regs->cp0_epc = epc; 466 break; 467 468 case bgezal_op: 469 case bgezall_op: | 485 if ((long)regs->regs[insn.i_format.rs] < 0) { 486 epc = epc + 4 + (insn.i_format.simmediate << 2); 487 if (insn.i_format.rt == bltzall_op) 488 ret = BRANCH_LIKELY_TAKEN; 489 } else 490 epc += 8; 491 regs->cp0_epc = epc; 492 break; 493 494 case bgezal_op: 495 case bgezall_op: |
496 if (NO_R6EMU && (insn.i_format.rs || 497 insn.i_format.rt == bgezall_op)) { 498 ret = -SIGILL; 499 break; 500 } |
|
470 regs->regs[31] = epc + 8; | 501 regs->regs[31] = epc + 8; |
502 /* 503 * OK we are here either because we hit a BAL 504 * instruction or because we are emulating an 505 * old bgezal{,l} one. Lets figure out what the 506 * case really is. 507 */ 508 if (!insn.i_format.rs) { 509 /* 510 * BAL or BGEZAL with rs == 0 511 * Doesn't matter if we are R6 or not. The 512 * result is the same 513 */ 514 regs->cp0_epc += 4 + 515 (insn.i_format.simmediate << 2); 516 break; 517 } 518 /* Now do the real thing for non-R6 BGEZAL{,L} */ |
|
471 if ((long)regs->regs[insn.i_format.rs] >= 0) { 472 epc = epc + 4 + (insn.i_format.simmediate << 2); 473 if (insn.i_format.rt == bgezall_op) 474 ret = BRANCH_LIKELY_TAKEN; 475 } else 476 epc += 8; 477 regs->cp0_epc = epc; 478 break; --- 26 unchanged lines hidden (view full) --- 505 regs->cp0_epc = epc; 506 if (insn.i_format.opcode == jalx_op) 507 set_isa16_mode(regs->cp0_epc); 508 break; 509 510 /* 511 * These are conditional and in i_format. 512 */ | 519 if ((long)regs->regs[insn.i_format.rs] >= 0) { 520 epc = epc + 4 + (insn.i_format.simmediate << 2); 521 if (insn.i_format.rt == bgezall_op) 522 ret = BRANCH_LIKELY_TAKEN; 523 } else 524 epc += 8; 525 regs->cp0_epc = epc; 526 break; --- 26 unchanged lines hidden (view full) --- 553 regs->cp0_epc = epc; 554 if (insn.i_format.opcode == jalx_op) 555 set_isa16_mode(regs->cp0_epc); 556 break; 557 558 /* 559 * These are conditional and in i_format. 560 */ |
513 case beq_op: | |
514 case beql_op: | 561 case beql_op: |
562 if (NO_R6EMU) 563 goto sigill_r6; 564 case beq_op: |
|
515 if (regs->regs[insn.i_format.rs] == 516 regs->regs[insn.i_format.rt]) { 517 epc = epc + 4 + (insn.i_format.simmediate << 2); 518 if (insn.i_format.opcode == beql_op) 519 ret = BRANCH_LIKELY_TAKEN; 520 } else 521 epc += 8; 522 regs->cp0_epc = epc; 523 break; 524 | 565 if (regs->regs[insn.i_format.rs] == 566 regs->regs[insn.i_format.rt]) { 567 epc = epc + 4 + (insn.i_format.simmediate << 2); 568 if (insn.i_format.opcode == beql_op) 569 ret = BRANCH_LIKELY_TAKEN; 570 } else 571 epc += 8; 572 regs->cp0_epc = epc; 573 break; 574 |
525 case bne_op: | |
526 case bnel_op: | 575 case bnel_op: |
576 if (NO_R6EMU) 577 goto sigill_r6; 578 case bne_op: |
|
527 if (regs->regs[insn.i_format.rs] != 528 regs->regs[insn.i_format.rt]) { 529 epc = epc + 4 + (insn.i_format.simmediate << 2); 530 if (insn.i_format.opcode == bnel_op) 531 ret = BRANCH_LIKELY_TAKEN; 532 } else 533 epc += 8; 534 regs->cp0_epc = epc; 535 break; 536 | 579 if (regs->regs[insn.i_format.rs] != 580 regs->regs[insn.i_format.rt]) { 581 epc = epc + 4 + (insn.i_format.simmediate << 2); 582 if (insn.i_format.opcode == bnel_op) 583 ret = BRANCH_LIKELY_TAKEN; 584 } else 585 epc += 8; 586 regs->cp0_epc = epc; 587 break; 588 |
537 case blez_op: /* not really i_format */ 538 case blezl_op: | 589 case blezl_op: /* not really i_format */ 590 if (NO_R6EMU) 591 goto sigill_r6; 592 case blez_op: |
539 /* rt field assumed to be zero */ 540 if ((long)regs->regs[insn.i_format.rs] <= 0) { 541 epc = epc + 4 + (insn.i_format.simmediate << 2); 542 if (insn.i_format.opcode == blezl_op) 543 ret = BRANCH_LIKELY_TAKEN; 544 } else 545 epc += 8; 546 regs->cp0_epc = epc; 547 break; 548 | 593 /* rt field assumed to be zero */ 594 if ((long)regs->regs[insn.i_format.rs] <= 0) { 595 epc = epc + 4 + (insn.i_format.simmediate << 2); 596 if (insn.i_format.opcode == blezl_op) 597 ret = BRANCH_LIKELY_TAKEN; 598 } else 599 epc += 8; 600 regs->cp0_epc = epc; 601 break; 602 |
549 case bgtz_op: | |
550 case bgtzl_op: | 603 case bgtzl_op: |
604 if (NO_R6EMU) 605 goto sigill_r6; 606 case bgtz_op: |
|
551 /* rt field assumed to be zero */ 552 if ((long)regs->regs[insn.i_format.rs] > 0) { 553 epc = epc + 4 + (insn.i_format.simmediate << 2); 554 if (insn.i_format.opcode == bgtzl_op) 555 ret = BRANCH_LIKELY_TAKEN; 556 } else 557 epc += 8; 558 regs->cp0_epc = epc; --- 115 unchanged lines hidden --- | 607 /* rt field assumed to be zero */ 608 if ((long)regs->regs[insn.i_format.rs] > 0) { 609 epc = epc + 4 + (insn.i_format.simmediate << 2); 610 if (insn.i_format.opcode == bgtzl_op) 611 ret = BRANCH_LIKELY_TAKEN; 612 } else 613 epc += 8; 614 regs->cp0_epc = epc; --- 115 unchanged lines hidden --- |