Subject: gcc-2.6.0 patches
To: None <leo@marco.de>
From: Julian H Stacey <Julian.H.Stacey@regent.e-technik.tu-muenchen.de>
List: port-pc532
Date: 08/24/1994 01:36:45
Matthias,
Thanks a lot for the gcc-2.6.0 patches you recently mailed me, & posted,
unfortunately the header to each diff looked really weird to me, ie:
	*** 1.1	1994/08/07 20:02:52
	--- netbsd.h	1994/08/07 20:12:58
	***************
	*** 1.1	1994/08/07 20:03:58
	--- ns32k.c	1994/08/07 10:47:08
	***************
	*** 1.1	1994/08/07 20:03:25
	--- ns32k.h	1994/08/06 11:11:39
	***************
	*** 1.1	1994/08/07 20:04:20
	--- ns32k.md	1994/08/07 07:57:43
	***************
Calling all the files the same name seemed Very Strange !
I wasn't sure how to go about applying straight off, so
I've tidied up the patch headers (content otherwise unchanged)
& checked it applies faultlessly to a gcc-2.6.0 source by:
	cd gcc-2.6.0 ;  patch -p2 < This_script

I'm Cc'ing this in hope it may make it easier for other folk to apply,
I hope that's OK by you ?
--
Julian Stacey, Vector Systems Ltd, Holz Str 27d, Munich, D-80469 Germany.
<stacey@freefall.cdrom.com>	Tel. +49 89 268616  ( TZ=GMT+1 )

CUT ========
*** /dev/null	Tue Aug 23 17:46:48 1994
--- leo@marco.de/gcc-2.6.0/README.leo@marco.de	Tue Aug 23 18:10:02 1994
***************
*** 0 ****
--- 1,10 ----
+ There are patches necessary. I did not check if gcc compiles a kernel without
+ the patches. At least you can't generate shared libs without the patches.
+ (appended to this mail).
+ 
+ I do not run the complete gcc-make in general.
+ 	./configure ns32k-pc532-netbsd
+ 	gmake CFLAGS="-O -fomit-frame-pointer" cc1
+ 	cp cc1 /usr/libexec/cc1
+ is in general all I do to test a new compiler. But I *do* stage1 - stage3
+ every time I get a new source tree. So I had no chance to see this bug :-)
*** generic/gcc-2.6.0/ChangeLog	Tue Aug 23 18:04:00 1994
--- leo@marco.de/gcc-2.6.0/ChangeLog	Tue Aug 23 18:04:42 1994
***************
*** 1,3 ****
--- 1,17 ----
+ Sun Aug  7 22:16:03 1994  Matthias Pfaller  (leo@marco.de)
+   
+ 	* ns32k.md (all patterns that use ins/inss and ext/exts):
+ 	Disallow use of these instructions when -mnobitfield is
+ 	specified.
+ 	* ns32k.h (TARGET_BITFIELD): New macro.
+ 	(TARGET_SWITCHES): Support for TARGET_BITFIELD.
+ 	* netbsd.h (TARGET_DEFAULT): Added -mnobitfield.
+ 	(CPP_PREDEFINES): Added -Dpc532.
+ 	(WCHAR_{TYPE, UNSIGNED, TYPE_SIZE}): Changed to match new definition
+ 	in NetBSD 1.0.
+ 	* ns32k.c (print_operand_address): A patch for 2.5.8 ended up at the
+ 	wrong place. Moved.
+ 
  Thu Jul 14 09:42:23 1994  Richard Kenner  (kenner@vlsi1.ultra.nyu.edu)
  
  	* Version 2.6.0 released.
*** generic/gcc-2.6.0/config/ns32k/netbsd.h	1994/08/07 20:02:52
--- leo@marco.de/gcc-2.6.0/config/ns32k/netbsd.h	1994/08/07 20:12:58
***************
*** 23,31 ****
  #include "ns32k/ns32k.h"
  
  /* Compile for the floating point unit & 32532 by default;
!    Don't assume SB is zero */
  
! #define TARGET_DEFAULT 57
  
  /* 32-bit alignment for efficiency */
  
--- 23,32 ----
  #include "ns32k/ns32k.h"
  
  /* Compile for the floating point unit & 32532 by default;
!    Don't assume SB is zero;
!    Don't use bitfield instructions; */
  
! #define TARGET_DEFAULT 121
  
  /* 32-bit alignment for efficiency */
  
***************
*** 68,74 ****
  /* Names to predefine in the preprocessor for this target machine.  */
  
  #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "-Dns32k -Dns32000 -Dns32532 -D__NetBSD__ -Dunix"
  
  /* Specify -k to assembler for pic generation. PIC needs -K too. */
  
