--- gcc/config/3b1.h 2018/04/24 17:51:32 1.1.1.1 +++ gcc/config/3b1.h 2018/04/24 17:58:52 1.1.1.3 @@ -22,7 +22,6 @@ You should have received a copy of the G along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define SGS_SWAP_W /* Use swap.w rather than just plain swap */ #define SGS_SWITCH_TABLES /* Different switch table handling */ #include "hp320.h" @@ -101,6 +100,10 @@ output_file_directive ((FILE), main_inpu #define __PTR_TO_INT(P) ((int)(P)) #define __INT_TO_PTR(P) ((char *)(P)) +/* The 3b1 does not have `atexit'. */ + +#undef HAVE_ATEXIT + /* Override parts of m68k.h to fit the SGS-3b1 assembler. */ #undef TARGET_VERSION @@ -187,7 +190,7 @@ do { union { float f; long l;} tem; \ if (++sp < (LEN)) \ { if (lp > 60) \ { lp = 0; \ - fprintf ((FILE), "\n%s ", ASCII_DATA_ASM_OP); } \ + fprintf ((FILE), "\n\t%s ", ASCII_DATA_ASM_OP); } \ else \ putc (',', (FILE)); \ goto loop; } \ @@ -366,10 +369,20 @@ do { union { float f; long l;} tem; \ XVECLEN (PATTERN (TABLE), 1) + 1, (PREFIX), (NUM), \ (PREFIX), (NUM), (PREFIX), (NUM)) -/* At end of a switch table, define LD%n iff the symbol LI%n was defined. */ -#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ - if (RTX_INTEGRATED_P (TABLE)) \ - fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM)) +/* At end of a switch table, define LDnnn iff the symbol LInnn was defined. + Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)" + fails to assemble. Luckily "LDnnn(pc,d0.l*2)" produces the results + we want. This difference can be accommodated by making the assembler + define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other + string, as necessary. This is accomplished via the ASM_OUTPUT_CASE_END + macro. */ + +#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ +{ if (switch_table_difference_label_flag) \ + fprintf (FILE, "\tset LD%%%d,L%%%d-LI%%%d\n", (NUM), (NUM), (NUM)) \ + switch_table_difference_label_flag = 0; } + +int switch_table_difference_label_flag; #define ASM_OUTPUT_OPCODE(FILE, PTR) \ { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \ @@ -377,6 +390,11 @@ do { union { float f; long l;} tem; \ while (*(PTR) != ' ') \ { putc (*(PTR), (FILE)); ++(PTR); } \ fprintf ((FILE), ".w"); } \ + else if ((PTR)[0] == 's') \ + { \ + if (!strncmp ((PTR), "swap", 4)) \ + { fprintf ((FILE), "swap.w"); (PTR) += 4; } \ + } \ else if ((PTR)[0] == 'f') \ { \ if (!strncmp ((PTR), "fmove", 5)) \ @@ -388,20 +406,20 @@ do { union { float f; long l;} tem; \ else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \ && (PTR)[2] == 'v' && (PTR)[3] == 'e') \ { fprintf ((FILE), "mov"); (PTR) += 4; \ - if ((PTR)[0] == 'q' || (PTR)[0] == 'a' || \ - (PTR)[0] == 'c') (PTR)++; } \ + if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \ + || (PTR)[0] == 'c') (PTR)++; } \ /* SUB, SUBQ, SUBA, SUBI ==> SUB */ \ else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \ && (PTR)[2] == 'b') \ { fprintf ((FILE), "sub"); (PTR) += 3; \ - if ((PTR)[0] == 'q' || (PTR)[0] == 'i' || \ - (PTR)[0] == 'a') (PTR)++; } \ + if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \ + || (PTR)[0] == 'a') (PTR)++; } \ /* CMP, CMPA, CMPI, CMPM ==> CMP */ \ else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \ && (PTR)[2] == 'p') \ { fprintf ((FILE), "cmp"); (PTR) += 3; \ - if ((PTR)[0] == 'a' || (PTR)[0] == 'i' || \ - (PTR)[0] == 'm') (PTR)++; } \ + if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \ + || (PTR)[0] == 'm') (PTR)++; } \ } #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \