h8300.md (movsi_h8300hs): Optimize loading of several special constants.
authorKazu Hirata <kazu@hxi.com>
Wed, 29 Aug 2001 16:01:59 +0000 (16:01 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Wed, 29 Aug 2001 16:01:59 +0000 (16:01 +0000)
* h8300.md (movsi_h8300hs): Optimize loading of several
special constants.

From-SVN: r45261

gcc/ChangeLog
gcc/config/h8300/h8300.md

index 4e15d44..f245fa6 100644 (file)
@@ -1,5 +1,10 @@
 2001-08-29  Kazu Hirata  <kazu@hxi.com>
 
+       * h8300.md (movsi_h8300hs): Optimize loading of several
+       special constants.
+
+2001-08-29  Kazu Hirata  <kazu@hxi.com>
+
        * config/h8300/lib1funcs.asm: Fix comment typos.
 
 2001-08-29  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
index c93a6eb..216524e 100644 (file)
              return \"sub.l\\t%S0,%S0\;add.b\\t%1,%x0\";
            }
 
-         /* Now look for small negative numbers.  We can subtract them
-            from zero to get the desired constant.  */
-         if (val == -4 || val == -2 || val == -1)
+         /* Look for constants that can be obtained by subs, inc, and
+             dec to 0.  */
+         switch (val)
            {
-             operands[1] = GEN_INT (-INTVAL (operands[1]));
-             return \"sub.l\\t%S0,%S0\;subs\\t%1,%S0\";
+           case 0xffffffff:
+             return \"sub.l\\t%S0,%S0\;subs\\t#1,%S0\";
+           case 0xfffffffe:
+             return \"sub.l\\t%S0,%S0\;subs\\t#2,%S0\";
+           case 0xfffffffc:
+             return \"sub.l\\t%S0,%S0\;subs\\t#4,%S0\";
+
+           case 0x0000ffff:
+             return \"sub.l\\t%S0,%S0\;dec.w\\t#1,%f0\";
+           case 0x0000fffe:
+             return \"sub.l\\t%S0,%S0\;dec.w\\t#2,%f0\";
+
+           case 0xffff0000:
+             return \"sub.l\\t%S0,%S0\;dec.w\\t#1,%e0\";
+           case 0xfffe0000:
+             return \"sub.l\\t%S0,%S0\;dec.w\\t#2,%e0\";
+
+           case 0x00010000:
+             return \"sub.l\\t%S0,%S0\;inc.w\\t#1,%e0\";
+           case 0x00020000:
+             return \"sub.l\\t%S0,%S0\;inc.w\\t#2,%e0\";
            }
        }
     }