From: Joseph Myers Date: Sun, 2 May 1999 15:17:32 +0000 (-0700) Subject: Joseph S. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af36a4d251dc01522e818b18e61e7bd289419654;p=gcc.git Joseph S. Joseph S. Myers * pdp11.h (TARGET_SWITCHES): Fix error in previous change. (ASSEMBLER_DIALECT): Define. (CONDITIONAL_REGISTER_USAGE): Rename floating point registers if required for the UNIX assembler. (ASM_OUTPUT_INT): Remove. The compiler will synthesise it. (ASM_OUTPUT_ADDR_VEC_PROLOGUE): Remove. (ASM_OPEN_PAREN, ASM_CLOSE_PAREN): Change to "[" and "]". (TRAMPOLINE_TEMPLATE): Use ASM_OUTPUT_SHORT. * pdp11.c (output_addr_const_pdp11): Copy of output_addr_const adapted to output constants in octal. * pdp11.c, pdp11.h, pdp11.md: Use output_addr_const_pdp11 instead of output_addr_const. Output constants in octal. Use assembler dialect alternatives where DEC and UNIX assemblers use different instruction names. From-SVN: r26732 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0eb80f3d216..c6c4125dbf8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +Sun May 2 15:16:42 1999 Joseph S. Myers + + * pdp11.h (TARGET_SWITCHES): Fix error in previous change. + (ASSEMBLER_DIALECT): Define. + (CONDITIONAL_REGISTER_USAGE): Rename floating point registers if + required for the UNIX assembler. + (ASM_OUTPUT_INT): Remove. The compiler will synthesise it. + (ASM_OUTPUT_ADDR_VEC_PROLOGUE): Remove. + (ASM_OPEN_PAREN, ASM_CLOSE_PAREN): Change to "[" and "]". + (TRAMPOLINE_TEMPLATE): Use ASM_OUTPUT_SHORT. + * pdp11.c (output_addr_const_pdp11): Copy of output_addr_const + adapted to output constants in octal. + * pdp11.c, pdp11.h, pdp11.md: Use output_addr_const_pdp11 instead + of output_addr_const. Output constants in octal. Use assembler + dialect alternatives where DEC and UNIX assemblers use different + instruction names. + Sun May 2 01:15:06 PDT 1999 Jeff Law (law@cygnus.com) * version.c: Bump for snapshot. diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index d4e00f4503d..2202d4b0e51 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -126,7 +126,7 @@ output_function_prologue(stream, size) /* make frame */ if (fsize) - fprintf (stream, "\tsub $%d, sp\n", fsize); + fprintf (stream, "\tsub $%o, sp\n", fsize); /* save CPU registers */ for (regno = 0; regno < 8; regno++) @@ -213,7 +213,7 @@ output_function_epilogue(stream, size) for (i =7 ; i >= 0 ; i--) if (regs_ever_live[i] && ! call_used_regs[i]) - fprintf(stream, "\tmov %d(fp), %s\n",-fsize-2*j--, reg_names[i]); + fprintf(stream, "\tmov %o(fp), %s\n",-fsize-2*j--, reg_names[i]); /* get ACs */ via_ac = FIRST_PSEUDO_REGISTER -1; @@ -231,7 +231,7 @@ output_function_epilogue(stream, size) && regs_ever_live[i] && ! call_used_regs[i]) { - fprintf(stream, "\tfldd %d(fp), %s\n", -fsize-k, reg_names[i]); + fprintf(stream, "\tfldd %o(fp), %s\n", -fsize-k, reg_names[i]); k -= 8; } @@ -242,7 +242,7 @@ output_function_epilogue(stream, size) if (! LOAD_FPU_REG_P(via_ac)) abort(); - fprintf(stream, "\tfldd %d(fp), %s\n", -fsize-k, reg_names[via_ac]); + fprintf(stream, "\tfldd %o(fp), %s\n", -fsize-k, reg_names[via_ac]); fprintf(stream, "\tfstd %s, %s\n", reg_names[via_ac], reg_names[i]); k -= 8; } @@ -284,7 +284,7 @@ output_function_epilogue(stream, size) fprintf(stream, "\tmov (sp)+, %s\n", reg_names[i]); if (fsize) - fprintf((stream), "\tadd $%d, sp\n", fsize); + fprintf((stream), "\tadd $%o, sp\n", fsize); } fprintf (stream, "\trts pc\n"); @@ -557,14 +557,14 @@ output_move_quad (operands) u.i[1] = CONST_DOUBLE_HIGH (operands[1]); if (u.d == 0.0) - return "clrd %0"; + return "{clrd|clrf} %0"; } - return "ldd %1, %0"; + return "{ldd|movf} %1, %0"; } if (FPU_REG_P(REGNO(operands[1]))) - return "std %1, %0"; + return "{std|movf} %1, %0"; } /* If one operand is decrementing and one is incrementing @@ -883,7 +883,7 @@ print_operand_address (file, addr) break; default: - output_addr_const (file, addr); + output_addr_const_pdp11 (file, addr); } } @@ -1410,3 +1410,114 @@ legitimate_address_p (mode, address) /* #undef REG_OK_STRICT */ } + +/* A copy of output_addr_const modified for pdp11 expression syntax. + output_addr_const also gets called for %cDIGIT and %nDIGIT, which we don't + use, and for debugging output, which we don't support with this port either. + So this copy should get called whenever needed. +*/ +void +output_addr_const_pdp11 (file, x) + FILE *file; + rtx x; +{ + char buf[256]; + + restart: + switch (GET_CODE (x)) + { + case PC: + if (flag_pic) + putc ('.', file); + else + abort (); + break; + + case SYMBOL_REF: + assemble_name (file, XSTR (x, 0)); + break; + + case LABEL_REF: + ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (XEXP (x, 0))); + assemble_name (file, buf); + break; + + case CODE_LABEL: + ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x)); + assemble_name (file, buf); + break; + + case CONST_INT: + /* Should we check for constants which are too big? Maybe cutting + them off to 16 bits is OK? */ + fprintf (file, "%ho", (unsigned short) INTVAL (x)); + break; + + case CONST: + /* This used to output parentheses around the expression, + but that does not work on the 386 (either ATT or BSD assembler). */ + output_addr_const_pdp11 (file, XEXP (x, 0)); + break; + + case CONST_DOUBLE: + if (GET_MODE (x) == VOIDmode) + { + /* We can use %o if the number is one word and positive. */ + if (CONST_DOUBLE_HIGH (x)) + abort (); /* Should we just silently drop the high part? */ + else + fprintf (file, "%ho", (unsigned short) CONST_DOUBLE_LOW (x)); + } + else + /* We can't handle floating point constants; + PRINT_OPERAND must handle them. */ + output_operand_lossage ("floating constant misused"); + break; + + case PLUS: + /* Some assemblers need integer constants to appear last (eg masm). */ + if (GET_CODE (XEXP (x, 0)) == CONST_INT) + { + output_addr_const_pdp11 (file, XEXP (x, 1)); + if (INTVAL (XEXP (x, 0)) >= 0) + fprintf (file, "+"); + output_addr_const_pdp11 (file, XEXP (x, 0)); + } + else + { + output_addr_const_pdp11 (file, XEXP (x, 0)); + if (INTVAL (XEXP (x, 1)) >= 0) + fprintf (file, "+"); + output_addr_const_pdp11 (file, XEXP (x, 1)); + } + break; + + case MINUS: + /* Avoid outputting things like x-x or x+5-x, + since some assemblers can't handle that. */ + x = simplify_subtraction (x); + if (GET_CODE (x) != MINUS) + goto restart; + + output_addr_const_pdp11 (file, XEXP (x, 0)); + fprintf (file, "-"); + if (GET_CODE (XEXP (x, 1)) == CONST_INT + && INTVAL (XEXP (x, 1)) < 0) + { + fprintf (file, ASM_OPEN_PAREN); + output_addr_const_pdp11 (file, XEXP (x, 1)); + fprintf (file, ASM_CLOSE_PAREN); + } + else + output_addr_const_pdp11 (file, XEXP (x, 1)); + break; + + case ZERO_EXTEND: + case SIGN_EXTEND: + output_addr_const_pdp11 (file, XEXP (x, 0)); + break; + + default: + output_operand_lossage ("invalid expression as operand"); + } +} diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index c61334a5ead..0822782db58 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -26,6 +26,7 @@ int const_immediate_operand (); int expand_shift_operand (); int legitimate_address_p (); void notice_update_cc_on_set (); +void output_addr_const_pdp11 (); void output_ascii (); void output_function_epilogue (); void output_function_prologue (); @@ -106,7 +107,7 @@ extern int target_flags; { "no-split", -1024, "Target does not have split I&D" }, \ /* UNIX assembler syntax? */ \ { "unix-asm", 2048, "Use UNIX assembler syntax" }, \ - { "dec-asm", 2048, "Use DEC assembler syntax" }, \ + { "dec-asm", -2048, "Use DEC assembler syntax" }, \ /* default */ \ { "", TARGET_DEFAULT, NULL} \ } @@ -142,6 +143,8 @@ extern int target_flags; #define TARGET_UNIX_ASM (target_flags & 2048) #define TARGET_UNIX_ASM_DEFAULT 0 +#define ASSEMBLER_DIALECT (TARGET_UNIX_ASM ? 1 : 0) + /* TYPE SIZES */ @@ -272,7 +275,8 @@ extern int target_flags; /* Make sure everything's fine if we *don't* have an FPU. This assumes that putting a register in fixed_regs will keep the compiler's mitts completely off it. We don't bother to zero it out - of register classes. + of register classes. Also fix incompatible register naming with + the UNIX assembler. */ #define CONDITIONAL_REGISTER_USAGE \ { \ @@ -288,6 +292,16 @@ extern int target_flags; \ if (TARGET_AC0) \ call_used_regs[8] = 1; \ + if (TARGET_UNIX_ASM) \ + { \ + /* Change names of FPU registers for the UNIX assembler. */ \ + reg_names[8] = "fr0"; \ + reg_names[9] = "fr1"; \ + reg_names[10] = "fr2"; \ + reg_names[11] = "fr3"; \ + reg_names[12] = "fr4"; \ + reg_names[13] = "fr5"; \ + } \ } /* Return number of consecutive hard regs needed starting at reg REGNO @@ -1124,44 +1138,32 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \ #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ fprintf (FILE, "\tfloat %.12e\n", (VALUE)) -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - /* Likewise for `short' and `char' constants. */ #define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t.word "), \ - output_addr_const (FILE, (VALUE)), \ +( fprintf (FILE, TARGET_UNIX_ASM ? "\t" : "\t.word "), \ + output_addr_const_pdp11 (FILE, (VALUE)), \ fprintf (FILE, " /*short*/\n")) #define ASM_OUTPUT_CHAR(FILE,VALUE) \ ( fprintf (FILE, "\t.byte "), \ - output_addr_const (FILE, (VALUE)), \ + output_addr_const_pdp11 (FILE, (VALUE)), \ fprintf (FILE, " /* char */\n")) -/* This is how to output an assembler line for a numeric constant byte.- - - do we really NEED it ? let's output it with a comment and grep the - assembly source ;-) +/* This is how to output an assembler line for a numeric constant byte. + This won't actually be used since we define ASM_OUTPUT_CHAR. */ #define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (VALUE)) + fprintf (FILE, "\t.byte %o\n", (VALUE)) #define ASM_OUTPUT_ASCII(FILE, P, SIZE) \ output_ascii (FILE, P, SIZE) -#define ASM_OUTPUT_ADDR_VEC_PROLOGUE(FILE, MODE, LEN) \ - fprintf (FILE, "\t/* HELP! */\n"); - /* This is how to output an element of a case-vector that is absolute. */ #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ - fprintf (FILE, "\t.word L_%d\n", VALUE) + fprintf (FILE, "\t%sL_%d\n", TARGET_UNIX_ASM ? "" : ".word ", VALUE) /* This is how to output an element of a case-vector that is relative. Don't define this if it is not supported. */ @@ -1188,7 +1190,7 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \ } #define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.=.+ %d\n", (SIZE)) + fprintf (FILE, "\t.=.+ %o\n", (SIZE)) /* This says how to output an assembler line to define a global common symbol. */ @@ -1198,7 +1200,7 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \ assemble_name ((FILE), (NAME)), \ fprintf ((FILE), "\n"), \ assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ": .=.+ %d\n", (ROUNDED)) \ + fprintf ((FILE), ": .=.+ %o\n", (ROUNDED)) \ ) /* This says how to output an assembler line @@ -1206,7 +1208,7 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \ #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ( assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ":\t.=.+ %d\n", (ROUNDED))) + fprintf ((FILE), ":\t.=.+ %o\n", (ROUNDED))) /* Store in OUTPUT a string (made with alloca) containing an assembler-name for a local static variable named NAME. @@ -1219,8 +1221,8 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \ /* Define the parentheses used to group arithmetic operations in assembler code. */ -#define ASM_OPEN_PAREN "(" -#define ASM_CLOSE_PAREN ")" +#define ASM_OPEN_PAREN "[" +#define ASM_CLOSE_PAREN "]" /* Define results of standard character escape sequences. */ #define TARGET_BELL 007 @@ -1248,7 +1250,7 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n") \ { union { double d; int i[2]; } u; \ u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \ fprintf (FILE, "#%.20e", u.d); } \ - else { putc ('$', FILE); output_addr_const (FILE, X); }} + else { putc ('$', FILE); output_addr_const_pdp11 (FILE, X); }} /* Print a memory address as an operand to reference that memory location. */ @@ -1284,10 +1286,10 @@ JMP FUNCTION 0x0058 0x0000 <- FUNCTION if (TARGET_SPLIT) \ abort(); \ \ - ASM_OUTPUT_INT (FILE, GEN_INT (0x9400+STATIC_CHAIN_REGNUM)); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ - ASM_OUTPUT_INT (FILE, GEN_INT(0x0058)); \ - ASM_OUTPUT_INT (FILE, const0_rtx); \ + ASM_OUTPUT_SHORT (FILE, GEN_INT (0x9400+STATIC_CHAIN_REGNUM)); \ + ASM_OUTPUT_SHORT (FILE, const0_rtx); \ + ASM_OUTPUT_SHORT (FILE, GEN_INT(0x0058)); \ + ASM_OUTPUT_SHORT (FILE, const0_rtx); \ } #define TRAMPOLINE_SIZE 8 diff --git a/gcc/config/pdp11/pdp11.md b/gcc/config/pdp11/pdp11.md index 1980e45e6ac..f07acefd3bd 100644 --- a/gcc/config/pdp11/pdp11.md +++ b/gcc/config/pdp11/pdp11.md @@ -1,5 +1,5 @@ ;;- Machine description for the pdp11 for GNU C compiler -;; Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc. +;; Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc. ;; Contributed by Michael K. Gschwind (mike@vlsivie.tuwien.ac.at). ;; This file is part of GNU CC. @@ -89,7 +89,7 @@ "* { cc_status.flags = CC_IN_FPU; - return \"cmpd %0, %1\;cfcc\"; + return \"{cmpd|cmpf} %0, %1\;cfcc\"; }" [(set_attr "length" "2,3,6")]) @@ -180,7 +180,7 @@ "* { cc_status.flags = CC_IN_FPU; - return \"tstd %0\;cfcc\"; + return \"{tstd|tstf} %0\;cfcc\"; }" [(set_attr "length" "2,3")]) @@ -730,16 +730,16 @@ "TARGET_FPU" "* if (which_alternative ==0) { - output_asm_insn(\"stcdf %1, -(sp)\", operands); + output_asm_insn(\"{stcdf|movfo} %1, -(sp)\", operands); output_asm_insn(\"mov (sp)+, %0\", operands); operands[0] = gen_rtx(REG, HImode, REGNO (operands[0])+1); output_asm_insn(\"mov (sp)+, %0\", operands); return \"\"; } else if (which_alternative == 1) - return \"stcdf %1, %0\"; + return \"{stcdf|movfo} %1, %0\"; else - return \"stcdf %1, %0\"; + return \"{stcdf|movfo} %1, %0\"; " [(set_attr "length" "3,1,2")]) @@ -782,9 +782,9 @@ (float_extend:DF (match_operand:SF 1 "general_operand" "r,R,Q")))] "TARGET_FPU" "@ - mov %1, -(sp)\;ldcfd (sp)+,%0 - ldcfd %1, %0 - ldcfd %1, %0" + mov %1, -(sp)\;{ldcfd|movof} (sp)+,%0 + {ldcfd|movof} %1, %0 + {ldcfd|movof} %1, %0" [(set_attr "length" "2,1,2")]) ;; does movb sign extend in register-to-register move? @@ -923,14 +923,14 @@ output_asm_insn(\"mov %1, -(sp)\", operands); output_asm_insn(\"setl\", operands); - output_asm_insn(\"ldcld (sp)+, %0\", operands); + output_asm_insn(\"{ldcld|movif} (sp)+, %0\", operands); output_asm_insn(\"seti\", operands); return \"\"; } else if (which_alternative == 1) - return \"setl\;ldcld %1, %0\;seti\"; + return \"setl\;{ldcld|movif} %1, %0\;seti\"; else - return \"setl\;ldcld %1, %0\;seti\"; + return \"setl\;{ldcld|movif} %1, %0\;seti\"; " [(set_attr "length" "5,3,4")]) @@ -938,7 +938,7 @@ [(set (match_operand:DF 0 "register_operand" "=a,a") (float:DF (match_operand:HI 1 "general_operand" "rR,Qi")))] "TARGET_FPU" - "ldcid %1, %0" + "{ldcid|movif} %1, %0" [(set_attr "length" "1,2")]) ;; cut float to int @@ -949,7 +949,7 @@ "* if (which_alternative ==0) { output_asm_insn(\"setl\", operands); - output_asm_insn(\"stcdl %1, -(sp)\", operands); + output_asm_insn(\"{stcdl|movfi} %1, -(sp)\", operands); output_asm_insn(\"seti\", operands); output_asm_insn(\"mov (sp)+, %0\", operands); operands[0] = gen_rtx(REG, HImode, REGNO (operands[0])+1); @@ -957,9 +957,9 @@ return \"\"; } else if (which_alternative == 1) - return \"setl\;stcdl %1, %0\;seti\"; + return \"setl\;{stcdl|movfi} %1, %0\;seti\"; else - return \"setl\;stcdl %1, %0\;seti\"; + return \"setl\;{stcdl|movfi} %1, %0\;seti\"; " [(set_attr "length" "5,3,4")]) @@ -967,7 +967,7 @@ [(set (match_operand:HI 0 "general_operand" "=rR,Q") (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "a,a"))))] "TARGET_FPU" - "stcdi %1, %0" + "{stcdi|movfi} %1, %0" [(set_attr "length" "1,2")]) @@ -979,7 +979,7 @@ (plus:DF (match_operand:DF 1 "register_operand" "%0,0,0") (match_operand:DF 2 "general_operand" "fR,Q,F")))] "TARGET_FPU" - "addd %2, %0" + "{addd|addf} %2, %0" [(set_attr "length" "1,2,5")]) (define_insn "addsi3" @@ -1082,7 +1082,7 @@ (minus:DF (match_operand:DF 1 "register_operand" "0,0") (match_operand:DF 2 "general_operand" "fR,Q")))] "TARGET_FPU" - "subd %2, %0" + "{subd|subf} %2, %0" [(set_attr "length" "1,2")]) (define_insn "subsi3" @@ -1560,7 +1560,7 @@ [(set (match_operand:DF 0 "general_operand" "=fR,Q") (abs:DF (match_operand:DF 1 "general_operand" "0,0")))] "TARGET_FPU" - "absd %0" + "{absd|absf} %0" [(set_attr "length" "1,2")]) (define_insn "abshi2" @@ -1624,7 +1624,7 @@ [(set (match_operand:DF 0 "general_operand" "=fR,Q") (neg:DF (match_operand:DF 1 "register_operand" "0,0")))] "TARGET_FPU" - "negd %0" + "{negd|negf} %0" [(set_attr "length" "1,2")]) (define_insn "neghi2" @@ -1712,7 +1712,7 @@ (mult:DF (match_operand:DF 1 "register_operand" "%0,0,0") (match_operand:DF 2 "general_operand" "fR,Q,F")))] "TARGET_FPU" - "muld %2, %0" + "{muld|mulf} %2, %0" [(set_attr "length" "1,2,5")]) ;; 16 bit result multiply: @@ -1764,7 +1764,7 @@ (div:DF (match_operand:DF 1 "register_operand" "0,0,0") (match_operand:DF 2 "general_operand" "fR,Q,F")))] "TARGET_FPU" - "divd %2, %0" + "{divd|divf} %2, %0" [(set_attr "length" "1,2,5")])