public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* iWMMXt offsets bug fix
@ 2006-04-29  5:15 Joseph S. Myers
  2006-05-02 11:29 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2006-04-29  5:15 UTC (permalink / raw)
  To: binutils

The ARM assembler fails to accept the full offset range for some iWMMXt 
instructions (wstrb, wstrh, wldrb, wldrh) because it multiplies the offset 
by 4 before checking against the correct range for the original offset.  
This patch fixes the problem by moving the multiplication to after the 
check.

OK to commit to mainline?  CSL branch?  2.17 release branch?  (Tested all 
three places.)

2006-04-28  Joseph Myers  <joseph@codesourcery.com>

	* config/tc-arm.c (do_iwmmxt_wldstbh): Don't multiply offset by 4
	here.
	(md_apply_fix3): Multiply offset by 4 here for
	BFD_RELOC_ARM_CP_OFF_IMM_S2 and BFD_RELOC_ARM_T32_CP_OFF_IMM_S2.

2006-04-28  Joseph Myers  <joseph@codesourcery.com>

	* gas/arm/iwmmxt.s: Increase offsets for wstrb and wstrh.
	* gas/arm/iwmmxt.d: Update expected results.
	* gas/arm/iwmmxt-bad2.s: Test wstrb, wstrh, wldrb and wldrh.
	* gas/arm/iwmmxt-bad2.l: Update expected error messages.

