public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Overlapping operands in ARM mul and mla instructions
@ 2007-03-15 13:59 Mark Shinwell
  2007-03-15 14:19 ` Paul Brook
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Shinwell @ 2007-03-15 13:59 UTC (permalink / raw)
  To: binutils

ARMv6 upwards permits overlapping operands to mul and mla
instructions in a way that previous architecture versions did not.
This patch adjusts gas behaviour accordingly.

Tested with cross to arm-none-eabi.

OK to apply?

Mark

--


2007-03-15  Mark Shinwell  <shinwell@codesourcery.com>

	gas/
	* config/tc-arm.c (do_mul): Don't warn about overlapping
	Rd and Rm operands when assembling for v6 or above.
	Correctly capitalize register names in the messages.
	(do_mlas): Likewise.  Delete spurious blank line.

	gas/testsuite/
	* gas/arm/mul-overlap.s: New.
	* gas/arm/mul-overlap.d: New.
	* gas/arm/mul-overlap.l: New.
	* gas/arm/mul-overlap-v6.s: New.
	* gas/arm/mul-overlap-v6.d: New.


Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.314
diff -U3 -p -r1.314 tc-arm.c
--- gas/config/tc-arm.c 15 Mar 2007 12:11:49 -0000      1.314
+++ gas/config/tc-arm.c 15 Mar 2007 13:55:33 -0000
@@ -7051,17 +7051,16 @@ do_lstc (void)
  static void
  do_mlas (void)
  {
-  /* This restriction does not apply to mls (nor to mla in v6, but
-     that's hard to detect at present).         */
+  /* This restriction does not apply to mls (nor to mla in v6 or later).  */
    if (inst.operands[0].reg == inst.operands[1].reg
+      && !ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6)
        && !(inst.instruction & 0x00400000))
-    as_tsktsk (_("rd and rm should be different in mla"));
+    as_tsktsk (_("Rd and Rm should be different in mla"));

    inst.instruction |= inst.operands[0].reg << 16;
    inst.instruction |= inst.operands[1].reg;
    inst.instruction |= inst.operands[2].reg << 8;
    inst.instruction |= inst.operands[3].reg << 12;
-
  }

  static void
@@ -7169,8 +7168,9 @@ do_mul (void)
    inst.instruction |= inst.operands[1].reg;
    inst.instruction |= inst.operands[2].reg << 8;

-  if (inst.operands[0].reg == inst.operands[1].reg)
-    as_tsktsk (_("rd and rm should be different in mul"));
+  if (inst.operands[0].reg == inst.operands[1].reg
+      && !ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6))
+    as_tsktsk (_("Rd and Rm should be different in mul"));
  }

  /* Long Multiply Parser
Index: gas/testsuite/gas/arm/mul-overlap-v6.s
===================================================================
--- gas/testsuite/gas/arm/mul-overlap-v6.s
+++ gas/testsuite/gas/arm/mul-overlap-v6.s
@@ -0,0 +1,9 @@
+	.arch	armv6
+	.text
+	.align	2
+	.global	foo
+	.type	foo, %function
+foo:
+	mul	r0, r0, r0
+	mla	r0, r0, r1, r2
+	bx	lr
Index: gas/testsuite/gas/arm/mul-overlap.d
===================================================================
--- gas/testsuite/gas/arm/mul-overlap.d
+++ gas/testsuite/gas/arm/mul-overlap.d
@@ -0,0 +1,2 @@
+# name: Overlapping multiplication operands without architecture specification
+# error-output: mul-overlap.l
Index: gas/testsuite/gas/arm/mul-overlap.l
===================================================================
--- gas/testsuite/gas/arm/mul-overlap.l
+++ gas/testsuite/gas/arm/mul-overlap.l
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:6: Rd and Rm should be different in mul
+[^:]*:7: Rd and Rm should be different in mla
Index: gas/testsuite/gas/arm/mul-overlap.s
===================================================================
--- gas/testsuite/gas/arm/mul-overlap.s
+++ gas/testsuite/gas/arm/mul-overlap.s
@@ -0,0 +1,8 @@
+	.text
+	.align	2
+	.global	foo
+	.type	foo, %function
+foo:
+	mul	r0, r0, r0
+	mla	r0, r0, r1, r2
+	bx	lr
Index: gas/testsuite/gas/arm/mul-overlap-v6.d
===================================================================
--- gas/testsuite/gas/arm/mul-overlap-v6.d
+++ gas/testsuite/gas/arm/mul-overlap-v6.d
@@ -0,0 +1,9 @@
+# name: Overlapping multiplication operands for ARMv6
+# objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> e0000090 	mul	r0, r0, r0
+0[0-9a-f]+ <[^>]+> e0202190 	mla	r0, r0, r1, r2
+0[0-9a-f]+ <[^>]+> e12fff1e 	bx	lr

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

* Re: Overlapping operands in ARM mul and mla instructions
  2007-03-15 13:59 Overlapping operands in ARM mul and mla instructions Mark Shinwell
@ 2007-03-15 14:19 ` Paul Brook
  2007-03-18 16:23   ` Mark Shinwell
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Brook @ 2007-03-15 14:19 UTC (permalink / raw)
  To: binutils; +Cc: Mark Shinwell

> 2007-03-15  Mark Shinwell  <shinwell@codesourcery.com>
>
> 	gas/
> 	* config/tc-arm.c (do_mul): Don't warn about overlapping
> 	Rd and Rm operands when assembling for v6 or above.
> 	Correctly capitalize register names in the messages.
> 	(do_mlas): Likewise.  Delete spurious blank line.
>
> 	gas/testsuite/
> 	* gas/arm/mul-overlap.s: New.
> 	* gas/arm/mul-overlap.d: New.
> 	* gas/arm/mul-overlap.l: New.
> 	* gas/arm/mul-overlap-v6.s: New.
> 	* gas/arm/mul-overlap-v6.d: New.

Ok.
Please check if we already have a test for overlapping mls operands, and add 
one if not.

Paul

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

* Re: Overlapping operands in ARM mul and mla instructions
  2007-03-15 14:19 ` Paul Brook
