From: snoopy%sopwith@ogicse.UUCP (Snoopy)
Subject: gcc-2.1 generates bad syntax for UTek as(1) -- with fix
Reply-To: snoopy%sopwith@cse.ogi.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 13 Apr 1992 18:42:41 GMT

Problem: Gcc-2.1 does not generate correct assembly syntax for the
UTek ns32k assembler.

Systems affected: Tektronix 6100 ("Stratos") and 6200 ("Merlin") series.

Repeat-by: attempt to compile gcc-2.1

Below are suggested fixes for this problem.  Using these fixes, the
stage 2 .o files compare with the stage 3 ones.

In addition, there is now a distinction between stratos and merlin.
(Different predefines.)  The file merlin.h can go away, replaced by
tek6000.h, tek6100.h and tek6200.h (provided below).  One can now
say "./configure stratos" (expands to "ns32k-tek6100-utek" or
"./configure merlin" (expands to "ns32k-tek6200-utek").

Note:  the diffs include some mods for the Sequent Balance from the
newsgroup gnu.gcc.bug.  Only some of these are needed for UTek.

    _____
   /_____\   Snoopy
  /_______\   
    |___|    cse.ogi.edu!sopwith!snoopy
    |___|    {ares,illian,loop,parsely,qiclab,sequent,techbook}!sopwith!snoopy


RCS file: RCS/config.sub,v
Retrieving revision 1.1
diff  -c -r1.1 config.sub
*** /tmp/,RCSt1027144	Mon Apr 13 09:59:17 1992
--- config.sub	Mon Apr 13 09:51:42 1992
***************
*** 148,155
  		basic_machine=m88k-omron
  		;;
  	merlin)
! 		basic_machine=ns32k-utek
! 		os=-sysv
  		;;
  	crds | unos)
  		basic_machine=m68k-crds

--- 148,155 -----
  		basic_machine=m88k-omron
  		;;
  	merlin)
! 		basic_machine=ns32k-tek6200
! 		os=-utek
  		;;
  	stratos)
  		basic_machine=ns32k-tek6100
***************
*** 151,156
  		basic_machine=ns32k-utek
  		os=-sysv
  		;;
  	crds | unos)
  		basic_machine=m68k-crds
  		;;

--- 151,160 -----
  		basic_machine=ns32k-tek6200
  		os=-utek
  		;;
+ 	stratos)
+ 		basic_machine=ns32k-tek6100
+ 		os=-utek
+ 		;;
  	crds | unos)
  		basic_machine=m68k-crds
  		;;
***************
*** 434,440
  	      | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
  	      | -unos* | -osf* | -luna* | -dgux* | -solari* | -sym* | -amix* \
  	      | -amigados* | -msdos* | -unicos* | -aos* \
! 	      | -nindy* | -vxworks* | -ebmon* | -hds* | -m88kbcs*)
  		;;
  	-newsos*)
  		os=-bsd

--- 438,444 -----
  	      | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos* | -hpux* \
  	      | -unos* | -osf* | -luna* | -dgux* | -solari* | -sym* | -amix* \
  	      | -amigados* | -msdos* | -unicos* | -aos* \
! 	      | -nindy* | -vxworks* | -ebmon* | -hds* | -m88kbcs* | -utek*)
  		;;
  	-newsos*)
  		os=-bsd

RCS file: RCS/configure,v
Retrieving revision 1.1
diff  -c -r1.1 configure
*** /tmp/,RCSt1027150	Mon Apr 13 09:59:53 1992
--- configure	Mon Apr 13 09:51:44 1992
***************
*** 468,476
  		xmake_file=x-genix
  		tm_file=genix.h
  		;;
- 	ns32k-merlin-*)
- 		tm_file=merlin.h
- 		;;
  	ns32k-pc532-mach*)
  		tm_file=pc532-mach.h
  		;;

--- 468,473 -----
  		xmake_file=x-genix
  		tm_file=genix.h
  		;;
  	ns32k-pc532-mach*)
  		tm_file=pc532-mach.h
  		;;
***************
*** 477,482
  	ns32k-pc532-minix*)
  		tm_file=pc532-min.h
  		xm_file=xm-pc532-min.h
  		;;
  	m88k-*-luna*)
  		tm_file=m88kluna.h

--- 474,500 -----
  	ns32k-pc532-minix*)
  		tm_file=pc532-min.h
  		xm_file=xm-pc532-min.h
+ 		;;
+ 	ns32k-tek6000-*)
+ 		if [ "$NAGGED_ALREADY" != "true" ]
+ 		then
+ 			echo Using generic Tek 6000.
+ 			echo You may wish to use tek6100 or tek6200 instead.
+ 			NAGGED_ALREADY=true
+ 		fi
+ 		tm_file=tek6000.h
+ 		;;
+ 	ns32k-stratos-*)
+ 		tm_file=tek6100.h
+ 		;;
+ 	ns32k-tek6100-*)
+ 		tm_file=tek6100.h
+ 		;;
+ 	ns32k-merlin-*)
+ 		tm_file=tek6200.h
+ 		;;
+ 	ns32k-tek6200-*)
+ 		tm_file=tek6200.h
  		;;
  	m88k-*-luna*)
  		tm_file=m88kluna.h

RCS file: RCS/getopt.c,v
Retrieving revision 1.1
diff  -c -r1.1 getopt.c
*** /tmp/,RCSt1027163	Mon Apr 13 10:00:35 1992
--- getopt.c	Mon Apr 13 09:51:46 1992
***************
*** 150,155
  #ifdef	__GNU_LIBRARY__
  #include <string.h>
  #define	my_index	strchr
  #define	my_bcopy(src, dst, n)	memcpy ((dst), (src), (n))
  #else
  

--- 150,156 -----
  #ifdef	__GNU_LIBRARY__
  #include <string.h>
  #define	my_index	strchr
+ #ifdef USG
  #define	my_bcopy(src, dst, n)	memcpy ((dst), (src), (n))
  #else /* BSD */
  #define	my_bcopy(src, dst, n)	bcopy ((src), (dst), (n))
***************
*** 151,156
  #include <string.h>
  #define	my_index	strchr
  #define	my_bcopy(src, dst, n)	memcpy ((dst), (src), (n))
  #else
  
  /* Avoid depending on library functions or files

--- 152,160 -----
  #define	my_index	strchr
  #ifdef USG
  #define	my_bcopy(src, dst, n)	memcpy ((dst), (src), (n))
+ #else /* BSD */
+ #define	my_bcopy(src, dst, n)	bcopy ((src), (dst), (n))
+ #endif /* USG/BSD */
  #else
  
  /* Avoid depending on library functions or files

RCS file: RCS/protoize.c,v
Retrieving revision 1.1
diff  -c -r1.1 protoize.c
*** /tmp/,RCSt1027166	Mon Apr 13 10:04:51 1992
--- protoize.c	Mon Apr 13 09:52:04 1992
***************
*** 77,82
  extern char *sys_errlist[];
  extern char *version_string;
  
  /* Systems which are compatible only with POSIX 1003.1-1988 (but *not*
     with POSIX 1003.1-1990), e.g. Ultrix 4.2, might not have
     const qualifiers in the prototypes in the system include files.

--- 77,88 -----
  extern char *sys_errlist[];
  extern char *version_string;
  
+ #ifdef USG  /* There is probably something better than USG to check for. */
+ #define	my_memcpy(dst, src, n)	memcpy ((dst), (src), (n))
+ #else /* BSD */
+ #define	my_memcpy(dst, src, n)	bcopy ((src), (dst), (n))
+ #endif /* BSD/USG */
+ 
  /* Systems which are compatible only with POSIX 1003.1-1988 (but *not*
     with POSIX 1003.1-1990), e.g. Ultrix 4.2, might not have
     const qualifiers in the prototypes in the system include files.
***************
*** 1940,1946
  
    compile_params
      = (const char **) xmalloc (sizeof (char *) * (param_count+1));
!   memcpy (compile_params, temp_params, sizeof (char *) * param_count);
  }
  
  /* Do a recompilation for the express purpose of generating a new aux_info

--- 1946,1952 -----
  
    compile_params
      = (const char **) xmalloc (sizeof (char *) * (param_count+1));
!   my_memcpy (compile_params, temp_params, sizeof (char *) * param_count);
  }
  
  /* Do a recompilation for the express purpose of generating a new aux_info
***************
*** 2826,2832
        repl_text_base = new_buf;
        repl_text_limit = new_buf + new_size;
      }
!   memcpy (repl_write_ptr + 1, str, len);
    repl_write_ptr += len;
  }
  

--- 2832,2838 -----
        repl_text_base = new_buf;
        repl_text_limit = new_buf + new_size;
      }
!   my_memcpy (repl_write_ptr + 1, str, len);
    repl_write_ptr += len;
  }
  
***************
*** 4082,4088
  
    /* Create the cleaned up copy of the original text.  */
  
!   memcpy (new_clean_text_base, orig_text_base,
  	  (size_t) (orig_text_limit - orig_text_base));
    do_cleaning (new_clean_text_base, new_clean_text_limit);
  

--- 4088,4094 -----
  
    /* Create the cleaned up copy of the original text.  */
  
!   my_memcpy (new_clean_text_base, orig_text_base,
  	  (size_t) (orig_text_limit - orig_text_base));
    do_cleaning (new_clean_text_base, new_clean_text_limit);


RCS file: RCS/toplev.c,v
Retrieving revision 1.1
diff  -c -r1.1 toplev.c
*** /tmp/,RCSt1027215	Mon Apr 13 10:22:15 1992
--- toplev.c	Mon Apr 13 09:52:28 1992
***************
*** 2849,2854
  #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) \
  	 + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
  #ifdef PREFERRED_DEBUGGING_TYPE
  	      if (!strncmp (str, "ggdb", len))
  		write_symbols = PREFERRED_DEBUGGING_TYPE;
  #else /* no PREFERRED_DEBUGGING_TYPE */

--- 2849,2858 -----
  #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) \
  	 + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
  #ifdef PREFERRED_DEBUGGING_TYPE
+ 	/* Do we want this if() ?  If we delete the if, then
+ 	 * PREFERRED_DEBUGGING_TYPE can look at str to decide,
+ 	 * thus keeping system specific stuff in tm.h.
+ 	 */
  	      if (!strncmp (str, "ggdb", len))
  		write_symbols = PREFERRED_DEBUGGING_TYPE;
  #else /* no PREFERRED_DEBUGGING_TYPE */
***************
*** 2892,2897
  	      else if (!strncmp (str, "ggdb", len))
  		write_symbols = SDB_DEBUG;
  	      else if (!strncmp (str, "gcoff", len))
  		write_symbols = SDB_DEBUG;
  #endif /* SDB_DEBUGGING_INFO */
  #ifdef XCOFF_DEBUGGING_INFO

--- 2896,2903 -----
  	      else if (!strncmp (str, "ggdb", len))
  		write_symbols = SDB_DEBUG;
  	      else if (!strncmp (str, "gcoff", len))
+ 		write_symbols = SDB_DEBUG;
+ 	      else if (!strncmp (str, "go", len))	/* UTek uses -go */
  		write_symbols = SDB_DEBUG;
  #endif /* SDB_DEBUGGING_INFO */
  #ifdef XCOFF_DEBUGGING_INFO

RCS file: RCS/ns32k.c,v
Retrieving revision 1.1
diff  -c -r1.1 ns32k.c
*** /tmp/,RCSt1027135	Mon Apr 13 09:58:48 1992
--- ns32k.c	Mon Apr 13 09:49:02 1992
***************
*** 19,25
  
  /* Some output-actions in ns32k.md need these.  */
  #include <stdio.h>
! #include "config.h"
  #include "rtl.h"
  #include "regs.h"
  #include "hard-reg-set.h"

--- 19,25 -----
  
  /* Some output-actions in ns32k.md need these.  */
  #include <stdio.h>
! #include "config.h" /* Includes tm.h, which includes ns32k.h. */
  #include "rtl.h"
  #include "regs.h"
  #include "hard-reg-set.h"
***************
*** 30,35
  #include "output.h"
  #include "insn-attr.h"
  
  #ifdef OSF_OS
  int ns32k_num_files = 0;
  #endif

--- 30,41 -----
  #include "output.h"
  #include "insn-attr.h"
  
+ /* Make gcc -Wall happy. */
+ extern int	offsettable_memref_p ();
+ extern int	rtx_equal_p ();
+ extern void	split_double ();
+ extern int	true_regnum ();
+ 
  #ifdef OSF_OS
  int ns32k_num_files = 0;
  #endif
