From: Michael Ellerman <mpe@ellerman.id.au>
To: Balamuruhan S <bala24@linux.ibm.com>
Cc: christophe.leroy@c-s.fr, ravi.bangoria@linux.ibm.com,
jniethe5@gmail.com, Balamuruhan S <bala24@linux.ibm.com>,
paulus@samba.org, sandipan@linux.ibm.com,
naveen.n.rao@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/6] powerpc/ppc-opcode: introduce PPC_RAW_* macros for base instruction encoding
Date: Wed, 10 Jun 2020 20:50:49 +1000 [thread overview]
Message-ID: <87mu5bfb3q.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20200526081523.92463-2-bala24@linux.ibm.com>
Balamuruhan S <bala24@linux.ibm.com> writes:
> Introduce PPC_RAW_* macros to have all the bare encoding of ppc
> instructions. Move `VSX_XX*()` and `TMRN()` macros up to reuse it.
>
> Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
> Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> arch/powerpc/include/asm/ppc-opcode.h | 183 ++++++++++++++++++++++++--
> 1 file changed, 175 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> index 2a39c716c343..e3540be1fc17 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -431,6 +431,181 @@
> #define __PPC_EH(eh) 0
> #endif
>
> +/* Base instruction encoding */
> +#define PPC_RAW_CP_ABORT (PPC_INST_CP_ABORT)
> +#define PPC_RAW_COPY(a, b) (PPC_INST_COPY | ___PPC_RA(a) | \
> + ___PPC_RB(b))
> +#define PPC_RAW_DARN(t, l) (PPC_INST_DARN | ___PPC_RT(t) | \
> + (((l) & 0x3) << 16))
I know you're copying the existing formatting by wrapping these lines,
but please don't.
It hurts rather than improves readability.
For a line like the one above, just let it be long, eg:
#define PPC_RAW_DARN(t, l) (PPC_INST_DARN | ___PPC_RT(t) | (((l) & 0x3) << 16))
Yeah it's 91 columns but who cares.
For the really long ones like:
> +#define PPC_RAW_TLBIE_5(rb, rs, ric, prs, r) \
> + (PPC_INST_TLBIE | \
> + ___PPC_RB(rb) | \
> + ___PPC_RS(rs) | \
> + ___PPC_RIC(ric) | \
> + ___PPC_PRS(prs) | \
> + ___PPC_R(r))
I think this is the best option:
#define PPC_RAW_TLBIE_5(rb, rs, ric, prs, r) \
(PPC_INST_TLBIE | ___PPC_RB(rb) | ___PPC_RS(rs) | ___PPC_RIC(ric) | ___PPC_PRS(prs) | ___PPC_R(r))
Which is long, but I don't think wrapping it helps.
If we didn't have those ridiculous ___PPC_RX macros it would be a bit
shorter, but I guess that's a rework for another day.
cheers
next prev parent reply other threads:[~2020-06-10 11:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 8:15 [PATCH 0/6] consolidate PowerPC instruction encoding macros Balamuruhan S
2020-05-26 8:15 ` [PATCH 1/6] powerpc/ppc-opcode: introduce PPC_RAW_* macros for base instruction encoding Balamuruhan S
2020-06-10 10:50 ` Michael Ellerman [this message]
2020-05-26 8:15 ` [PATCH 2/6] powerpc/ppc-opcode: move ppc instruction encoding from test_emulate_step Balamuruhan S
2020-06-10 5:19 ` Sandipan Das
2020-05-26 8:15 ` [PATCH 3/6] powerpc/bpf_jit: reuse instruction macros from ppc-opcode.h Balamuruhan S
2020-06-10 5:17 ` Sandipan Das
2020-05-26 8:15 ` [PATCH 4/6] powerpc/ppc-opcode: consolidate powerpc instructions from bpf_jit.h Balamuruhan S
2020-06-10 5:18 ` Sandipan Das
2020-05-26 8:15 ` [PATCH 5/6] powerpc/ppc-opcode: reuse raw instruction macros to stringify Balamuruhan S
2020-05-26 8:15 ` [PATCH 6/6] powerpc/ppc-opcode: fold PPC_INST_* macros into PPC_RAW_* macros Balamuruhan S
2020-06-10 10:50 ` [PATCH 0/6] consolidate PowerPC instruction encoding macros Michael Ellerman
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=87mu5bfb3q.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=bala24@linux.ibm.com \
--cc=christophe.leroy@c-s.fr \
--cc=jniethe5@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=ravi.bangoria@linux.ibm.com \
--cc=sandipan@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).