Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1369150
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH 3/6] ppc: bpf/jit: Introduce rotate immediate instructions |
| Date | 2016-04-01 12:10 +0200 |
| Message-ID | <rj4bE-2M5-13@gated-at.bofh.it> (permalink) |
| References | <rj4bE-2M5-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Since we will be using the rotate immediate instructions for extended BPF JIT, let's introduce macros for the same. And since the shift immediate operations use the rotate immediate instructions, let's redo those macros to use the newly introduced instructions. Cc: Matt Evans <matt@ozlabs.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Paul Mackerras <paulus@samba.org> Cc: Alexei Starovoitov <ast@fb.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> --- arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/net/bpf_jit.h | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 7ab04fc..95fd811 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -271,6 +271,8 @@ #define __PPC_SH(s) __PPC_WS(s) #define __PPC_MB(s) (((s) & 0x1f) << 6) #define __PPC_ME(s) (((s) & 0x1f) << 1) +#define __PPC_MB64(s) (__PPC_MB(s) | ((s) & 0x20)) +#define __PPC_ME64(s) __PPC_MB64(s) #define __PPC_BI(s) (((s) & 0x1f) << 16) #define __PPC_CT(t) (((t) & 0x0f) << 21) diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h index 4c1e055..95d0e38 100644 --- a/arch/powerpc/net/bpf_jit.h +++ b/arch/powerpc/net/bpf_jit.h @@ -210,18 +210,20 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh); ___PPC_RS(a) | ___PPC_RB(s)) #define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \ ___PPC_RS(a) | ___PPC_RB(s)) +#define PPC_RLWINM(d, a, i, mb, me) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \ + ___PPC_RS(a) | __PPC_SH(i) | \ + __PPC_MB(mb) | __PPC_ME(me)) +#define PPC_RLDICR(d, a, i, me) EMIT(PPC_INST_RLDICR | ___PPC_RA(d) | \ + ___PPC_RS(a) | __PPC_SH(i) | \ + __PPC_ME64(me) | (((i) & 0x20) >> 4)) + /* slwi = rlwinm Rx, Ry, n, 0, 31-n */ -#define PPC_SLWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \ - ___PPC_RS(a) | __PPC_SH(i) | \ - __PPC_MB(0) | __PPC_ME(31-(i))) +#define PPC_SLWI(d, a, i) PPC_RLWINM(d, a, i, 0, 31-(i)) /* srwi = rlwinm Rx, Ry, 32-n, n, 31 */ -#define PPC_SRWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \ - ___PPC_RS(a) | __PPC_SH(32-(i)) | \ - __PPC_MB(i) | __PPC_ME(31)) +#define PPC_SRWI(d, a, i) PPC_RLWINM(d, a, 32-(i), i, 31) /* sldi = rldicr Rx, Ry, n, 63-n */ -#define PPC_SLDI(d, a, i) EMIT(PPC_INST_RLDICR | ___PPC_RA(d) | \ - ___PPC_RS(a) | __PPC_SH(i) | \ - __PPC_MB(63-(i)) | (((i) & 0x20) >> 4)) +#define PPC_SLDI(d, a, i) PPC_RLDICR(d, a, i, 63-(i)) + #define PPC_NEG(d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a)) /* Long jump; (unconditional 'branch') */ -- 2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 0/6] eBPF JIT for PPC64 "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:10 +0200
[RFC PATCH 5/6] ppc: bpf/jit: Isolate classic BPF JIT specifics into a separate header "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:10 +0200
[RFC PATCH 6/6] ppc: ebpf/jit: Implement JIT compiler for extended BPF "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:10 +0200
Re: [RFC PATCH 6/6] ppc: ebpf/jit: Implement JIT compiler for extended BPF Alexei Starovoitov <ast@fb.com> - 2016-04-01 20:20 +0200
Re: [RFC PATCH 6/6] ppc: ebpf/jit: Implement JIT compiler for extended BPF Daniel Borkmann <daniel@iogearbox.net> - 2016-04-01 20:40 +0200
[RFC PATCH 3/6] ppc: bpf/jit: Introduce rotate immediate instructions "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:10 +0200
[RFC PATCH 4/6] ppc: bpf/jit: A few cleanups "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:10 +0200
[RFC PATCH 1/6] ppc: bpf/jit: Fix/enhance 32-bit Load Immediate implementation "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:10 +0200
[RFC PATCH 2/6] ppc: bpf/jit: Optimize 64-bit Immediate loads "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:10 +0200
Re: [RFC PATCH 0/6] eBPF JIT for PPC64 "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-01 12:30 +0200
csiph-web