[PATCH] Add PRU support for LMBD (left-most bit detect) instruction

Dimitar Dimitrov dimitar@dinux.eu
Fri Nov 6 17:29:34 GMT 2020


On вторник, 27 октомври 2020 г. 19:44:19 EET Dimitar Dimitrov wrote:
> On вторник, 27 октомври 2020 г. 19:04:48 EET Spencer E. Olson wrote:
> > include/ChangeLog:
> > 2020-10-26  Spencer E. Olson  <olsonse@umich.edu>
> > 
> > 	* opcode/pru.h: Add LMBD (left-most bit detect) opcode index
> > 
> > opcodes/ChangeLog:
> > 2020-10-26  Spencer E. Olson  <olsonse@umich.edu>
> > 
> > 	* pru-opc.c: Add opcode description for LMBD (left-most bit detect)
> > 
> > gas
> > 
> > 	* gas/testsuite/gas/pru/misc.s: Add tests for lmbd (left-most bit 
detect)
> > 	* gas/testsuite/gas/pru/misc.d: Add tests for lmbd (left-most bit 
detect)
> > 
> > ---
> > 
> > This patch adds support for an instruction that was misidentified
> > initially
> > as being obsolete.  This instruction (LMBD:  Left-most bit detect)
> > searches
> > a register to identify the first bit (from the left) that matches the
> > first
> > bit of the given immediate/register operand.  This patch adds the minimal
> > description required and associated tests to support the LMBD instruction.
> > 
> >  gas/testsuite/gas/pru/misc.d | 3 +++
> >  gas/testsuite/gas/pru/misc.s | 3 +++
> >  include/ChangeLog            | 4 ++++
> >  include/opcode/pru.h         | 4 ++--
> >  opcodes/ChangeLog            | 4 ++++
> >  opcodes/pru-opc.c            | 2 ++
> >  6 files changed, 18 insertions(+), 2 deletions(-)
> > 
> > diff --git a/gas/testsuite/gas/pru/misc.d b/gas/testsuite/gas/pru/misc.d
> > index 7c791e63f4..ac778db545 100644
> > --- a/gas/testsuite/gas/pru/misc.d
> > +++ b/gas/testsuite/gas/pru/misc.d
> > 
> > @@ -9,3 +9,6 @@ Disassembly of section .text:
> >  0+0000 <[^>]*> 2a000000 	halt
> >  0+0004 <[^>]*> 3e800000 	slp	1
> >  0+0008 <[^>]*> 3e000000 	slp	0
> > 
> > +0+000c <[^>]*> 2701e1e0 	lmbd	r0, r1, 1
> > +0+0010 <[^>]*> 2700e100 	lmbd	r0.b0, r1, 0
> > +0+0014 <[^>]*> 2642e1e0 	lmbd	r0, r1, sp.b2
> > diff --git a/gas/testsuite/gas/pru/misc.s b/gas/testsuite/gas/pru/misc.s
> > index cfe4d88fce..42e08a7579 100644
> > --- a/gas/testsuite/gas/pru/misc.s
> > +++ b/gas/testsuite/gas/pru/misc.s
> > 
> > @@ -4,3 +4,6 @@ foo:
> >  	halt
> >  	slp	1
> >  	slp	0
> > 
> > +	lmbd r0, r1, 0x1
> > +	lmbd r0.b0, r1, 0x0
> > +	lmbd r0, r1, r2.b2
> > diff --git a/include/ChangeLog b/include/ChangeLog
> > index 2267cda7bd..914d6a1f84 100644
> > --- a/include/ChangeLog
> > +++ b/include/ChangeLog
> > @@ -1,3 +1,7 @@
> > +2020-10-26  Spencer E. Olson  <olsonse@umich.edu>
> > +
> > +	* opcode/pru.h: Add LMBD (left-most bit detect) opcode index.
> > +
> > 
> >  2020-10-26  Cooper Qu <cooper.qu@linux.alibaba.com>
> >  
> >  	* opcode/csky.h (CSKY_VERSION_V1): New, currently used.
> > 
> > diff --git a/include/opcode/pru.h b/include/opcode/pru.h
> > index 74cc27a544..a5472e5e15 100644
> > --- a/include/opcode/pru.h
> > +++ b/include/opcode/pru.h
> > @@ -58,8 +58,8 @@ enum opcode_format_type {
> > 
> >  enum pru_instr_type {
> >  
> >      prui_add, prui_adc, prui_sub, prui_suc, prui_lsl, prui_lsr, prui_rsb,
> >      prui_rsc, prui_and, prui_or,  prui_xor, prui_min, prui_max, prui_clr,
> > 
> > -    prui_set, prui_not, prui_jmp, prui_jal, prui_ldi, prui_halt,
> > prui_slp,
> > -    prui_xin, prui_xout, prui_xchg, prui_sxin, prui_sxout, prui_sxchg,
> > +    prui_set, prui_not, prui_jmp, prui_jal, prui_ldi, prui_lmbd,
> > prui_halt, +    prui_slp, prui_xin, prui_xout, prui_xchg, prui_sxin,
> > prui_sxout, prui_sxchg, prui_loop, prui_iloop, prui_qbgt, prui_qbge,
> > prui_qblt, prui_qble, prui_qbeq, prui_qbne, prui_qba, prui_qbbs,
> > prui_qbbc, prui_lbbo, prui_sbbo, prui_lbco, prui_sbco
> > diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
> > index 94659f4c38..a6140c819b 100644
> > --- a/opcodes/ChangeLog
> > +++ b/opcodes/ChangeLog
> > @@ -1,3 +1,7 @@
> > +2020-10-26  Spencer E. Olson  <olsonse@umich.edu>
> > +
> > +	* pru-opc.c: Add opcode description for LMBD (left-most bit detect).
> > +
> > 
> >  2020-10-26  Cooper Qu <cooper.qu@linux.alibaba.com>
> >  
> >  	* csky-opc.h (csky_v2_opcodes): Change plsl.u16 to plsl.16.
> > 
> > diff --git a/opcodes/pru-opc.c b/opcodes/pru-opc.c
> > index f1fb7fefe1..05ddfb0358 100644
> > --- a/opcodes/pru-opc.c
> > +++ b/opcodes/pru-opc.c
> > @@ -121,6 +121,8 @@ const struct pru_opcode pru_opcodes[] =
> > 
> >     OP_MATCH_JAL, OP_MASK_FMT2_OP | OP_MASK_SUBOP, 0,
> > 
> > unsigned_immed16_overflow}, { "ldi", prui_ldi, "d,W",
> > 
> >     OP_MATCH_LDI, OP_MASK_FMT2_OP | OP_MASK_SUBOP, 0,
> > 
> > unsigned_immed16_overflow}, +  { "lmbd", prui_lmbd, "d,s,b",
> > +   OP_MATCH_LMBD, OP_MASK_FMT2_OP | OP_MASK_SUBOP, 0,
> > unsigned_immed8_overflow}, { "halt", prui_halt, "",
> > 
> >     OP_MATCH_HALT, OP_MASK_FMT2_OP | OP_MASK_SUBOP, 0, no_overflow},
> >    
> >    { "slp", prui_slp, "w",
> 
> Change looks good to me. I'm not sure if it is considered small enough
> change to avoid copyright assignment.
> 
> Olson, in the future please do not modify ChangeLog in your change, since
> changelogs frequently conflict. ChangeLog files are supposed to be updated
> after applying your patch, just prior commit to master.
> 
> Thanks,
> Dimitar

Ping.






More information about the Binutils mailing list