diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1997-01-04 08:12:13 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1997-01-04 08:12:13 -0500 |
commit | 7bc88d49332000c62fd7793d4cbc1718462c078d (patch) | |
tree | 6f44587a9c40e9508ad889e0b7c55cb3c55fb7b1 | |
parent | fe1590618e122673f416ef98a14b0f5281ccd4b4 (diff) | |
download | gcc-7bc88d49332000c62fd7793d4cbc1718462c078d.zip gcc-7bc88d49332000c62fd7793d4cbc1718462c078d.tar.gz gcc-7bc88d49332000c62fd7793d4cbc1718462c078d.tar.bz2 |
(output_function_{pro,epi}logue): Use addq/subq when adjusting stack
pointer by small displacements.
From-SVN: r13366
-rw-r--r-- | gcc/config/m68k/m68k.c | 94 |
1 files changed, 83 insertions, 11 deletions
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index c671c59..029e89c 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -1,5 +1,5 @@ /* Subroutines for insn-output.c for Motorola 68000 family. - Copyright (C) 1987, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1987, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GNU CC. @@ -211,19 +211,47 @@ output_function_prologue (stream, size) } else if (fsize) { - /* Adding negative number is faster on the 68040. */ if (fsize + 4 < 0x8000) { - if (!TARGET_68040) +#ifdef NO_ADDSUB_Q + if (fsize + 4 <= 8) { + if (!TARGET_5200) + { + /* asm_fprintf() cannot handle %. */ #ifdef MOTOROLA - asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", - (fsize + 4)); + asm_fprintf (stream, "\tsubq.w %OI%d,%Rsp\n", fsize + 4); #else - asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", - (fsize + 4)); + asm_fprintf (stream, "\tsubqw %OI%d,%Rsp\n", fsize + 4); +#endif + } + else + { +#ifdef MOTOROLA + asm_fprintf (stream, "\tsubq.l %OI%d,%Rsp\n", fsize + 4); +#else + asm_fprintf (stream, "\tsubql %OI%d,%Rsp\n", fsize + 4); #endif + } } - else + else if (fsize + 4 <= 16 && TARGET_CPU32) + { + /* On the CPU32 it is faster to use two subqw instructions to + subtract a small integer (8 < N <= 16) to a register. */ + /* asm_fprintf() cannot handle %. */ +#ifdef MOTOROLA + asm_fprintf (stream, "\tsubq.w %OI8,%Rsp\n\tsubq.w %OI%d,%Rsp\n", + fsize + 4); +#else + asm_fprintf (stream, "\tsubqw %OI8,%Rsp\n\tsubqw %OI%d,%Rsp\n", + fsize + 4); +#endif + } + else +#endif /* NO_ADDSUB_Q */ + if (TARGET_68040) { + /* Adding negative number is faster on the 68040. */ /* asm_fprintf() cannot handle %. */ #ifdef MOTOROLA asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", - (fsize + 4)); @@ -231,6 +259,15 @@ output_function_prologue (stream, size) asm_fprintf (stream, "\taddw %0I%d,%Rsp\n", - (fsize + 4)); #endif } + else + { + /* asm_fprintf() cannot handle %. */ +#ifdef MOTOROLA + asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", - (fsize + 4)); +#else + asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", - (fsize + 4)); +#endif + } } else { @@ -640,18 +677,44 @@ output_function_epilogue (stream, size) reg_names[FRAME_POINTER_REGNUM]); else if (fsize) { - if (fsize + 4 < 0x8000) +#ifdef NO_ADDSUB_Q + if (fsize + 4 <= 8) { - if (!TARGET_68040) - { + if (!TARGET_5200) + { #ifdef MOTOROLA - asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", fsize + 4); + asm_fprintf (stream, "\taddq.w %OI%d,%Rsp\n", fsize + 4); #else - asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", fsize + 4); + asm_fprintf (stream, "\taddqw %OI%d,%Rsp\n", fsize + 4); #endif } else { +#ifdef MOTOROLA + asm_fprintf (stream, "\taddq.l %OI%d,%Rsp\n", fsize + 4); +#else + asm_fprintf (stream, "\taddql %OI%d,%Rsp\n", fsize + 4); +#endif + } + } + else if (fsize + 4 <= 16 && TARGET_CPU32) + { + /* On the CPU32 it is faster to use two addqw instructions to + add a small integer (8 < N <= 16) to a register. */ +#ifdef MOTOROLA + asm_fprintf (stream, "\taddq.w %OI8,%Rsp\n\taddq.w %OI%d,%Rsp\n", + fsize + 4); +#else + asm_fprintf (stream, "\taddqw %OI8,%Rsp\n\taddqw %OI%d,%Rsp\n", + fsize + 4); +#endif + } + else +#endif /* NO_ADDSUB_Q */ + if (fsize + 4 < 0x8000) + { + if (TARGET_68040) + { /* asm_fprintf() cannot handle %. */ #ifdef MOTOROLA asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", fsize + 4); @@ -659,6 +722,15 @@ output_function_epilogue (stream, size) asm_fprintf (stream, "\taddw %0I%d,%Rsp\n", fsize + 4); #endif } + else + { + /* asm_fprintf() cannot handle %. */ +#ifdef MOTOROLA + asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", fsize + 4); +#else + asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", fsize + 4); +#endif + } } else { |