***************
*** 374,380
       char code;
  {
    if (code == '$')
!     PUT_IMMEDIATE_PREFIX(file);
    else if (code == '?')
      PUT_EXTERNAL_PREFIX(file);
    else if (GET_CODE (x) == REG)

--- 380,392 -----
       char code;
  {
    if (code == '$')
!     {
! #if defined (NO_IMMEDIATE_PREFIX_IF_SYMBOLIC)
!     rtx tmp = XEXP (x, 0);
!     if ( ! (GET_CODE (tmp) == SYMBOL_REF || GET_CODE (tmp) == LABEL_REF) )
! #endif
!       PUT_IMMEDIATE_PREFIX(file);
!     }
    else if (code == '?')
      PUT_EXTERNAL_PREFIX(file);
    else if (GET_CODE (x) == REG)
***************
*** 382,388
    else if (GET_CODE (x) == MEM)
      {
        rtx tmp = XEXP (x, 0);
! #ifndef PC_RELATIVE
        if (GET_CODE (tmp) == SYMBOL_REF || GET_CODE (tmp) == LABEL_REF)
  	{
  	  char *out = XSTR (tmp, 0);

--- 394,400 -----
    else if (GET_CODE (x) == MEM)
      {
        rtx tmp = XEXP (x, 0);
! #if ! (defined (PC_RELATIVE) || defined (NO_ABSOLUTE_PREFIX_IF_SYMBOLIC))
        if (GET_CODE (tmp) == SYMBOL_REF || GET_CODE (tmp) == LABEL_REF)
  	{
  	  char *out = XSTR (tmp, 0);
***************
*** 387,393
  	{
  	  char *out = XSTR (tmp, 0);
  	  if (out[0] == '*')
! 	    fprintf (file, "@%s", &out[1]);
  	  else
  	    ASM_OUTPUT_LABELREF (file, out);
  	}

--- 399,408 -----
  	{
  	  char *out = XSTR (tmp, 0);
  	  if (out[0] == '*')
! 	    {
! 	      PUT_ABSOLUTE_PREFIX(file);
! 	      fputs(&out[1], file);
! 	    }
  	  else
  	    ASM_OUTPUT_LABELREF (file, out);
  	}
***************
*** 404,410
  	  PUT_IMMEDIATE_PREFIX(file);
  #ifdef SEQUENT_ASM
  	  /* Sequent likes it's floating point constants as integers */
! 	  fprintf (file, "0Dx%08x%08x", u.i[1], u.i[0])l
  #else
  #ifdef ENCORE_ASM
  	  fprintf (file, "0f%.20e", u.d); 

--- 419,425 -----
  	  PUT_IMMEDIATE_PREFIX(file);
  #ifdef SEQUENT_ASM
  	  /* Sequent likes it's floating point constants as integers */
! 	  fprintf (file, "0Dx%08x%08x", u.i[1], u.i[0]);
  #else
  #ifdef ENCORE_ASM
  	  fprintf (file, "0f%.20e", u.d); 
***************
*** 415,421
  	}
        else
  	{ 
! 	  union { double d; int i[2]; } u;
  	  u.i[0] = CONST_DOUBLE_LOW (x); u.i[1] = CONST_DOUBLE_HIGH (x);
  	  PUT_IMMEDIATE_PREFIX(file);
  #ifdef SEQUENT_ASM

--- 430,436 -----
  	}
        else
  	{ 
! 	  union { double d; float f; int i[2]; } u;
  	  u.i[0] = CONST_DOUBLE_LOW (x); u.i[1] = CONST_DOUBLE_HIGH (x);
  	  PUT_IMMEDIATE_PREFIX(file);
  #ifdef SEQUENT_ASM
***************
*** 419,429
  	  u.i[0] = CONST_DOUBLE_LOW (x); u.i[1] = CONST_DOUBLE_HIGH (x);
  	  PUT_IMMEDIATE_PREFIX(file);
  #ifdef SEQUENT_ASM
! 	  {
! 	    union { float f; long l; } uu;
! 	    uu.f = u.d;
! 	    fprintf (file, "0Fx%08x", uu.l);
! 	  }
  #else
  	  fprintf (file, "0f%.20e", u.d); 
  #endif

--- 434,441 -----
  	  u.i[0] = CONST_DOUBLE_LOW (x); u.i[1] = CONST_DOUBLE_HIGH (x);
  	  PUT_IMMEDIATE_PREFIX(file);
  #ifdef SEQUENT_ASM
! 	  u.f = u.d;
! 	  fprintf (file, "0Fx%08x", u.i[0]);
  #else
  	  fprintf (file, "0f%.20e", u.d); 
  #endif
***************
*** 431,437
      }
    else
      {
!       PUT_IMMEDIATE_PREFIX(file);
        output_addr_const (file, x);
      }
  }

--- 443,452 -----
      }
    else
      {
! #if defined (NO_IMMEDIATE_PREFIX_IF_SYMBOLIC)
!       if ( ! (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF) )
! #endif
!         PUT_IMMEDIATE_PREFIX(file);
        output_addr_const (file, x);
      }
  }
***************
*** 445,450
     figure out how it worked.
     90-11-25 Tatu Yl|nen <ylo@cs.hut.fi> */
  
  print_operand_address (file, addr)
       register FILE *file;
       register rtx addr;

--- 460,466 -----
     figure out how it worked.
     90-11-25 Tatu Yl|nen <ylo@cs.hut.fi> */
  
+ void
  print_operand_address (file, addr)
       register FILE *file;
       register rtx addr;
***************
*** 530,535
      }
    if (! offset)
      offset = const0_rtx;
    /* now, offset, base and indexexp are set */
    if (! base)
      {

--- 546,560 -----
      }
    if (! offset)
      offset = const0_rtx;
+ #if defined (SEQUENT_ADDRESS_BUG) || defined (SEQUENT_ASM)
+   /* This is a re-implementation of the SEQUENT_ADDRESS_BUG fix.  r~ */
+   if (base && !indexexp && GET_CODE (base) == REG &&
+       REGNO_REG_CLASS (REGNO (base)) == GENERAL_REGS)
+     {
+       indexexp = base;
+       base = 0;
+     }
+ #endif SEQUENT_ADDRESS_BUG
    /* now, offset, base and indexexp are set */
    if (! base)
      {
***************
*** 533,538
    /* now, offset, base and indexexp are set */
    if (! base)
      {
  #if defined (PC_RELATIVE) || defined (NO_ABSOLUTE_PREFIX_IF_SYMBOLIC)
        if (! (GET_CODE (offset) == LABEL_REF
  	     || GET_CODE (offset) == SYMBOL_REF))

--- 558,566 -----
    /* now, offset, base and indexexp are set */
    if (! base)
      {
+ #ifdef SEQUENT_ASM
+       if (GET_CODE (offset) == CONST_INT)
+ #else
  #if defined (PC_RELATIVE) || defined (NO_ABSOLUTE_PREFIX_IF_SYMBOLIC)
        if (! (GET_CODE (offset) == LABEL_REF
  	     || GET_CODE (offset) == SYMBOL_REF))
***************
*** 537,542
        if (! (GET_CODE (offset) == LABEL_REF
  	     || GET_CODE (offset) == SYMBOL_REF))
  #endif
  	PUT_ABSOLUTE_PREFIX (file);
      }
  

--- 565,571 -----
        if (! (GET_CODE (offset) == LABEL_REF
  	     || GET_CODE (offset) == SYMBOL_REF))
  #endif
+ #endif SEQUENT_ASM
  	PUT_ABSOLUTE_PREFIX (file);
      }
  
***************
*** 546,552
        {
  	/* now we must output base.  Possible alternatives are:
  	   (rN)       (REG ...)
! 	   (sp)	(REG ...)
  	   (fp)       (REG ...)
  	   (pc)       (REG ...)  used for SYMBOL_REF and LABEL_REF, output
  	   (disp(fp)) (MEM ...)       just before possible [rX:y]

--- 575,581 -----
        {
  	/* now we must output base.  Possible alternatives are:
  	   (rN)       (REG ...)
! 	   (sp)	      (REG ...)
  	   (fp)       (REG ...)
  	   (pc)       (REG ...)  used for SYMBOL_REF and LABEL_REF, output
  	   (disp(fp)) (MEM ...)       just before possible [rX:y]
***************
*** 641,646
        if (GET_CODE (indexexp) != REG || REGNO (indexexp) >= 8)
  	abort ();
  
        fprintf (file, "[%s:%c]",
  	       reg_names[REGNO (indexexp)],
  	       scales[scale]);

--- 670,680 -----
        if (GET_CODE (indexexp) != REG || REGNO (indexexp) >= 8)
  	abort ();
  
+ #ifdef UTEK_ASM
+       fprintf (file, "[%c`%s]",
+ 	       scales[scale],
+ 	       reg_names[REGNO (indexexp)]);
+ #else
        fprintf (file, "[%s:%c]",
  	       reg_names[REGNO (indexexp)],
  	       scales[scale]);
***************
*** 644,649
        fprintf (file, "[%s:%c]",
  	       reg_names[REGNO (indexexp)],
  	       scales[scale]);
      }
  }
  

--- 678,684 -----
        fprintf (file, "[%s:%c]",
  	       reg_names[REGNO (indexexp)],
  	       scales[scale]);
+ #endif
      }
  }
  

RCS file: RCS/ns32k.h,v
Retrieving revision 1.1
diff  -c -r1.1 ns32k.h
*** /tmp/,RCSt1027153	Mon Apr 13 10:04:05 1992
--- ns32k.h	Mon Apr 13 09:49:08 1992
***************
*** 678,684
  #define TRAMPOLINE_TEMPLATE(FILE)					\
  {									\
    fprintf (FILE, "\taddr .,r2\n" );					\
!   fprintf (FILE, "\tjump @__trampoline\n" );				\
    ASM_OUTPUT_INT (FILE, const0_rtx);					\
    ASM_OUTPUT_INT (FILE, const0_rtx);					\
  }

--- 678,686 -----
  #define TRAMPOLINE_TEMPLATE(FILE)					\
  {									\
    fprintf (FILE, "\taddr .,r2\n" );					\
!   fprintf (FILE, "\tjump " );						\
!   PUT_ABSOLUTE_PREFIX(FILE);						\
!   fprintf (FILE, "__trampoline\n" );					\
    ASM_OUTPUT_INT (FILE, const0_rtx);					\
    ASM_OUTPUT_INT (FILE, const0_rtx);					\
  }

RCS file: RCS/ns32k.md,v
Retrieving revision 1.1
diff  -c -r1.1 ns32k.md
*** /tmp/,RCSt1027182	Mon Apr 13 10:18:27 1992
--- ns32k.md	Mon Apr 13 09:49:23 1992
***************
*** 2183,2189
        rtx temp = XEXP (operands[0], 0);
        if (CONSTANT_ADDRESS_P (temp))
  	{
! #ifdef GAS_SYNTAX
  	  operands[0] = temp;
  	  return \"bsr %0\";
  #else

--- 2183,2189 -----
        rtx temp = XEXP (operands[0], 0);
        if (CONSTANT_ADDRESS_P (temp))
  	{
! #if defined (GAS_SYNTAX) || defined (SEQUENT_ASM) || defined (UTEK_ASM)
  	  operands[0] = temp;
  	  return \"bsr %0\";
  #else
***************
*** 2195,2201
  #endif
  	}
        if (GET_CODE (XEXP (operands[0], 0)) == REG)
! #if defined (GNX_V3) || defined (GAS_SYNTAX)
  	return \"jsr %0\";
  #else
          return \"jsr %a0\";

--- 2195,2201 -----
  #endif
  	}
        if (GET_CODE (XEXP (operands[0], 0)) == REG)
! #if defined (GNX_V3) || defined (GAS_SYNTAX) || defined (UTEK_ASM) || defined (SEQUENT_ASM)
  	return \"jsr %0\";
  #else
          return \"jsr %a0\";
***************
*** 2202,2207
  #endif
      }
  #endif /* not JSR_ALWAYS */
    return \"jsr %0\";
  }")
  

--- 2202,2213 -----
  #endif
      }
  #endif /* not JSR_ALWAYS */
+ #ifdef UTEK_ASM
+   {					/* Is this needed at the other   */
+   rtx temp = XEXP (operands[0], 0);	/* places that jsr is generated? */
+   operands[0] = temp;
+   }
+ #endif UTEK_ASM
    return \"jsr %0\";
  }")
  
