regs->gpr[ra] = perm;
}
#endif /* CONFIG_PPC64 */
+/*
+ * The size parameter adjusts the equivalent prty instruction.
+ * prtyw = 32, prtyd = 64
+ */
+static nokprobe_inline void do_prty(struct pt_regs *regs, unsigned long v,
+ int size, int ra)
+{
+ unsigned long long res = v ^ (v >> 8);
+
+ res ^= res >> 16;
+ if (size == 32) { /* prtyw */
+ regs->gpr[ra] = res & 0x0000000100000001;
+ return;
+ }
+
+ res ^= res >> 32;
+ regs->gpr[ra] = res & 1; /*prtyd */
+}
static nokprobe_inline int trap_compare(long v1, long v2)
{
case 124: /* nor */
regs->gpr[ra] = ~(regs->gpr[rd] | regs->gpr[rb]);
goto logical_done;
+
+ case 154: /* prtyw */
+ do_prty(regs, regs->gpr[rd], 32, ra);
+ goto logical_done;
+
+ case 186: /* prtyd */
+ do_prty(regs, regs->gpr[rd], 64, ra);
+ goto logical_done;
#ifdef CONFIG_PPC64
case 252: /* bpermd */
do_bpermd(regs, regs->gpr[rd], regs->gpr[rb], ra);