Skip to content

Commit

Permalink
powerpc/lib/sstep: Add isel instruction emulation
Browse files Browse the repository at this point in the history
This adds emulation for the isel instruction.
Tested for correctness against the isel instruction and its extended
mnemonics (lt, gt, eq) on ppc64le.

Signed-off-by: Matt Brown <matthew.brown.dev@gmail.com>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Matt Brown authored and Michael Ellerman committed Aug 10, 2017
1 parent 2c979c4 commit e27f71e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/powerpc/lib/sstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,14 @@ int analyse_instr(struct instruction_op *op, struct pt_regs *regs,
/*
* Logical instructions
*/
case 15: /* isel */
mb = (instr >> 6) & 0x1f; /* bc */
val = (regs->ccr >> (31 - mb)) & 1;
val2 = (ra) ? regs->gpr[ra] : 0;

regs->gpr[rd] = (val) ? val2 : regs->gpr[rb];
goto logical_done;

case 26: /* cntlzw */
asm("cntlzw %0,%1" : "=r" (regs->gpr[ra]) :
"r" (regs->gpr[rd]));
Expand Down

0 comments on commit e27f71e

Please sign in to comment.