***************
*** 2218,2224
        rtx temp = XEXP (operands[1], 0);
        if (CONSTANT_ADDRESS_P (temp))
  	{
! #ifdef GAS_SYNTAX
  	  operands[1] = temp;
  	  return \"bsr %1\";
  #else

--- 2224,2230 -----
        rtx temp = XEXP (operands[1], 0);
        if (CONSTANT_ADDRESS_P (temp))
  	{
! #if defined (GAS_SYNTAX)  || defined (SEQUENT_ASM) || defined (UTEK_ASM)
  	  operands[1] = temp;
  	  return \"bsr %1\";
  #else
***************
*** 2230,2236
  #endif
  	}
        if (GET_CODE (XEXP (operands[1], 0)) == REG)
! #if defined (GNX_V3) || defined (GAS_SYNTAX)
  	return \"jsr %1\";
  #else
          return \"jsr %a1\";

--- 2236,2242 -----
  #endif
  	}
        if (GET_CODE (XEXP (operands[1], 0)) == REG)
! #if defined (GNX_V3) || defined (GAS_SYNTAX) || defined (UTEK_ASM) || defined(SEQUENT_ASM)
  	return \"jsr %1\";
  #else
          return \"jsr %a1\";


Here are diffs for INSTALL.  The files gcc.info-3 and gcc.texi need
similar updating.

