Commit 357c5729 authored by Balamuruhan S's avatar Balamuruhan S Committed by Michael Ellerman

powerpc/ppc-opcode: Reuse raw instruction macros to stringify

Wrap existing stringify macros to reuse raw instruction encoding
macros that are newly added.
Signed-off-by: default avatarBalamuruhan S <bala24@linux.ibm.com>
Tested-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
[mpe: Add DCBFPS, DCBSTPS, PHWSYNC, PLWSYNC]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200624113038.908074-6-bala24@linux.ibm.com
parent 3a181237
...@@ -628,175 +628,96 @@ ...@@ -628,175 +628,96 @@
/* 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)
#define PPC_CP_ABORT stringify_in_c(.long PPC_INST_CP_ABORT) #define PPC_CP_ABORT stringify_in_c(.long PPC_RAW_CP_ABORT)
#define PPC_COPY(a, b) stringify_in_c(.long PPC_INST_COPY | \ #define PPC_COPY(a, b) stringify_in_c(.long PPC_RAW_COPY(a, b))
___PPC_RA(a) | ___PPC_RB(b)) #define PPC_DARN(t, l) stringify_in_c(.long PPC_RAW_DARN(t, l))
#define PPC_DARN(t, l) stringify_in_c(.long PPC_INST_DARN | \ #define PPC_DCBAL(a, b) stringify_in_c(.long PPC_RAW_DCBAL(a, b))
___PPC_RT(t) | \ #define PPC_DCBZL(a, b) stringify_in_c(.long PPC_RAW_DCBZL(a, b))
(((l) & 0x3) << 16)) #define PPC_LQARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LQARX(t, a, b, eh))
#define PPC_DCBAL(a, b) stringify_in_c(.long PPC_INST_DCBAL | \ #define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LDARX(t, a, b, eh))
__PPC_RA(a) | __PPC_RB(b)) #define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LWARX(t, a, b, eh))
#define PPC_DCBZL(a, b) stringify_in_c(.long PPC_INST_DCBZL | \ #define PPC_STQCX(t, a, b) stringify_in_c(.long PPC_RAW_STQCX(t, a, b))
__PPC_RA(a) | __PPC_RB(b)) #define PPC_MADDHD(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDHD(t, a, b, c))
#define PPC_LQARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LQARX | \ #define PPC_MADDHDU(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDHDU(t, a, b, c))
___PPC_RT(t) | ___PPC_RA(a) | \ #define PPC_MADDLD(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDLD(t, a, b, c))
___PPC_RB(b) | __PPC_EH(eh)) #define PPC_MSGSND(b) stringify_in_c(.long PPC_RAW_MSGSND(b))
#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \ #define PPC_MSGSYNC stringify_in_c(.long PPC_RAW_MSGSYNC)
___PPC_RT(t) | ___PPC_RA(a) | \ #define PPC_MSGCLR(b) stringify_in_c(.long PPC_RAW_MSGCLR(b))
___PPC_RB(b) | __PPC_EH(eh)) #define PPC_MSGSNDP(b) stringify_in_c(.long PPC_RAW_MSGSNDP(b))
#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \ #define PPC_MSGCLRP(b) stringify_in_c(.long PPC_RAW_MSGCLRP(b))
___PPC_RT(t) | ___PPC_RA(a) | \ #define PPC_PASTE(a, b) stringify_in_c(.long PPC_RAW_PASTE(a, b))
___PPC_RB(b) | __PPC_EH(eh)) #define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_RAW_POPCNTB(a, s))
#define PPC_STQCX(t, a, b) stringify_in_c(.long PPC_INST_STQCX | \ #define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_RAW_POPCNTD(a, s))
___PPC_RT(t) | ___PPC_RA(a) | \ #define PPC_POPCNTW(a, s) stringify_in_c(.long PPC_RAW_POPCNTW(a, s))
___PPC_RB(b)) #define PPC_RFCI stringify_in_c(.long PPC_RAW_RFCI)
#define PPC_MADDHD(t, a, b, c) stringify_in_c(.long PPC_INST_MADDHD | \ #define PPC_RFDI stringify_in_c(.long PPC_RAW_RFDI)
___PPC_RT(t) | ___PPC_RA(a) | \ #define PPC_RFMCI stringify_in_c(.long PPC_RAW_RFMCI)
___PPC_RB(b) | ___PPC_RC(c)) #define PPC_TLBILX(t, a, b) stringify_in_c(.long PPC_RAW_TLBILX(t, a, b))
#define PPC_MADDHDU(t, a, b, c) stringify_in_c(.long PPC_INST_MADDHDU | \
___PPC_RT(t) | ___PPC_RA(a) | \
___PPC_RB(b) | ___PPC_RC(c))
#define PPC_MADDLD(t, a, b, c) stringify_in_c(.long PPC_INST_MADDLD | \
___PPC_RT(t) | ___PPC_RA(a) | \
___PPC_RB(b) | ___PPC_RC(c))
#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \
___PPC_RB(b))
#define PPC_MSGSYNC stringify_in_c(.long PPC_INST_MSGSYNC)
#define PPC_MSGCLR(b) stringify_in_c(.long PPC_INST_MSGCLR | \
___PPC_RB(b))
#define PPC_MSGSNDP(b) stringify_in_c(.long PPC_INST_MSGSNDP | \
___PPC_RB(b))
#define PPC_MSGCLRP(b) stringify_in_c(.long PPC_INST_MSGCLRP | \
___PPC_RB(b))
#define PPC_PASTE(a, b) stringify_in_c(.long PPC_INST_PASTE | \
___PPC_RA(a) | ___PPC_RB(b))
#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \
__PPC_RA(a) | __PPC_RS(s))
#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \
__PPC_RA(a) | __PPC_RS(s))
#define PPC_POPCNTW(a, s) stringify_in_c(.long PPC_INST_POPCNTW | \
__PPC_RA(a) | __PPC_RS(s))
#define PPC_RFCI stringify_in_c(.long PPC_INST_RFCI)
#define PPC_RFDI stringify_in_c(.long PPC_INST_RFDI)
#define PPC_RFMCI stringify_in_c(.long PPC_INST_RFMCI)
#define PPC_TLBILX(t, a, b) stringify_in_c(.long PPC_INST_TLBILX | \
__PPC_T_TLB(t) | __PPC_RA0(a) | __PPC_RB(b))
#define PPC_TLBILX_ALL(a, b) PPC_TLBILX(0, a, b) #define PPC_TLBILX_ALL(a, b) PPC_TLBILX(0, a, b)
#define PPC_TLBILX_PID(a, b) PPC_TLBILX(1, a, b) #define PPC_TLBILX_PID(a, b) PPC_TLBILX(1, a, b)
#define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b) #define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b)
#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \ #define PPC_WAIT(w) stringify_in_c(.long PPC_RAW_WAIT(w))
__PPC_WC(w)) #define PPC_TLBIE(lp, a) stringify_in_c(.long PPC_RAW_TLBIE(lp, a))
#define PPC_TLBIE(lp,a) stringify_in_c(.long PPC_INST_TLBIE | \ #define PPC_TLBIE_5(rb, rs, ric, prs, r) \
___PPC_RB(a) | ___PPC_RS(lp)) stringify_in_c(.long PPC_RAW_TLBIE_5(rb, rs, ric, prs, r))
#define PPC_TLBIE_5(rb,rs,ric,prs,r) \
stringify_in_c(.long PPC_INST_TLBIE | \
___PPC_RB(rb) | ___PPC_RS(rs) | \
___PPC_RIC(ric) | ___PPC_PRS(prs) | \
___PPC_R(r))
#define PPC_TLBIEL(rb,rs,ric,prs,r) \ #define PPC_TLBIEL(rb,rs,ric,prs,r) \
stringify_in_c(.long PPC_INST_TLBIEL | \ stringify_in_c(.long PPC_RAW_TLBIEL(rb, rs, ric, prs, r))
___PPC_RB(rb) | ___PPC_RS(rs) | \ #define PPC_TLBSRX_DOT(a, b) stringify_in_c(.long PPC_RAW_TLBSRX_DOT(a, b))
___PPC_RIC(ric) | ___PPC_PRS(prs) | \ #define PPC_TLBIVAX(a, b) stringify_in_c(.long PPC_RAW_TLBIVAX(a, b))
___PPC_R(r))
#define PPC_TLBSRX_DOT(a,b) stringify_in_c(.long PPC_INST_TLBSRX_DOT | \ #define PPC_ERATWE(s, a, w) stringify_in_c(.long PPC_RAW_ERATWE(s, a, w))
__PPC_RA0(a) | __PPC_RB(b)) #define PPC_ERATRE(s, a, w) stringify_in_c(.long PPC_RAW_ERATRE(a, a, w))
#define PPC_TLBIVAX(a,b) stringify_in_c(.long PPC_INST_TLBIVAX | \ #define PPC_ERATILX(t, a, b) stringify_in_c(.long PPC_RAW_ERATILX(t, a, b))
__PPC_RA0(a) | __PPC_RB(b)) #define PPC_ERATIVAX(s, a, b) stringify_in_c(.long PPC_RAW_ERATIVAX(s, a, b))
#define PPC_ERATSX(t, a, w) stringify_in_c(.long PPC_RAW_ERATSX(t, a, w))
#define PPC_ERATWE(s, a, w) stringify_in_c(.long PPC_INST_ERATWE | \ #define PPC_ERATSX_DOT(t, a, w) stringify_in_c(.long PPC_RAW_ERATSX_DOT(t, a, w))
__PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w)) #define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_RAW_SLBFEE_DOT(t, b))
#define PPC_ERATRE(s, a, w) stringify_in_c(.long PPC_INST_ERATRE | \ #define __PPC_SLBFEE_DOT(t, b) stringify_in_c(.long __PPC_RAW_SLBFEE_DOT(t, b))
__PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w)) #define PPC_ICBT(c, a, b) stringify_in_c(.long PPC_RAW_ICBT(c, a, b))
#define PPC_ERATILX(t, a, b) stringify_in_c(.long PPC_INST_ERATILX | \
__PPC_T_TLB(t) | __PPC_RA0(a) | \
__PPC_RB(b))
#define PPC_ERATIVAX(s, a, b) stringify_in_c(.long PPC_INST_ERATIVAX | \
__PPC_RS(s) | __PPC_RA0(a) | __PPC_RB(b))
#define PPC_ERATSX(t, a, w) stringify_in_c(.long PPC_INST_ERATSX | \
__PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b))
#define PPC_ERATSX_DOT(t, a, w) stringify_in_c(.long PPC_INST_ERATSX_DOT | \
__PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b))
#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \
__PPC_RT(t) | __PPC_RB(b))
#define __PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \
___PPC_RT(t) | ___PPC_RB(b))
#define PPC_ICBT(c,a,b) stringify_in_c(.long PPC_INST_ICBT | \
__PPC_CT(c) | __PPC_RA0(a) | __PPC_RB(b))
/* PASemi instructions */ /* PASemi instructions */
#define LBZCIX(t,a,b) stringify_in_c(.long PPC_INST_LBZCIX | \ #define LBZCIX(t, a, b) stringify_in_c(.long PPC_RAW_LBZCIX(t, a, b))
__PPC_RT(t) | __PPC_RA(a) | __PPC_RB(b)) #define STBCIX(s, a, b) stringify_in_c(.long PPC_RAW_STBCIX(s, a, b))
#define STBCIX(s,a,b) stringify_in_c(.long PPC_INST_STBCIX | \ #define PPC_DCBFPS(a, b) stringify_in_c(.long PPC_RAW_DCBFPS(a, b))
__PPC_RS(s) | __PPC_RA(a) | __PPC_RB(b)) #define PPC_DCBSTPS(a, b) stringify_in_c(.long PPC_RAW_DCBSTPS(a, b))
#define PPC_PHWSYNC stringify_in_c(.long PPC_RAW_PHWSYNC)
#define PPC_DCBFPS(a, b) stringify_in_c(.long PPC_INST_DCBF | \ #define PPC_PLWSYNC stringify_in_c(.long PPC_RAW_PLWSYNC)
___PPC_RA(a) | ___PPC_RB(b) | (4 << 21)) #define STXVD2X(s, a, b) stringify_in_c(.long PPC_RAW_STXVD2X(s, a, b))
#define PPC_DCBSTPS(a, b) stringify_in_c(.long PPC_INST_DCBF | \ #define LXVD2X(s, a, b) stringify_in_c(.long PPC_RAW_LXVD2X(s, a, b))
___PPC_RA(a) | ___PPC_RB(b) | (6 << 21)) #define MFVRD(a, t) stringify_in_c(.long PPC_RAW_MFVRD(a, t))
#define MTVRD(t, a) stringify_in_c(.long PPC_RAW_MTVRD(t, a))
#define PPC_PHWSYNC stringify_in_c(.long PPC_INST_PHWSYNC) #define VPMSUMW(t, a, b) stringify_in_c(.long PPC_RAW_VPMSUMW(t, a, b))
#define PPC_PLWSYNC stringify_in_c(.long PPC_INST_PLWSYNC) #define VPMSUMD(t, a, b) stringify_in_c(.long PPC_RAW_VPMSUMD(t, a, b))
#define XXLOR(t, a, b) stringify_in_c(.long PPC_RAW_XXLOR(t, a, b))
#define STXVD2X(s, a, b) stringify_in_c(.long PPC_INST_STXVD2X | \ #define XXSWAPD(t, a) stringify_in_c(.long PPC_RAW_XXSWAPD(t, a))
VSX_XX1((s), a, b)) #define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_RAW_XVCPSGNDP(t, a, b)))
#define LXVD2X(s, a, b) stringify_in_c(.long PPC_INST_LXVD2X | \
VSX_XX1((s), a, b))
#define MFVRD(a, t) stringify_in_c(.long PPC_INST_MFVSRD | \
VSX_XX1((t)+32, a, R0))
#define MTVRD(t, a) stringify_in_c(.long PPC_INST_MTVSRD | \
VSX_XX1((t)+32, a, R0))
#define VPMSUMW(t, a, b) stringify_in_c(.long PPC_INST_VPMSUMW | \
VSX_XX3((t), a, b))
#define VPMSUMD(t, a, b) stringify_in_c(.long PPC_INST_VPMSUMD | \
VSX_XX3((t), a, b))
#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \
VSX_XX3((t), a, b))
#define XXSWAPD(t, a) stringify_in_c(.long PPC_INST_XXSWAPD | \
VSX_XX3((t), a, a))
#define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_INST_XVCPSGNDP | \
VSX_XX3((t), (a), (b))))
#define VPERMXOR(vrt, vra, vrb, vrc) \ #define VPERMXOR(vrt, vra, vrb, vrc) \
stringify_in_c(.long (PPC_INST_VPERMXOR | \ stringify_in_c(.long (PPC_RAW_VPERMXOR(vrt, vra, vrb, vrc)))
___PPC_RT(vrt) | ___PPC_RA(vra) | \
___PPC_RB(vrb) | (((vrc) & 0x1f) << 6)))
#define PPC_NAP stringify_in_c(.long PPC_INST_NAP) #define PPC_NAP stringify_in_c(.long PPC_RAW_NAP)
#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP) #define PPC_SLEEP stringify_in_c(.long PPC_RAW_SLEEP)
#define PPC_WINKLE stringify_in_c(.long PPC_INST_WINKLE) #define PPC_WINKLE stringify_in_c(.long PPC_RAW_WINKLE)
#define PPC_STOP stringify_in_c(.long PPC_INST_STOP) #define PPC_STOP stringify_in_c(.long PPC_RAW_STOP)
/* BHRB instructions */ /* BHRB instructions */
#define PPC_CLRBHRB stringify_in_c(.long PPC_INST_CLRBHRB) #define PPC_CLRBHRB stringify_in_c(.long PPC_RAW_CLRBHRB)
#define PPC_MFBHRBE(r, n) stringify_in_c(.long PPC_INST_BHRBE | \ #define PPC_MFBHRBE(r, n) stringify_in_c(.long PPC_RAW_MFBHRBE(r, n))
__PPC_RT(r) | \
(((n) & 0x3ff) << 11))
/* Transactional memory instructions */ /* Transactional memory instructions */
#define TRECHKPT stringify_in_c(.long PPC_INST_TRECHKPT) #define TRECHKPT stringify_in_c(.long PPC_RAW_TRECHKPT)
#define TRECLAIM(r) stringify_in_c(.long PPC_INST_TRECLAIM \ #define TRECLAIM(r) stringify_in_c(.long PPC_RAW_TRECLAIM(r))
| __PPC_RA(r)) #define TABORT(r) stringify_in_c(.long PPC_RAW_TABORT(r))
#define TABORT(r) stringify_in_c(.long PPC_INST_TABORT \
| __PPC_RA(r))
/* book3e thread control instructions */ /* book3e thread control instructions */
#define MTTMR(tmr, r) stringify_in_c(.long PPC_INST_MTTMR | \ #define MTTMR(tmr, r) stringify_in_c(.long PPC_RAW_MTTMR(tmr, r))
TMRN(tmr) | ___PPC_RS(r)) #define MFTMR(tmr, r) stringify_in_c(.long PPC_RAW_MFTMR(tmr, r))
#define MFTMR(tmr, r) stringify_in_c(.long PPC_INST_MFTMR | \
TMRN(tmr) | ___PPC_RT(r))
/* Coprocessor instructions */ /* Coprocessor instructions */
#define PPC_ICSWX(s, a, b) stringify_in_c(.long PPC_INST_ICSWX | \ #define PPC_ICSWX(s, a, b) stringify_in_c(.long PPC_RAW_ICSWX(s, a, b))
___PPC_RS(s) | \ #define PPC_ICSWEPX(s, a, b) stringify_in_c(.long PPC_RAW_ICSWEPX(s, a, b))
___PPC_RA(a) | \
___PPC_RB(b)) #define PPC_SLBIA(IH) stringify_in_c(.long PPC_RAW_SLBIA(IH))
#define PPC_ICSWEPX(s, a, b) stringify_in_c(.long PPC_INST_ICSWEPX | \
___PPC_RS(s) | \
___PPC_RA(a) | \
___PPC_RB(b))
#define PPC_SLBIA(IH) stringify_in_c(.long PPC_INST_SLBIA | \
((IH & 0x7) << 21))
/* /*
* These may only be used on ISA v3.0 or later (aka. CPU_FTR_ARCH_300, radix * These may only be used on ISA v3.0 or later (aka. CPU_FTR_ARCH_300, radix
...@@ -808,12 +729,8 @@ ...@@ -808,12 +729,8 @@
#define PPC_RADIX_INVALIDATE_ERAT_USER PPC_SLBIA(3) #define PPC_RADIX_INVALIDATE_ERAT_USER PPC_SLBIA(3)
#define PPC_RADIX_INVALIDATE_ERAT_GUEST PPC_SLBIA(6) #define PPC_RADIX_INVALIDATE_ERAT_GUEST PPC_SLBIA(6)
#define VCMPEQUD_RC(vrt, vra, vrb) stringify_in_c(.long PPC_INST_VCMPEQUD | \ #define VCMPEQUD_RC(vrt, vra, vrb) stringify_in_c(.long PPC_RAW_VCMPEQUD_RC(vrt, vra, vrb))
___PPC_RT(vrt) | ___PPC_RA(vra) | \
___PPC_RB(vrb) | __PPC_RC21)
#define VCMPEQUB_RC(vrt, vra, vrb) stringify_in_c(.long PPC_INST_VCMPEQUB | \ #define VCMPEQUB_RC(vrt, vra, vrb) stringify_in_c(.long PPC_RAW_VCMPEQUB_RC(vrt, vra, vrb))
___PPC_RT(vrt) | ___PPC_RA(vra) | \
___PPC_RB(vrb) | __PPC_RC21)
#endif /* _ASM_POWERPC_PPC_OPCODE_H */ #endif /* _ASM_POWERPC_PPC_OPCODE_H */
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