From: Sandipan Das <sandipan@linux.ibm.com>
To: mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org, paulus@samba.org, anton@samba.org,
naveen.n.rao@linux.vnet.ibm.com, ravi.bangoria@linux.ibm.com
Subject: [PATCH 3/6] powerpc sstep: Add cnttzw, cnttzd instruction emulation
Date: Mon, 3 Sep 2018 20:49:35 +0530 [thread overview]
Message-ID: <f989c31bcf4bd8a80a50fa6899bcd239ed1bec69.1535609090.git.sandipan@linux.ibm.com> (raw)
In-Reply-To: <cover.1535609090.git.sandipan@linux.ibm.com>
In-Reply-To: <cover.1535609090.git.sandipan@linux.ibm.com>
This adds emulation support for the following integer instructions:
* Count Trailing Zeros Word (cnttzw[.])
* Count Trailing Zeros Doubleword (cnttzd[.])
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
arch/powerpc/lib/sstep.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 18ac0a26c4fc..d57cb4e28621 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1816,6 +1816,20 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
case 506: /* popcntd */
do_popcnt(regs, op, regs->gpr[rd], 64);
goto logical_done_nocc;
+#endif
+ case 538: /* cnttzw */
+ if (!cpu_has_feature(CPU_FTR_ARCH_300))
+ return -1;
+ val = (unsigned int) regs->gpr[rd];
+ op->val = ( val ? __builtin_ctz(val) : 32 );
+ goto logical_done;
+#ifdef __powerpc64__
+ case 570: /* cnttzd */
+ if (!cpu_has_feature(CPU_FTR_ARCH_300))
+ return -1;
+ val = regs->gpr[rd];
+ op->val = ( val ? __builtin_ctzl(val) : 64 );
+ goto logical_done;
#endif
case 922: /* extsh */
op->val = (signed short) regs->gpr[rd];
--
2.14.4
next prev parent reply other threads:[~2018-09-03 15:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-03 15:19 [PATCH 0/6] powerpc sstep: Extend instruction emulation support Sandipan Das
2018-09-03 15:19 ` [PATCH 1/6] powerpc sstep: Add maddhd, maddhdu, maddld instruction emulation Sandipan Das
2018-09-04 22:12 ` Segher Boessenkool
2018-09-05 11:30 ` Sandipan Das
2019-02-20 0:51 ` Michael Ellerman
2018-09-03 15:19 ` [PATCH 2/6] powerpc sstep: Add darn " Sandipan Das
2019-02-20 0:50 ` Michael Ellerman
2019-02-20 9:49 ` Sandipan Das
2018-09-03 15:19 ` Sandipan Das [this message]
2018-09-04 21:12 ` [PATCH 3/6] powerpc sstep: Add cnttzw, cnttzd " Segher Boessenkool
2018-09-05 6:36 ` Paul Mackerras
2018-09-03 15:19 ` [PATCH 4/6] powerpc sstep: Add extswsli " Sandipan Das
2018-09-03 15:19 ` [PATCH 5/6] powerpc sstep: Add modsw, moduw " Sandipan Das
2018-09-03 15:19 ` [PATCH 6/6] powerpc sstep: Add modsd, modud " Sandipan Das
2018-09-04 21:21 ` Segher Boessenkool
2018-09-05 11:53 ` Sandipan Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f989c31bcf4bd8a80a50fa6899bcd239ed1bec69.1535609090.git.sandipan@linux.ibm.com \
--to=sandipan@linux.ibm.com \
--cc=anton@samba.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=ravi.bangoria@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).