RCS file: RCS/INSTALL,v
Retrieving revision 1.1
diff  -c -r1.1 INSTALL
*** /tmp/,RCSt1027129	Mon Apr 13 09:58:06 1992
--- INSTALL	Mon Apr 13 09:57:00 1992
***************
*** 114,121
            decstation, delta, encore, gmicro, hp7NN, hp8NN, hp9k2NN,
            hp9k3NN, hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230,
            magnum, merlin, miniframe, mmax, news-3600, news800, news,
!           next, pbd, pc532, pmax, ps2, risc-news, rtpc, sun2, sun386i,
!           sun386, sun3, sun4, symmetry, tower-32, tower.
  
       Remember that a machine name specifies both the cpu type and the
       company name.

--- 114,121 -----
            decstation, delta, encore, gmicro, hp7NN, hp8NN, hp9k2NN,
            hp9k3NN, hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230,
            magnum, merlin, miniframe, mmax, news-3600, news800, news,
!           next, pbd, pc532, pmax, ps2, risc-news, rtpc, stratos,
! 	  sun2, sun386i, sun386, sun3, sun4, symmetry, tower-32, tower.
  
       Remember that a machine name specifies both the cpu type and the
       company name.
***************
*** 213,222
            `alloca' and `malloc'; you must get the compiled versions of
            these from GNU Emacs.
  
!     `ns32k-utek'
!           UTEK ns32000 system ("merlin").  The C compiler that comes
!           with this system cannot compile GNU CC; contact
!           `tektronix!reed!mason' to get binaries of GNU CC for
            bootstrapping.
  
      `pyramid'

--- 213,222 -----
            `alloca' and `malloc'; you must get the compiled versions of
            these from GNU Emacs.
  