Index: config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.261
diff -u -r1.261 tc-arm.c
--- config/tc-arm.c	26 Apr 2006 16:03:02 -0000	1.261
+++ config/tc-arm.c	28 Apr 2006 19:18:52 -0000
@@ -7187,7 +7187,6 @@
 {
   int reloc;
   inst.instruction |= inst.operands[0].reg << 12;
-  inst.reloc.exp.X_add_number *= 4;
   if (thumb_mode)
     reloc = BFD_RELOC_ARM_T32_CP_OFF_IMM_S2;
   else
@@ -16477,6 +16476,7 @@
       if (value < -255 || value > 255)
 	as_bad_where (fixP->fx_file, fixP->fx_line,
 		      _("co-processor offset out of range"));
+      value *= 4;
       goto cp_off_common;
 
     case BFD_RELOC_ARM_THUMB_OFFSET:
Index: testsuite/gas/arm/iwmmxt-bad2.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/iwmmxt-bad2.l,v
retrieving revision 1.1
diff -u -r1.1 iwmmxt-bad2.l
--- testsuite/gas/arm/iwmmxt-bad2.l	3 Aug 2005 09:50:43 -0000	1.1
+++ testsuite/gas/arm/iwmmxt-bad2.l	28 Apr 2006 19:18:52 -0000
@@ -1,3 +1,7 @@
 [^:]*: Assembler messages:
 [^:]*:1: Error: co-processor offset out of range
 [^:]*:2: Error: co-processor offset out of range
+[^:]*:3: Error: co-processor offset out of range
+[^:]*:4: Error: co-processor offset out of range
+[^:]*:5: Error: co-processor offset out of range
+[^:]*:6: Error: co-processor offset out of range
Index: testsuite/gas/arm/iwmmxt-bad2.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/iwmmxt-bad2.s,v
retrieving revision 1.1
diff -u -r1.1 iwmmxt-bad2.s
--- testsuite/gas/arm/iwmmxt-bad2.s	3 Aug 2005 09:50:43 -0000	1.1
+++ testsuite/gas/arm/iwmmxt-bad2.s	28 Apr 2006 19:18:52 -0000
@@ -1,2 +1,6 @@
 	wldrd   wr1, [r0, #3]
         wstrd   wr1, [r0, #0x400]
+        wstrb   wr1, [r0, #0x100]
+        wstrh   wr1, [r0, #0x100]
+        wldrb   wr1, [r0, #-0x100]
+        wldrh   wr1, [r0, #-0x100]
Index: testsuite/gas/arm/iwmmxt.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/iwmmxt.d,v
retrieving revision 1.5
diff -u -r1.5 iwmmxt.d
--- testsuite/gas/arm/iwmmxt.d	3 Aug 2005 09:50:43 -0000	1.5
+++ testsuite/gas/arm/iwmmxt.d	28 Apr 2006 19:18:52 -0000
@@ -135,8 +135,8 @@
 0+1fc <[^>]*> ee65114b[ 	]+wsrlhg[ 	]+wr1, wr5, wcgr3
 0+200 <[^>]*> 4ea51148[ 	]+wsrlwgmi[ 	]+wr1, wr5, wcgr0
 0+204 <[^>]*> eee51149[ 	]+wsrldg[ 	]+wr1, wr5, wcgr1
-0+208 <[^>]*> ed811004[ 	]+wstrb[ 	]+wr1, \[r1, #4\]
-0+20c <[^>]*> ede11004[ 	]+wstrh[ 	]+wr1, \[r1, #4\]!
+0+208 <[^>]*> ed8110ff[ 	]+wstrb[ 	]+wr1, \[r1, #255\]
+0+20c <[^>]*> ed6110ff[ 	]+wstrh[ 	]+wr1, \[r1, #-255\]!
 0+210 <[^>]*> eca11101[ 	]+wstrw[ 	]+wr1, \[r1\], #4
 0+214 <[^>]*> edc111ff[ 	]+wstrd[ 	]+wr1, \[r1, #1020\]
 0+218 <[^>]*> fca1314b[ 	]+wstrw[ 	]+wcasf, \[r1\], #300
Index: testsuite/gas/arm/iwmmxt.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/iwmmxt.s,v
retrieving revision 1.4
diff -u -r1.4 iwmmxt.s
--- testsuite/gas/arm/iwmmxt.s	3 Aug 2005 09:50:43 -0000	1.4
+++ testsuite/gas/arm/iwmmxt.s	28 Apr 2006 19:18:52 -0000
@@ -164,8 +164,8 @@
 	wsrlwgmi	wr1, wr5, wcgr0
 	wsrldg		wr1, wr5, wcgr1
 
-	wstrb		wr1, [r1, #4]
-	wstrh		wr1, [r1, #4]!
+	wstrb		wr1, [r1, #0xFF]
+	wstrh		wr1, [r1, #-0xFF]!
 	wstrw		wr1, [r1], #4
 	wstrd		wr1, [r1, #0x3FC]
 	wstrw		wcasf, [r1], #300

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: iWMMXt offsets bug fix
  2006-04-29  5:15 iWMMXt offsets bug fix Joseph S. Myers
@ 2006-05-02 11:29 ` Nick Clifton
  2006-05-02 13:35   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2006-05-02 11:29 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: binutils

Hi Joseph,

> OK to commit to mainline?  CSL branch?  2.17 release branch?  (Tested all 
> three places.)
> 
> 2006-04-28  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* config/tc-arm.c (do_iwmmxt_wldstbh): Don't multiply offset by 4
> 	here.
> 	(md_apply_fix3): Multiply offset by 4 here for
> 	BFD_RELOC_ARM_CP_OFF_IMM_S2 and BFD_RELOC_ARM_T32_CP_OFF_IMM_S2.
> 
> 2006-04-28  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* gas/arm/iwmmxt.s: Increase offsets for wstrb and wstrh.
> 	* gas/arm/iwmmxt.d: Update expected results.
> 	* gas/arm/iwmmxt-bad2.s: Test wstrb, wstrh, wldrb and wldrh.
> 	* gas/arm/iwmmxt-bad2.l: Update expected error messages.

Approved for mainline and 2.17 branch.  (I am assuming that Daniel will 
have no objections).

Cheers
   Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: iWMMXt offsets bug fix
  2006-05-02 11:29 ` Nick Clifton
@ 2006-05-02 13:35   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2006-05-02 13:35 UTC (permalink / raw)
  To: binutils

On Tue, May 02, 2006 at 12:27:01PM +0100, Nick Clifton wrote:
> Approved for mainline and 2.17 branch.  (I am assuming that Daniel will 
> have no objections).

You assume correctly :-)

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-02 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-29  5:15 iWMMXt offsets bug fix Joseph S. Myers
2006-05-02 11:29 ` Nick Clifton
2006-05-02 13:35   ` Daniel Jacobowitz

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 read-only IMAP folder(s) and NNTP newsgroup(s).