[arm] Thumb mul assembly

Paul Brook paul@codesourcery.com
Tue Apr 26 18:22:00 GMT 2005


The thumb mul instruction takes two operands:
  mul rd, rm
Technically the three-operand form of this instruction would be
  mul rd, rm, rd
not
  mul rd, rd, rm

While these are the same on recent arm architectures, the latter is undefined 
on earlier architecture revisions. Unfortunately GAS only allows the first 
three-argument form in thumb mode, which is inconsistent with arm mode.

The patch below changes gcc to generate the two argument form 

Paul

2005-04-26  Paul Brook  <paul@codesourcery.com>

	* config/arm/arm.md (thumb_mulsi3): Use two-operand assembly form.

Index: gcc/config/arm/arm.md
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/arm.md,v
retrieving revision 1.145.2.31
diff -u -p -r1.145.2.31 arm.md
--- gcc/config/arm/arm.md	28 Mar 2005 19:04:37 -0000	1.145.2.31
+++ gcc/config/arm/arm.md	26 Apr 2005 16:32:44 -0000
@@ -1080,9 +1080,9 @@
   "TARGET_THUMB"
   "*
   if (which_alternative < 2)
-    return \"mov\\t%0, %1\;mul\\t%0, %0, %2\";
+    return \"mov\\t%0, %1\;mul\\t%0, %2\";
   else
-    return \"mul\\t%0, %0, %2\";
+    return \"mul\\t%0, %2\";
   "
   [(set_attr "length" "4,4,2")
    (set_attr "insn" "mul")]



More information about the Gcc-patches mailing list