diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e15d4493be..f245fa60c18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-08-29 Kazu Hirata + + * h8300.md (movsi_h8300hs): Optimize loading of several + special constants. + 2001-08-29 Kazu Hirata * config/h8300/lib1funcs.asm: Fix comment typos. diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index c93a6ebd53d..216524ec070 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -436,12 +436,31 @@ 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\"; } } }