--- 69,75 ----
  /* Names to predefine in the preprocessor for this target machine.  */
  
  #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "-Dns32k -Dns32000 -Dns32532 -D__NetBSD__ -Dunix -Dpc532"
  
  /* Specify -k to assembler for pic generation. PIC needs -K too. */
  
***************
*** 93,104 ****
  #define PTRDIFF_TYPE "int"
  
  #undef WCHAR_TYPE
! #define WCHAR_TYPE	"short unsigned int"
  
! #define WCHAR_UNSIGNED	1
  
  #undef WCHAR_TYPE_SIZE
! #define WCHAR_TYPE_SIZE	16
  
  /* This is BSD, so it wants DBX format.  */
  
--- 94,105 ----
  #define PTRDIFF_TYPE "int"
  
  #undef WCHAR_TYPE
! #define WCHAR_TYPE	"int"
  
! #define WCHAR_UNSIGNED	0
  
  #undef WCHAR_TYPE_SIZE
! #define WCHAR_TYPE_SIZE	32
  
  /* This is BSD, so it wants DBX format.  */
  
*** generic/gcc-2.6.0/config/ns32k/ns32k.c	1994/08/07 20:03:58
--- leo@marco.de/gcc-2.6.0/config/ns32k/ns32k.c	1994/08/07 10:47:08
***************
*** 767,772 ****
--- 767,791 ----
  	if (base)
  	  fprintf (file, "(%s)", reg_names[REGNO (base)]);
  #ifdef BASE_REG_NEEDED
+ 	else if (TARGET_SB)
+ 	  fprintf (file, "(sb)");
+ 	else
+ 	  abort ();
+ #endif
+ 	fprintf (file, ")");
+ 	break;
+ 
+       default:
+ 	abort ();
+       }
+ #ifdef PC_RELATIVE
+   else if (GET_CODE (offset) == LABEL_REF
+ 	   || GET_CODE (offset) == SYMBOL_REF
+ 	   || GET_CODE (offset) == CONST
+ 	   || GET_CODE (offset) == PLUS)
+     fprintf (file, "(pc)");
+ #endif
+ #ifdef BASE_REG_NEEDED
    else 
      {
        /* Abs. addresses don't need a base (I think). */
***************
*** 785,810 ****
  	    abort ();
          }
      }
- #endif
- 	fprintf (file, ")");
- 	break;
- 
-       default:
- 	abort ();
-       }
- #ifdef PC_RELATIVE
-   else if (GET_CODE (offset) == LABEL_REF
- 	   || GET_CODE (offset) == SYMBOL_REF
- 	   || GET_CODE (offset) == CONST
- 	   || GET_CODE (offset) == PLUS)
-     fprintf (file, "(pc)");
- #endif
- #ifdef BASE_REG_NEEDED		/* this is defined if the assembler always
- 			   	   needs a base register */
-     else if (TARGET_SB)
-       fprintf (file, "(sb)");
-     else
-       abort ();
  #endif
    /* now print index if we have one */
    if (indexexp)
--- 804,809 ----
*** generic/gcc-2.6.0/config/ns32k/ns32k.h	1994/08/07 20:03:25
--- leo@marco.de/gcc-2.6.0/config/ns32k/ns32k.h	1994/08/06 11:11:39
***************
*** 82,87 ****
--- 82,90 ----
  /* Ok to use the static base register (and presume it's 0) */
  #define TARGET_SB    ((target_flags & 32) == 0)
  
+ /* Compile using bitfield insns.  */
+ #define TARGET_BITFIELD ((target_flags & 64) == 0)
+ 
  /* Macro to define tables used to set the flags.
     This is a list in braces of pairs in braces,
     each pair being { "NAME", VALUE }
***************
*** 101,106 ****
--- 104,111 ----
      { "32032", -24},				\
      { "sb", -32},				\
      { "nosb", 32},				\
+     { "bitfield", -64},				\
+     { "nobitfield", 64},			\
      { "", TARGET_DEFAULT}}
  /* TARGET_DEFAULT is defined in encore.h, pc532.h, etc.  */
  
*** generic/gcc-2.6.0/config/ns32k/ns32k.md	1994/08/07 20:04:20
--- leo@marco.de/gcc-2.6.0/config/ns32k/ns32k.md	1994/08/07 07:57:43
***************
*** 1861,1867 ****
      return \"adjspb %$-4\";
  }")
  
! ;; The extsd/extd isntructions have the problem that they always access
  ;; 32 bits even if the bitfield is smaller. For example the instruction
  ;; 	extsd 7(r1),r0,2,5
  ;; would read not only at address 7(r1) but also at 8(r1) to 10(r1).
--- 1861,1867 ----
      return \"adjspb %$-4\";
  }")
  
