diff mbox

[12/28] mn10300: Re-write move patterns.

Message ID 4D35E1CB.2040703@redhat.com
State New
Headers show

Commit Message

Richard Henderson Jan. 18, 2011, 6:54 p.m. UTC
On 01/18/2011 09:02 AM, Jeff Law wrote:
> It also looks like you lost the movu am33 variant for movqi/movhi.  I
> don't recall anything about that alternative, but I can hazard a guess
> that movu is smaller than the more generic mov instruction for certain
> constants.

I propose the following incremental patch, with commentary.


r~

Comments

Jeff Law Jan. 19, 2011, 3:32 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/18/11 11:54, Richard Henderson wrote:
> On 01/18/2011 09:02 AM, Jeff Law wrote:
>> It also looks like you lost the movu am33 variant for movqi/movhi.  I
>> don't recall anything about that alternative, but I can hazard a guess
>> that movu is smaller than the more generic mov instruction for certain
>> constants.
> 
> I propose the following incremental patch, with commentary.
OK.
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNNwP6AAoJEBRtltQi2kC7YeAIAJlTlM9nco/gaaorKhVt3mD6
HVv0txu1KwKU4qLcej0QM6VFIwZCcyRpu+FQh59P3e2UT9nkFpJZht7f1XOJOJNY
iP1SiNxdXUnqmlg/jkOjertHiaMRQFhC2AQeT/4fYorrP9RoBoRM1esK+Q9C/mYV
cVV1fRXfwyLrkuP4ghBqbphgjQ9Aq3biIKUj9j8UCQwHhjctL3vREJhk5W+/5mcz
iSKN9GKzKq2P74OOBCT/VM5AMn8+S72+OmKRwB5dHhWdhrdyPaiw/2IOckPRXm4I
pnXSlHEUwYWhRV+gvIRs5EQAp3W3VBd7qeSmNaM9dVMOfsMX1mrX1cZIImRaIy8=
=Ve1G
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md
index 680d55e..aee5eb7 100644
--- a/gcc/config/mn10300/mn10300.md
+++ b/gcc/config/mn10300/mn10300.md
@@ -253,9 +253,13 @@ 
     case 0:
       return "";
     case 1:
+      /* Note that "MOV imm8,An" is already zero-extending, and is 2 bytes.
+	 We have "MOV imm16,Dn" at 3 bytes.  The only win for the 4 byte
+	 movu is for an 8-bit unsigned move into Rn.  */
       if (TARGET_AM33
 	  && CONST_INT_P (operands[1])
-	  && IN_RANGE (INTVAL (operands[1]), 0x80, 0xff))
+	  && IN_RANGE (INTVAL (operands[1]), 0x80, 0xff)
+	  && REGNO_EXTENDED_P (REGNO (operands[0])))
 	return "movu %1,%0";
       /* FALLTHRU */
     case 2:
@@ -386,7 +390,12 @@ 
     case 0:
       return "";
     case 1: /* imm-reg*/
-      if (TARGET_AM33 && CONST_INT_P (operands[1]))
+      /* See movhi for a discussion of sizes for 8-bit movu.  Note that the
+	 24-bit movu is 6 bytes, which is the same size as the full 32-bit
+	 mov form for An and Dn.  So again movu is only a win for Rn.  */
+      if (TARGET_AM33
+	  && CONST_INT_P (operands[1])
+	  && REGNO_EXTENDED_P (REGNO (operands[0])))
 	{
 	  HOST_WIDE_INT val = INTVAL (operands[1]);
 	  if (IN_RANGE (val, 0x80, 0xff)