Re: [PATCH RFC 54/67] MIPS: kernel: branch: Add new MIPS R6 B{L,G}TZ{AL,}C emulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/18/2014 6:10 PM, Markos Chandras wrote:

MIPS R6 added the following four instructions which share the
BGTZ and BGTZL opcode:

BLTZALC: Compact branch-and-link if GPR rt is < to zero
BGEZALC: Compact branch-and-link if GPR rt is > to zero

   Not BGTZALC?

BGTZL: Compact branch if GPR rt is < to zero

   Not BLTZC?

BGEZL: Compact branch if GPR rt is > to zero

   Not BGTZC?

Signed-off-by: Markos Chandras <markos.chandras@xxxxxxxxxx>
---
  arch/mips/kernel/branch.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 7bc2df026b51..ca102557fa3c 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -648,6 +648,19 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
  			ret = -SIGILL;
  			break;
  		}
+		/* bgtzalc, bltzalc, bgtzc, bltzc */
+		if (cpu_has_mips_r6) {
+			if (insn.i_format.rt) {
+				if (insn.i_format.opcode == blez_op)
+					if (insn.i_format.rs ==
+					    insn.i_format.rt ||
+					    !insn.i_format.rs)
+						regs->regs[31] = epc + 4;
+				regs->cp0_epc += 8;
+				break;

  Why not collapse the *if* statements here as well?

+			}
+		}
+
[...]

WBR, Sergei






[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux