From: Sathvika Vasireddy <sathvika@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: naveen.n.rao@linux.ibm.com,
Sathvika Vasireddy <sathvika@linux.vnet.ibm.com>
Subject: [PATCH 2/2] powerpc/sstep: Add tests for setb instruction
Date: Fri, 16 Apr 2021 02:02:49 -0500 [thread overview]
Message-ID: <ab1756406a5c39c32b809a0699a22c10425030ae.1618469454.git.sathvika@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1618469454.git.sathvika@linux.vnet.ibm.com>
In-Reply-To: <cover.1618469454.git.sathvika@linux.vnet.ibm.com>
This adds selftests for setb instruction.
Signed-off-by: Sathvika Vasireddy <sathvika@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/ppc-opcode.h | 1 +
arch/powerpc/lib/test_emulate_step.c | 28 +++++++++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index ed161ef2b3ca..32bf53260737 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -245,6 +245,7 @@
#define PPC_INST_STRING 0x7c00042a
#define PPC_INST_STRING_MASK 0xfc0007fe
#define PPC_INST_STRING_GEN_MASK 0xfc00067e
+#define PPC_INST_SETB 0x7c000100
#define PPC_INST_STSWI 0x7c0005aa
#define PPC_INST_STSWX 0x7c00052a
#define PPC_INST_TRECHKPT 0x7c0007dd
diff --git a/arch/powerpc/lib/test_emulate_step.c b/arch/powerpc/lib/test_emulate_step.c
index 783d1b85ecfe..c338e35b627c 100644
--- a/arch/powerpc/lib/test_emulate_step.c
+++ b/arch/powerpc/lib/test_emulate_step.c
@@ -53,6 +53,8 @@
ppc_inst_prefix(PPC_PREFIX_MLS | __PPC_PRFX_R(pr) | IMM_H(i), \
PPC_RAW_ADDI(t, a, i))
+#define TEST_SETB(t, bfa) ppc_inst(PPC_INST_SETB | ___PPC_RT(t) | ___PPC_RA((bfa & 0x7) << 2))
+
static void __init init_pt_regs(struct pt_regs *regs)
{
@@ -929,6 +931,67 @@ static struct compute_test compute_tests[] = {
}
}
},
+ {
+ .mnemonic = "setb",
+ .subtests = {
+ {
+ .descr = "BFA = 1, CR = GT",
+ .instr = TEST_SETB(20, 1),
+ .regs = {
+ .ccr = 0x4000000,
+ }
+ },
+ {
+ .descr = "BFA = 4, CR = LT",
+ .instr = TEST_SETB(20, 4),
+ .regs = {
+ .ccr = 0x8000,
+ }
+ },
+ {
+ .descr = "BFA = 5, CR = EQ",
+ .instr = TEST_SETB(20, 5),
+ .regs = {
+ .ccr = 0x200,
+ }
+ }
+ }
+ },
{
.mnemonic = "add",
.subtests = {
--
2.16.4
next prev parent reply other threads:[~2021-04-16 6:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 7:02 [PATCH 0/2] powerpc/sstep: Add emulation support and tests for 'setb' instruction Sathvika Vasireddy
2021-04-16 7:02 ` [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction Sathvika Vasireddy
2021-04-16 7:44 ` Daniel Axtens
2021-04-20 6:26 ` Naveen N. Rao
2021-04-21 7:30 ` Michael Ellerman
2021-04-22 10:01 ` Naveen N. Rao
2021-04-23 13:29 ` Michael Ellerman
2021-04-27 16:44 ` Naveen N. Rao
2021-04-22 19:13 ` Segher Boessenkool
2021-04-22 22:16 ` Gabriel Paubert
2021-04-22 23:26 ` Segher Boessenkool
2021-04-23 10:26 ` Gabriel Paubert
2021-04-23 16:57 ` Segher Boessenkool
2021-04-24 16:13 ` Daniel Axtens
2021-04-16 7:02 ` Sathvika Vasireddy [this message]
2021-04-20 17:37 ` [PATCH 2/2] powerpc/sstep: Add tests for setb instruction Naveen N. Rao
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=ab1756406a5c39c32b809a0699a22c10425030ae.1618469454.git.sathvika@linux.vnet.ibm.com \
--to=sathvika@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=naveen.n.rao@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).