h8300.md (movsi_h8300hs): Optimize loading of several special constants.
[gcc.git] / gcc / config / h8300 / h8300.md
index c93a6ebd53dfe7c898643e8f33a70f58f873d3a8..216524ec070f277cf6a2283893e5f51079931289 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\";
            }
        }
     }