@ 2007-03-18 16:23   ` Mark Shinwell
  2007-03-20 12:38     ` Nick Clifton
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Shinwell @ 2007-03-18 16:23 UTC (permalink / raw)
  To: Paul Brook; +Cc: binutils

Paul Brook wrote:
>> 2007-03-15  Mark Shinwell  <shinwell@codesourcery.com>
>>
>> 	gas/
>> 	* config/tc-arm.c (do_mul): Don't warn about overlapping
>> 	Rd and Rm operands when assembling for v6 or above.
>> 	Correctly capitalize register names in the messages.
>> 	(do_mlas): Likewise.  Delete spurious blank line.
>>
>> 	gas/testsuite/
>> 	* gas/arm/mul-overlap.s: New.
>> 	* gas/arm/mul-overlap.d: New.
>> 	* gas/arm/mul-overlap.l: New.
>> 	* gas/arm/mul-overlap-v6.s: New.
>> 	* gas/arm/mul-overlap-v6.d: New.
> 
> Ok.
> Please check if we already have a test for overlapping mls operands, and add 
> one if not.

Applied thus, with mls testcases.

Mark

--


2007-03-18  Mark Shinwell  <shinwell@codesourcery.com>

	gas/
	* config/tc-arm.c (do_mul): Don't warn about overlapping
	Rd and Rm operands when assembling for v6 or above.
	Correctly capitalize register names in the messages.
	(do_mlas): Likewise.  Delete spurious blank line.

	gas/testsuite/
	* gas/arm/mul-overlap.s: New.
	* gas/arm/mul-overlap.d: New.
	* gas/arm/mul-overlap.l: New.
	* gas/arm/mul-overlap-v6.s: New.
	* gas/arm/mul-overlap-v6.d: New.


Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.314
diff -r1.314 tc-arm.c
7054,7055c7054
<   /* This restriction does not apply to mls (nor to mla in v6, but
<      that's hard to detect at present).        */
---
 >   /* This restriction does not apply to mls (nor to mla in v6 or later).  */
7056a7056
 >       && !ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6)
7058c7058
<     as_tsktsk (_("rd and rm should be different in mla"));
---
 >     as_tsktsk (_("Rd and Rm should be different in mla"));
7064d7063
<
7172,7173c7171,7173
<   if (inst.operands[0].reg == inst.operands[1].reg)
<     as_tsktsk (_("rd and rm should be different in mul"));
---
 >   if (inst.operands[0].reg == inst.operands[1].reg
 >       && !ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v6))
 >     as_tsktsk (_("Rd and Rm should be different in mul"));
