Commit de40303b authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/ppc-opcode: Define and use PPC_RAW_SETB()

We have PPC_INST_SETB then build the 'setb' instruction in the
user.

Instead, define PPC_RAW_SETB() and use it.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b08a4f26919a8f8cdcf7544ab552d9c1c63418b5.1657205708.git.christophe.leroy@csgroup.eu
parent d00d762d
...@@ -290,7 +290,6 @@ ...@@ -290,7 +290,6 @@
#define PPC_INST_STRING 0x7c00042a #define PPC_INST_STRING 0x7c00042a
#define PPC_INST_STRING_MASK 0xfc0007fe #define PPC_INST_STRING_MASK 0xfc0007fe
#define PPC_INST_STRING_GEN_MASK 0xfc00067e #define PPC_INST_STRING_GEN_MASK 0xfc00067e
#define PPC_INST_SETB 0x7c000100
#define PPC_INST_STSWI 0x7c0005aa #define PPC_INST_STSWI 0x7c0005aa
#define PPC_INST_STSWX 0x7c00052a #define PPC_INST_STSWX 0x7c00052a
#define PPC_INST_TRECHKPT 0x7c0007dd #define PPC_INST_TRECHKPT 0x7c0007dd
...@@ -583,6 +582,7 @@ ...@@ -583,6 +582,7 @@
#define PPC_RAW_BL(offset) (0x48000001 | PPC_LI(offset)) #define PPC_RAW_BL(offset) (0x48000001 | PPC_LI(offset))
#define PPC_RAW_TW(t0, a, b) (0x7f000008 | ___PPC_RS(t0) | ___PPC_RA(a) | ___PPC_RB(b)) #define PPC_RAW_TW(t0, a, b) (0x7f000008 | ___PPC_RS(t0) | ___PPC_RA(a) | ___PPC_RB(b))
#define PPC_RAW_TRAP() PPC_RAW_TW(31, 0, 0) #define PPC_RAW_TRAP() PPC_RAW_TW(31, 0, 0)
#define PPC_RAW_SETB(t, bfa) (0x7c000100 | ___PPC_RT(t) | ___PPC_RA((bfa) << 2))
/* Deal with instructions that older assemblers aren't aware of */ /* Deal with instructions that older assemblers aren't aware of */
#define PPC_BCCTR_FLUSH stringify_in_c(.long PPC_INST_BCCTR_FLUSH) #define PPC_BCCTR_FLUSH stringify_in_c(.long PPC_INST_BCCTR_FLUSH)
......
...@@ -53,9 +53,6 @@ ...@@ -53,9 +53,6 @@
ppc_inst_prefix(PPC_PREFIX_MLS | __PPC_PRFX_R(pr) | IMM_H(i), \ ppc_inst_prefix(PPC_PREFIX_MLS | __PPC_PRFX_R(pr) | IMM_H(i), \
PPC_RAW_ADDI(t, a, 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) static void __init init_pt_regs(struct pt_regs *regs)
{ {
static unsigned long msr; static unsigned long msr;
...@@ -935,21 +932,21 @@ static struct compute_test compute_tests[] = { ...@@ -935,21 +932,21 @@ static struct compute_test compute_tests[] = {
.subtests = { .subtests = {
{ {
.descr = "BFA = 1, CR = GT", .descr = "BFA = 1, CR = GT",
.instr = TEST_SETB(20, 1), .instr = ppc_inst(PPC_RAW_SETB(20, 1)),
.regs = { .regs = {
.ccr = 0x4000000, .ccr = 0x4000000,
} }
}, },
{ {
.descr = "BFA = 4, CR = LT", .descr = "BFA = 4, CR = LT",
.instr = TEST_SETB(20, 4), .instr = ppc_inst(PPC_RAW_SETB(20, 4)),
.regs = { .regs = {
.ccr = 0x8000, .ccr = 0x8000,
} }
}, },
{ {
.descr = "BFA = 5, CR = EQ", .descr = "BFA = 5, CR = EQ",
.instr = TEST_SETB(20, 5), .instr = ppc_inst(PPC_RAW_SETB(20, 5)),
.regs = { .regs = {
.ccr = 0x200, .ccr = 0x200,
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment