This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH][GAS][ARM] Fix disassembly of strht


> -----Original Message-----
> From: Richard Earnshaw
> Sent: 01 February 2013 14:22
> To: Kyrylo Tkachov
> Cc: binutils@sourceware.org; nickc@redhat.com
> Subject: Re: [PATCH][GAS][ARM] Fix disassembly of strht
> 
> On 01/02/13 11:03, Kyrylo Tkachov wrote:
> > Hi all,
> > gas disassembles a form of the strht ARM instruction improperly:
> >
> > strht r0, [r1], -r2 @ assembles to E02100B2
> > @ disassembles as "strh r0, [r1], -r2 ; UNPREDICTABLE"
> > strht r0, [r1], r2 @ assembles to E0A100B2
> > @ disassembles as "strh r0, [r1], r2 ; UNPREDICTABLE"
> >
> > This patch fixes that. New tests are added for that case, and also
> for the
> > similar ldrht instruction.
> >
> > Ok for trunk?
> >
> > Thanks,
> > Kyrill
> >
> > opcodes/ChangeLog
> >
> > 2013-02-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> >
> > 	* arm-dis.c: Add another pattern for strht.
> >
> >
> > gas/testsuite/ChangeLog
> >
> > 2013-02-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> >
> > 	* gas/arm/archv6t2.s: Add strht and ldrht tests.
> > 	* gas/arm/archv6t2.d: Add disassembly patterns for the above.
> >
> >
> > gas-strht.txt
> >
> >
> > diff --git a/gas/testsuite/gas/arm/archv6t2.d
> b/gas/testsuite/gas/arm/archv6t2.d
> > index 2c8d5b6..eb76a32 100644
> > --- a/gas/testsuite/gas/arm/archv6t2.d
> > +++ b/gas/testsuite/gas/arm/archv6t2.d
> > @@ -49,3 +49,15 @@ Disassembly of section .text:
> >   0+a4 <[^>]+> e03090b9 	ldrht	r9, \[r0\], -r9
> >   0+a8 <[^>]+> e0f099b9 	ldrht	r9, \[r0\], #153.*
> >   0+ac <[^>]+> e07099b9 	ldrht	r9, \[r0\], #-153.*
> > +0+b0 <[^>]+> 10b090b9 	ldrhtne	r9, \[r0\], r9
> > +0+b4 <[^>]+> 103090b9 	ldrhtne	r9, \[r0\], -r9
> > +0+b8 <[^>]+> 10f099b9 	ldrhtne	r9, \[r0\], #153	; 0x99
> > +0+bc <[^>]+> 107099b9 	ldrhtne	r9, \[r0\], #-153	;
> 0xffffff67
> > +0+c0 <[^>]+> e02100b2 	strht	r0, \[r1\], -r2
> > +0+c4 <[^>]+> 102100b2 	strhtne	r0, \[r1\], -r2
> > +0+c8 <[^>]+> e0a100b2 	strht	r0, \[r1\], r2
> > +0+cc <[^>]+> 10a100b2 	strhtne	r0, \[r1\], r2
> > +0+d0 <[^>]+> e0e100b2 	strht	r0, \[r1\], #2
> > +0+d4 <[^>]+> e06100b2 	strht	r0, \[r1\], #-2
> > +0+d8 <[^>]+> 10e100b2 	strhtne	r0, \[r1\], #2
> > +0+dc <[^>]+> 106100b2 	strhtne	r0, \[r1\], #-2
> > diff --git a/gas/testsuite/gas/arm/archv6t2.s
> b/gas/testsuite/gas/arm/archv6t2.s
> > index 292f11c..81ff501 100644
> > --- a/gas/testsuite/gas/arm/archv6t2.s
> > +++ b/gas/testsuite/gas/arm/archv6t2.s
> > @@ -53,3 +53,15 @@ x:
> >   	ldrht	r9, [r0], -r9
> >   	ldrht	r9, [r0], #0x99
> >   	ldrht	r9, [r0], #-0x99
> > +	ldrneht	r9, [r0], r9
> > +	ldrneht	r9, [r0], -r9
> > +	ldrneht	r9, [r0], #0x99
> > +	ldrneht	r9, [r0], #-0x99
> > +	strht	r0, [r1], -r2
> > +	strneht	r0, [r1], -r2
> > +	strht	r0, [r1], r2
> > +	strneht	r0, [r1], r2
> > +	strht	r0, [r1], #2
> > +	strht	r0, [r1], #-2
> > +	strneht	r0, [r1], #2
> > +	strneht	r0, [r1], #-2
> > diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
> > index d140761..a1a6f4c 100644
> > --- a/opcodes/arm-dis.c
> > +++ b/opcodes/arm-dis.c
> > @@ -929,7 +929,8 @@ static const struct opcode32 arm_opcodes[] =
> >     {ARM_EXT_V6T2, 0x07c00010, 0x0fe00070, "bfi%c\t%12-15R, %0-3r,
> %E"},
> >     {ARM_EXT_V6T2, 0x00600090, 0x0ff000f0, "mls%c\t%16-19R, %0-3R,
> %8-11R, %12-15R"},
> >     {ARM_EXT_V6T2, 0x006000b0, 0x0f7000f0, "strht%c\t%12-15R, %S"},
> > -
> > +  {ARM_EXT_V6T2, 0x002000b0, 0x0f7000f0, "strht%c\t%12-15R, %S"},
> > +
> 
> Can't the two lines above be merged by changing the mask word?

Thanks for the comments, Richard.
Indeed, merging them works :)
Here is the updated patch.

Thanks,
Kyrill

opcodes/ChangeLog

2013-02-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* arm-dis.c: Update strht pattern.


gas/testsuite/ChangeLog

2013-02-01  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* gas/arm/archv6t2.s: Add strht and ldrht tests.
	* gas/arm/archv6t2.d: Add disassembly patterns for the above.


> 
> So
> 
>     {ARM_EXT_V6T2, 0x002000b0, 0x0f3000f0, ...
> 
> R.
> 
> 

Attachment: gas-strht.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]