cvs diff: Diffing gas/doc
cvs diff: Diffing gas/po
cvs diff: Diffing gas/testsuite
cvs diff: Diffing gas/testsuite/config
cvs diff: Diffing gas/testsuite/gas
cvs diff: Diffing gas/testsuite/gas/all
cvs diff: Diffing gas/testsuite/gas/alpha
cvs diff: Diffing gas/testsuite/gas/arc
cvs diff: Diffing gas/testsuite/gas/arm
Index: gas/testsuite/gas/arm/mul-overlap-v6.d
===================================================================
RCS file: gas/testsuite/gas/arm/mul-overlap-v6.d
diff -N gas/testsuite/gas/arm/mul-overlap-v6.d
0a1,10
 > # name: Overlapping multiplication operands for ARMv6
 > # objdump: -dr --prefix-addresses --show-raw-insn
 >
 > .*: +file format .*arm.*
 >
 > Disassembly of section .text:
 > 0[0-9a-f]+ <[^>]+> e0000090   mul     r0, r0, r0
 > 0[0-9a-f]+ <[^>]+> e0202190   mla     r0, r0, r1, r2
 > 0[0-9a-f]+ <[^>]+> e0602190   mls     r0, r0, r1, r2
 > 0[0-9a-f]+ <[^>]+> e12fff1e   bx      lr
Index: gas/testsuite/gas/arm/mul-overlap-v6.s
===================================================================
RCS file: gas/testsuite/gas/arm/mul-overlap-v6.s
diff -N gas/testsuite/gas/arm/mul-overlap-v6.s
0a1,10
 >       .arch   armv6t2
 >       .text
 >       .align  2
 >       .global foo
 >       .type   foo, %function
 > foo:
 >       mul     r0, r0, r0
 >       mla     r0, r0, r1, r2
 >       mls     r0, r0, r1, r2
 >       bx      lr
Index: gas/testsuite/gas/arm/mul-overlap.d
===================================================================
RCS file: gas/testsuite/gas/arm/mul-overlap.d
diff -N gas/testsuite/gas/arm/mul-overlap.d
0a1,2
 > # name: Overlapping multiplication operands without architecture 
specification
 > # error-output: mul-overlap.l
Index: gas/testsuite/gas/arm/mul-overlap.l
===================================================================
RCS file: gas/testsuite/gas/arm/mul-overlap.l
diff -N gas/testsuite/gas/arm/mul-overlap.l
0a1,3
 > [^:]*: Assembler messages:
 > [^:]*:6: Rd and Rm should be different in mul
 > [^:]*:7: Rd and Rm should be different in mla
Index: gas/testsuite/gas/arm/mul-overlap.s
===================================================================
RCS file: gas/testsuite/gas/arm/mul-overlap.s
diff -N gas/testsuite/gas/arm/mul-overlap.s
0a1,9
 >       .text
 >       .align  2
 >       .global foo
 >       .type   foo, %function
 > foo:
 >       mul     r0, r0, r0
 >       mla     r0, r0, r1, r2
 >       mls     r0, r0, r1, r2
 >       bx      lr

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

* Re: Overlapping operands in ARM mul and mla instructions
  2007-03-18 16:23   ` Mark Shinwell
@ 2007-03-20 12:38     ` Nick Clifton
  2007-03-20 12:44       ` Mark Shinwell
  2007-03-20 13:02       ` Mark Shinwell
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Clifton @ 2007-03-20 12:38 UTC (permalink / raw)
  To: Mark Shinwell; +Cc: Paul Brook, binutils

Hi Mark,

>>>     gas/testsuite/
>>>     * gas/arm/mul-overlap.s: New.
>>>     * gas/arm/mul-overlap.d: New.
>>>     * gas/arm/mul-overlap.l: New.
>>>     * gas/arm/mul-overlap-v6.s: New.
>>>     * gas/arm/mul-overlap-v6.d: New.

These tests have introduced some new GAS testsuite failures for the 
arm-wince-pe and arm-epoc-pe toolchains.  Please could you investigate 
and fix them ?

Cheers
   Nick

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