! ;; The exts/ext instructions have the problem that they always access
  ;; 32 bits even if the bitfield is smaller. For example the instruction
  ;; 	extsd 7(r1),r0,2,5
  ;; would read not only at address 7(r1) but also at 8(r1) to 10(r1).
***************
*** 1876,1889 ****
  ;;	extsd	7(r1),r0,2,5	5 bytes
  ;; takes about 21 cycles.
  ;;
! ;; So lets forget about extsd/extd on the 532.
  
  (define_insn ""
    [(set (match_operand:SI 0 "general_operand" "=g<")
  	(zero_extract:SI (match_operand:SI 1 "register_operand" "g")
  			 (match_operand:SI 2 "const_int_operand" "i")
  			 (match_operand:SI 3 "general_operand" "rK")))]
!   "! TARGET_32532"
    "*
  { if (GET_CODE (operands[3]) == CONST_INT)
      return \"extsd %1,%0,%3,%2\";
--- 1876,1892 ----
  ;;	extsd	7(r1),r0,2,5	5 bytes
  ;; takes about 21 cycles.
  ;;
! ;; The inss/ins instructions suffer from the same problem.
! ;;
! ;; A machine specific option (-mbitfield/-mnobitfield) is used
! ;; to allow/disallow the use of these instructions.
  
  (define_insn ""
    [(set (match_operand:SI 0 "general_operand" "=g<")
  	(zero_extract:SI (match_operand:SI 1 "register_operand" "g")
  			 (match_operand:SI 2 "const_int_operand" "i")
  			 (match_operand:SI 3 "general_operand" "rK")))]
!   "TARGET_BITFIELD"
    "*
  { if (GET_CODE (operands[3]) == CONST_INT)
      return \"extsd %1,%0,%3,%2\";
***************
*** 1895,1901 ****
  	(zero_extract:SI (match_operand:QI 1 "general_operand" "g")
  			 (match_operand:SI 2 "const_int_operand" "i")
  			 (match_operand:SI 3 "general_operand" "rK")))]
!   "! TARGET_32532"
    "*
  { if (GET_CODE (operands[3]) == CONST_INT)
      return \"extsd %1,%0,%3,%2\";
--- 1898,1904 ----
  	(zero_extract:SI (match_operand:QI 1 "general_operand" "g")
  			 (match_operand:SI 2 "const_int_operand" "i")
  			 (match_operand:SI 3 "general_operand" "rK")))]
!   "TARGET_BITFIELD"
    "*
  { if (GET_CODE (operands[3]) == CONST_INT)
      return \"extsd %1,%0,%3,%2\";
***************
*** 1907,1913 ****
  			 (match_operand:SI 1 "const_int_operand" "i")
  			 (match_operand:SI 2 "general_operand" "rn"))
  	(match_operand:SI 3 "general_operand" "rm"))]
!   ""
    "*
  { if (GET_CODE (operands[2]) == CONST_INT)
      {
--- 1910,1916 ----
  			 (match_operand:SI 1 "const_int_operand" "i")
  			 (match_operand:SI 2 "general_operand" "rn"))
  	(match_operand:SI 3 "general_operand" "rm"))]
!   "TARGET_BITFIELD"
    "*
  { if (GET_CODE (operands[2]) == CONST_INT)
      {
***************
*** 1932,1938 ****
  			 (match_operand:SI 1 "const_int_operand" "i")
  			 (match_operand:SI 2 "general_operand" "rK"))
  	(match_operand:SI 3 "general_operand" "rm"))]
!   ""
    "*
  { if (GET_CODE (operands[2]) == CONST_INT)
      if (INTVAL (operands[1]) <= 8)
--- 1935,1941 ----
  			 (match_operand:SI 1 "const_int_operand" "i")
  			 (match_operand:SI 2 "general_operand" "rK"))
  	(match_operand:SI 3 "general_operand" "rm"))]
!   "TARGET_BITFIELD"
    "*
  { if (GET_CODE (operands[2]) == CONST_INT)
      if (INTVAL (operands[1]) <= 8)
***************
*** 1949,1955 ****
  			 (match_operand:SI 1 "const_int_operand" "i")
  			 (match_operand:SI 2 "general_operand" "rK"))
  	(match_operand:SI 3 "general_operand" "rm"))]
!   ""
    "*
  { if (GET_CODE (operands[2]) == CONST_INT)
      if (INTVAL (operands[1]) <= 8)
--- 1952,1958 ----
  			 (match_operand:SI 1 "const_int_operand" "i")
  			 (match_operand:SI 2 "general_operand" "rK"))
  	(match_operand:SI 3 "general_operand" "rm"))]
!   "TARGET_BITFIELD"
    "*
  { if (GET_CODE (operands[2]) == CONST_INT)
      if (INTVAL (operands[1]) <= 8)




CUT ========

------------------------------------------------------------------------------