!     `ns32k-tek6[012]00-utek'
! 	  Tektronix ns32000 systems ("merlin", "stratos") running UTek.
! 	  The C compiler that comes with this system cannot compile GNU CC;
! 	  contact `tektronix!reed!mason' to get binaries of GNU CC for
            bootstrapping.
  
      `pyramid'


=======
Here are three new config files.  Merlin.h can go away.

-----  config/tek6000.h  -------
/* Definitions of target machine for GNU compiler.
   Generic Tektronix 6000 series NS32000 version.
   See tek6100.h and tek6200.h, which include this file.
   Copyright (C) 1990 Free Software Foundation, Inc.
   Created by Snoopy  (sopwith.uucp!snoopy).
   Based on work by Mark Mason (mason@reed.bitnet,
   pyramid!unify!mason@uunet.uu.net) and Keith Packard.

This file is part of GNU CC.

GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

#ifndef UTEK_ASM
#define UTEK_ASM
#endif

/* Two flags to control how addresses are printed in assembler insns.  */

#define SEQUENT_ADDRESS_BUG 1
#define SEQUENT_BASE_REGS	/* unused? */

/* The way PUT_ABSOLUTE_PREFIX in ns32k.h works, setting it to 0 will
 * turn it off.  Define ABSOLUTE_PREFIX before including ns32k.h.
 */
#define ABSOLUTE_PREFIX		0
#define IMMEDIATE_PREFIX	'$'

#include "ns32k.h"

/* Define these after ns32k.c so we will notice if gcc tries to
 * output external mode addressing.  UTek's as and ld do not support
 * external mode addressing, according to Daryl McDaniel (illian.uucp!darylm).
 * Hopefully the UTek assembler will complain if gcc feeds it this stuff.
 * They don't seem to do anything, I think that gcc is not actually
 * trying to generate external mode operands.
 */
#undef PUT_EXTERNAL_PREFIX
#define PUT_EXTERNAL_PREFIX(arg)  fprintf(arg, "  Should not be using external mode under UTek.  ")
#define EXTERNAL_PREFIX '%'

#define NO_IMMEDIATE_PREFIX_IF_SYMBOLIC

/* #define PC_RELATIVE */	/* Seems to break things. */
#define BASE_REG_NEEDED		/* Seems to fix problem where external mode
				 * syntax was being generated.
				 */

/* The sdb support does not yet work with UTek.  Need to teach gcc
 * how to create sdb type stabs as well as dbx style stabs.
 */
#define DBX_DEBUGGING_INFO
#define SDB_DEBUGGING_INFO

/* Act the same as the UTek complier: -g for dbx, -go for sdb.
 * This is used in toplev.c.
 */
#define PREFERRED_DEBUGGING_TYPE \
	((len > 1 && !strncmp(str, "go", len)) ? SDB_DEBUG : DBX_DEBUG )

/* Sequent has some changes in the format of DBX symbols.  */
#define DBX_NO_XREFS 1

/* Don't split DBX symbols into continuations.  */
#define DBX_CONTIN_LENGTH 0

#define TARGET_DEFAULT 1

/* Print subsidiary information on the compiler version in use.  */
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (ns32k, UTek syntax)");

/* These control the C++ compiler somehow.  */
#define FASCIST_ASSEMBLER
#define USE_COLLECT

/* The tek6100.h and tek6200.h files add stratos or merlin respectively. */

#define CPP_PREDEFINES_Tek6000 \
  "-Dns16000 -Dns32000 -Dns32k -Dns32016 -DUTek -DUTEK -Dbsd -DBSD"
#undef CPP_PREDEFINES
#define CPP_PREDEFINES "CPP_PREDEFINES_Tek6000"

/* This is how to align the code that follows an unconditional branch.
   Don't define it, since it confuses the assembler (we hear).  */

#undef ASM_OUTPUT_ALIGN_CODE

/* Assembler pseudo-op for shared data segment. */
#define SHARED_SECTION_ASM_OP ".shdata"

#ifdef UTEK_ASM
#undef  FUNCTION_PROLOGUE

/* This differs from the one in ns32k.h in printing a bitmask
   rather than a register list in the enter or save instruction.  */

#define FUNCTION_PROLOGUE(FILE, SIZE)     \
{ register int regno, g_regs_used = 0;				\
  int used_regs_buf[8], *bufp = used_regs_buf;			\
  int used_fregs_buf[8], *fbufp = used_fregs_buf;		\
  extern char call_used_regs[];					\
  MAIN_FUNCTION_PROLOGUE;					\
  for (regno = 0; regno < 8; regno++)				\
    if (regs_ever_live[regno]					\
	&& ! call_used_regs[regno])				\
    {								\
      *bufp++ = regno; g_regs_used++;				\
    }								\
  *bufp = -1;							\
  for (; regno < 16; regno++)					\
    if (regs_ever_live[regno] && !call_used_regs[regno]) {	\
      *fbufp++ = regno;						\
    }								\
  *fbufp = -1;							\
  bufp = used_regs_buf;						\
  if (frame_pointer_needed)					\
    fprintf (FILE, "\tenter ");					\
  else if (g_regs_used)						\
    fprintf (FILE, "\tsave ");					\
  if (frame_pointer_needed || g_regs_used)			\
    {								\
      char mask = 0;						\
      while (*bufp >= 0)					\
	mask |= 1 << *bufp++;					\
      fprintf (FILE, "$0x%x", (int) mask & 0xff);		\
    }								\
  if (frame_pointer_needed)					\
    fprintf (FILE, ",$%d\n", SIZE);				\
  else if (g_regs_used)						\
    fprintf (FILE, "\n");					\
  fbufp = used_fregs_buf;					\
  while (*fbufp >= 0)						\
    {								\
      if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1))		\
	fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8);	\
      else							\
	{							\
	  fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8);	\
	  fbufp += 2;						\
	}							\
    }								\
}

#undef  FUNCTION_EPILOGUE

/* This differs from the one in ns32k.h in printing a bitmask
   rather than a register list in the exit or restore instruction.  */

#define FUNCTION_EPILOGUE(FILE, SIZE) \
{ register int regno, g_regs_used = 0, f_regs_used = 0;		\
  int used_regs_buf[8], *bufp = used_regs_buf;			\
  int used_fregs_buf[8], *fbufp = used_fregs_buf;		\
  extern char call_used_regs[];					\
  *fbufp++ = -2;						\
  for (regno = 8; regno < 16; regno++)				\
    if (regs_ever_live[regno] && !call_used_regs[regno]) {	\
       *fbufp++ = regno; f_regs_used++;				\
    }								\
  fbufp--;							\
  for (regno = 0; regno < 8; regno++)				\
    if (regs_ever_live[regno]					\
	&& ! call_used_regs[regno])				\
    {                                                         	\
      *bufp++ = regno; g_regs_used++;				\
    }                                                         	\
  while (fbufp > used_fregs_buf)				\
    {								\
      if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1)		\
	{							\
	  fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8);	\
	  fbufp -= 2;						\
	}							\
      else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8);	\
    }								\
  if (frame_pointer_needed)					\
    fprintf (FILE, "\texit ");					\
  else if (g_regs_used)						\
    fprintf (FILE, "\trestore ");				\
  if (g_regs_used || frame_pointer_needed)			\
    {								\
      char mask = 0;						\
								\
      while (bufp > used_regs_buf)				\
	{							\
	  /* Utek assembler takes care of reversing this */	\
	  mask |= 1 << *--bufp;					\
	}							\
      fprintf (FILE, "$0x%x\n", (int) mask & 0xff);		\
    }								\
  if (current_function_pops_args)				\
    fprintf (FILE, "\tret $%d\n", current_function_pops_args);	\
  else fprintf (FILE, "\tret $0\n"); }

/* UTek needs "ret $0", not "ret 0". */
#undef  TRANSFER_FROM_TRAMPOLINE
#define TRANSFER_FROM_TRAMPOLINE	\
void					\
__transfer_from_trampoline ()		\
{					\
  asm ("___trampoline:");		\
  asm ("movd 16(r2),tos");		\
  asm ("movd 12(r2),r2");		\
  asm ("ret $0");			\
}

#endif /* UTEK_ASM */

#undef PRINT_OPERAND_ADDRESS
#define PRINT_OPERAND_ADDRESS(FILE, ADDR)  print_operand_address(FILE, ADDR)
-----  config/tek6100.h  -------
/* Definitions of target machine for GNU compiler.
   Tektronix 6100 series ("Stratos") NS32000 version.
   Copyright (C) 1990 Free Software Foundation, Inc.
   Created by Snoopy  (sopwith.uucp!snoopy).
   Based on work by Mark Mason (mason@reed.bitnet,
   pyramid!unify!mason@uunet.uu.net) and Keith Packard.

This file is part of GNU CC.

GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

#include "tek6000.h"

#ifdef __STDC__

/* Depends on cpp concatenating string literals (ANSI feature). */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES  CPP_PREDEFINES_Tek6000 " -Dstratos"

#else

#undef CPP_PREDEFINES
#define CPP_PREDEFINES \
 "-Dns32000 -Dns32k -Dns16000 -Dns32016 -DUTek -DUTEK -Dbsd -DBSD -Dstratos"

#endif
-----  config/tek6200.h  -------
/* Definitions of target machine for GNU compiler.
   Tektronix 6200 series ("Merlin") NS32000 version.
   Copyright (C) 1990 Free Software Foundation, Inc.
   Created by Snoopy  (sopwith.uucp!snoopy).
   Based on work by Mark Mason (mason@reed.bitnet,
   pyramid!unify!mason@uunet.uu.net) and Keith Packard.

This file is part of GNU CC.

GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

#include "tek6000.h"

#ifdef __STDC__

/* Depends on cpp concatenating string literals (ANSI feature). */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES  CPP_PREDEFINES_Tek6000 " -Dmerlin"

#else

#undef CPP_PREDEFINES
#define CPP_PREDEFINES \
 "-Dns32000 -Dns32k -Dns16000 -Dns32016 -DUTek -DUTEK -Dbsd -DBSD -Dmerlin"

#endif
----  The End  ----

Newsgroups: gnu.gcc.bug