* Re: Overlapping operands in ARM mul and mla instructions
  2007-03-20 12:38     ` Nick Clifton
@ 2007-03-20 12:44       ` Mark Shinwell
  2007-03-20 13:02       ` Mark Shinwell
  1 sibling, 0 replies; 7+ messages in thread
From: Mark Shinwell @ 2007-03-20 12:44 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Paul Brook, binutils

Nick Clifton wrote:
>>>>     gas/testsuite/
>>>>     * gas/arm/mul-overlap.s: New.
>>>>     * gas/arm/mul-overlap.d: New.
>>>>     * gas/arm/mul-overlap.l: New.
>>>>     * gas/arm/mul-overlap-v6.s: New.
>>>>     * gas/arm/mul-overlap-v6.d: New.
> 
> These tests have introduced some new GAS testsuite failures for the 
> arm-wince-pe and arm-epoc-pe toolchains.  Please could you investigate 
> and fix them ?

Investigating.

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

* Re: Overlapping operands in ARM mul and mla instructions
  2007-03-20 12:38     ` Nick Clifton
  2007-03-20 12:44       ` Mark Shinwell
@ 2007-03-20 13:02       ` Mark Shinwell
  2007-03-20 13:06         ` Nick Clifton
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Shinwell @ 2007-03-20 13:02 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Paul Brook, binutils

Nick Clifton wrote:
>>>>     gas/testsuite/
>>>>     * gas/arm/mul-overlap.s: New.
>>>>     * gas/arm/mul-overlap.d: New.
>>>>     * gas/arm/mul-overlap.l: New.
>>>>     * gas/arm/mul-overlap-v6.s: New.
>>>>     * gas/arm/mul-overlap-v6.d: New.
> 
> These tests have introduced some new GAS testsuite failures for the 
> arm-wince-pe and arm-epoc-pe toolchains.  Please could you investigate 
> and fix them ?

I have applied the following to fix this.  Tested on arm-none-eabi,
arm-wince-pe and arm-epoc-pe.

Mark

--


2007-03-20  Mark Shinwell  <shinwell@codesourcery.com>

         * gas/arm/mul-overlap.s: Don't use %type.
         * gas/arm/mul-overlap.l: Update line numbers.
         * gas/arm/mul-overlap-v6.s: Don't use %type.


Index: gas/testsuite/gas/arm/mul-overlap-v6.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/mul-overlap-v6.s,v
retrieving revision 1.1
diff -U3 -p -r1.1 mul-overlap-v6.s
--- gas/testsuite/gas/arm/mul-overlap-v6.s      18 Mar 2007 16:21:27 -0000 
     1.1
+++ gas/testsuite/gas/arm/mul-overlap-v6.s      20 Mar 2007 12:54:57 -0000
@@ -2,7 +2,6 @@
         .text
         .align  2
         .global foo
-       .type   foo, %function
  foo:
         mul     r0, r0, r0
         mla     r0, r0, r1, r2
Index: gas/testsuite/gas/arm/mul-overlap.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/mul-overlap.l,v
retrieving revision 1.1
diff -U3 -p -r1.1 mul-overlap.l
--- gas/testsuite/gas/arm/mul-overlap.l 18 Mar 2007 16:21:27 -0000      1.1
+++ gas/testsuite/gas/arm/mul-overlap.l 20 Mar 2007 12:54:57 -0000
@@ -1,3 +1,3 @@
  [^:]*: Assembler messages:
-[^:]*:6: Rd and Rm should be different in mul
-[^:]*:7: Rd and Rm should be different in mla
+[^:]*:5: Rd and Rm should be different in mul
+[^:]*:6: Rd and Rm should be different in mla
Index: gas/testsuite/gas/arm/mul-overlap.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/mul-overlap.s,v
retrieving revision 1.1
diff -U3 -p -r1.1 mul-overlap.s
--- gas/testsuite/gas/arm/mul-overlap.s 18 Mar 2007 16:21:27 -0000      1.1
+++ gas/testsuite/gas/arm/mul-overlap.s 20 Mar 2007 12:54:57 -0000
@@ -1,7 +1,6 @@
         .text
         .align  2
         .global foo
-       .type   foo, %function
  foo:
         mul     r0, r0, r0
         mla     r0, r0, r1, r2

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

* Re: Overlapping operands in ARM mul and mla instructions
  2007-03-20 13:02       ` Mark Shinwell
@ 2007-03-20 13:06         ` Nick Clifton
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Clifton @ 2007-03-20 13:06 UTC (permalink / raw)
  To: Mark Shinwell; +Cc: Paul Brook, binutils

Hi Mark,

> 2007-03-20  Mark Shinwell  <shinwell@codesourcery.com>
> 
>         * gas/arm/mul-overlap.s: Don't use %type.
>         * gas/arm/mul-overlap.l: Update line numbers.
>         * gas/arm/mul-overlap-v6.s: Don't use %type.

Thanks for doing this.

Cheers
   Nick

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

end of thread, other threads:[~2007-03-20 13:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-15 13:59 Overlapping operands in ARM mul and mla instructions Mark Shinwell
2007-03-15 14:19 ` Paul Brook
2007-03-18 16:23   ` Mark Shinwell
2007-03-20 12:38     ` Nick Clifton
2007-03-20 12:44       ` Mark Shinwell
2007-03-20 13:02       ` Mark Shinwell
2007-03-20 13:06         ` Nick Clifton

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).