diff -Naur gcc-4.4.7.orig/configure gcc-4.4.7/configure
--- gcc-4.4.7.orig/configure	2011-04-18 13:29:54.000000000 -0400
+++ gcc-4.4.7/configure	2011-04-18 13:52:50.000000000 -0400
@@ -2597,7 +2597,7 @@
   m68k-apollo-*)
     noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
     ;;
-  mips*-sde-elf*)
+  mips*-sde-elf* | mips*-nlm-elf*)
     skipdirs="$skipdirs target-libiberty"
     noconfigdirs="$noconfigdirs ${libgcj}"
     if test x$with_newlib = xyes; then
diff -Naur gcc-4.4.7.orig/configure.ac gcc-4.4.7/configure.ac
--- gcc-4.4.7.orig/configure.ac	2011-04-18 13:28:57.000000000 -0400
+++ gcc-4.4.7/configure.ac	2011-04-18 13:52:50.000000000 -0400
@@ -832,7 +832,7 @@
   m68k-apollo-*)
     noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
     ;;
-  mips*-sde-elf*)
+  mips*-sde-elf* | mips*-nlm-elf*)
     skipdirs="$skipdirs target-libiberty"
     noconfigdirs="$noconfigdirs ${libgcj}"
     if test x$with_newlib = xyes; then
diff -Naur gcc-4.4.7.orig/gcc/config/mips/elfnlm.h gcc-4.4.7/gcc/config/mips/elfnlm.h
--- gcc-4.4.7.orig/gcc/config/mips/elfnlm.h	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.4.7/gcc/config/mips/elfnlm.h	2011-04-18 13:52:50.000000000 -0400
@@ -0,0 +1,99 @@
+/* Target macros for mips*-elf targets.
+   Copyright (C) 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2007
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* Incorporate libnlm.a, expected to come from newlib 
+   The link order is important! */
+#undef  LIB_SPEC
+#define LIB_SPEC "\
+%{shared: --start-group -lnlm -lc --end-group} \
+%{!shared: --start-group -lnlm -lc --end-group}"
+
+#ifndef LINK_PIE_SPEC
+#ifdef HAVE_LD_PIE
+#define LINK_PIE_SPEC "%{pie:-pie} "
+#else
+#define LINK_PIE_SPEC "%{pie:} "
+#endif
+#endif
+
+#ifndef LINK_COMMAND_SPEC
+#define LINK_COMMAND_SPEC "\
+%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+    %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
+    %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+    %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
+    %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\
+    %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
+    %{march=xlp:-Tnlm.ld} %{march=xlr:-Tnlm.ld}  \
+    %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
+    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
+#endif
+
+/* Pass additional Linker Flags. This adds
+   a default NLM-specific Linker script, so 
+   that none need be specified on the cmd line. */
+  
+#undef LINK_SPEC
+#define LINK_SPEC "\
+%(endian_spec) \
+%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \
+%{bestGnum} \
+%{shared} %{non_shared} %{call_shared} \
+%{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
+%{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
+%{mabi=o64:-melf32%{EB:b}%{EL:l}tsmip} \
+%{mabi=32:-melf32%{EB:b}%{EL:l}tsmip}"
+
+/* Desired default CFLAGS */
+
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC "-G 0 -mno-gpopt -O3 -fno-schedule-insns"
+
+#undef DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS \
+  /* Make sure a -mips option is present.  This helps us to pick	\
+     the right multilib, and also makes the later specs easier		\
+     to write.  */							\
+  MIPS_ISA_LEVEL_SPEC,							\
+									\
+	/* Infer the default float setting from -march.  */		\
+	MIPS_ARCH_FLOAT_SPEC,						\
+	/* Configuration-independent MIPS rules.  */			\
+	BASE_DRIVER_SELF_SPECS
+
+#undef DEFAULT_SIGNED_CHAR
+#define DEFAULT_SIGNED_CHAR 0
+
+/* Use standard ELF-style local labels (not '$' as on early Irix).  */
+#undef LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX "."
+
+/* Use periods rather than dollar signs in special g++ assembler names.  */
+#define NO_DOLLAR_IN_LABEL
+
+/* Currently we don't support 128bit long doubles in software, so for 
+   now we force n32/n64 long-double to be 64bit.  */
+#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 64
+
+#ifdef IN_LIBGCC2
+#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
+#endif
diff -Naur gcc-4.4.7.orig/gcc/config/mips/linux64nlm.h gcc-4.4.7/gcc/config/mips/linux64nlm.h
--- gcc-4.4.7.orig/gcc/config/mips/linux64nlm.h	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.4.7/gcc/config/mips/linux64nlm.h	2011-04-18 13:52:50.000000000 -0400
@@ -0,0 +1,35 @@
+/* Definitions for MIPS running Linux-based GNU systems with ELF format
+   using n32/64 abi.
+   Copyright 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option)
+any later version.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* Force the default endianness and ABI flags onto the command line
+   in order to make the other specs easier to write.  */
+
+/* when march=xlr is passed, default to msoft-float */
+
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC "-fno-schedule-insns %{profile:-p}"
+
+#undef DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS \
+  MIPS_ARCH_FLOAT_SPEC,	  \
+  BASE_DRIVER_SELF_SPECS, \
+  LINUX_DRIVER_SELF_SPECS, \
+  " %{!EB:%{!EL:%(endian_spec)}}" \
+  " %{!mabi=*: -mabi=n32}"
diff -Naur gcc-4.4.7.orig/gcc/config/mips/mips.c gcc-4.4.7/gcc/config/mips/mips.c
--- gcc-4.4.7.orig/gcc/config/mips/mips.c	2011-04-18 13:49:55.000000000 -0400
+++ gcc-4.4.7/gcc/config/mips/mips.c	2011-04-18 13:52:50.000000000 -0400
@@ -669,7 +669,8 @@
   { "xlr", PROCESSOR_XLR, 64, 0 },
 
   /* MIPS64 Release 2 processors.  */
-  { "octeon", PROCESSOR_OCTEON, 65, PTF_AVOID_BRANCHLIKELY }
+  { "octeon", PROCESSOR_OCTEON, 65, PTF_AVOID_BRANCHLIKELY },
+  { "xlp", PROCESSOR_XLP, 65, PTF_AVOID_BRANCHLIKELY }
 };
 
 /* Default costs.  If these are used for a processor we should look
@@ -1077,6 +1078,19 @@
     COSTS_N_INSNS (72),           /* int_div_di */
 		     1,           /* branch_cost */
 		     4            /* memory_latency */
+  },
+  { /* Netlogic XLP */
+    COSTS_N_INSNS (4),            /* fp_add */
+    COSTS_N_INSNS (4),            /* fp_mult_sf */
+    COSTS_N_INSNS (4),            /* fp_mult_df */
+    COSTS_N_INSNS (24),           /* fp_div_sf */
+    COSTS_N_INSNS (32),           /* fp_div_df */
+    COSTS_N_INSNS (4),            /* int_mult_si */
+    COSTS_N_INSNS (5),            /* int_mult_di */
+    COSTS_N_INSNS (36),           /* int_div_si */
+    COSTS_N_INSNS (68),           /* int_div_di */
+    1,           /* branch_cost */
+    4            /* memory_latency */
   }
 };
 
@@ -10613,6 +10627,9 @@
 	 larger number, and partly because in most common cases we can't
 	 reach the theoretical max of 4.  */
       return 3;
+	
+	case PROCESSOR_XLP:
+	  return (reload_completed ? 4:2);
 
     case PROCESSOR_LOONGSON_2E:
     case PROCESSOR_LOONGSON_2F:
@@ -10741,6 +10758,9 @@
   /* Can schedule up to 4 of the 6 function units in any one cycle.  */
   if (TUNE_SB1)
     return 4;
+  
+  if (TUNE_XLP)
+    return 4;
 
   if (TUNE_LOONGSON_2EF)
     return 4;
diff -Naur gcc-4.4.7.orig/gcc/config/mips/mips.h gcc-4.4.7/gcc/config/mips/mips.h
--- gcc-4.4.7.orig/gcc/config/mips/mips.h	2011-04-18 13:49:55.000000000 -0400
+++ gcc-4.4.7/gcc/config/mips/mips.h	2011-04-18 13:52:50.000000000 -0400
@@ -72,6 +72,7 @@
   PROCESSOR_SB1A,
   PROCESSOR_SR71000,
   PROCESSOR_XLR,
+  PROCESSOR_XLP,
   PROCESSOR_MAX
 };
 
@@ -259,6 +260,7 @@
 #define TARGET_SB1                  (mips_arch == PROCESSOR_SB1		\
 				     || mips_arch == PROCESSOR_SB1A)
 #define TARGET_SR71K                (mips_arch == PROCESSOR_SR71000)
+#define TARGET_XLP                  (mips_arch == PROCESSOR_XLP)
 
 /* Scheduling target defines.  */
 #define TUNE_20KC		    (mips_tune == PROCESSOR_20KC)
@@ -285,6 +287,7 @@
 #define TUNE_OCTEON		    (mips_tune == PROCESSOR_OCTEON)
 #define TUNE_SB1                    (mips_tune == PROCESSOR_SB1		\
 				     || mips_tune == PROCESSOR_SB1A)
+#define TUNE_XLP                    (mips_tune == PROCESSOR_XLP)
 
 /* Whether vector modes and intrinsics for ST Microelectronics
    Loongson-2E/2F processors should be enabled.  In o32 pairs of
@@ -709,8 +712,8 @@
      %{march=mips32|march=4kc|march=4km|march=4kp|march=4ksc:-mips32} \
      %{march=mips32r2|march=m4k|march=4ke*|march=4ksd|march=24k* \
        |march=34k*|march=74k*: -mips32r2} \
-     %{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000: -mips64} \
-     %{march=mips64r2|march=octeon: -mips64r2} \
+	 %{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000|march=xlr: -mips64} \
+	 %{march=mips64r2|march=octeon|march=xlp: -mips64r2} \
      %{!march=*: -" MULTILIB_ISA_DEFAULT "}}"
 
 /* A spec that infers a -mhard-float or -msoft-float setting from an
@@ -720,7 +723,8 @@
 #define MIPS_ARCH_FLOAT_SPEC \
   "%{mhard-float|msoft-float|march=mips*:; \
      march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \
-     |march=34kc|march=74kc|march=5kc|march=octeon: -msoft-float; \
+	 |march=34kc|march=74kc|march=5kc|march=octeon|march=xlr: -msoft-float; \
+	 march=xlp: -mhard-float; \
      march=*: -mhard-float}"
 
 /* A spec condition that matches 32-bit options.  It only works if
@@ -803,7 +807,7 @@
 
 /* ISA has a three-operand multiplication instruction.  */
 #define ISA_HAS_DMUL3		(TARGET_64BIT				\
-				 && TARGET_OCTEON			\
+				 && (TARGET_OCTEON || TARGET_XLP)		\
 				 && !TARGET_MIPS16)
 
 /* ISA has the floating-point conditional move instructions introduced
diff -Naur gcc-4.4.7.orig/gcc/config/mips/mips.md gcc-4.4.7/gcc/config/mips/mips.md
--- gcc-4.4.7.orig/gcc/config/mips/mips.md	2011-04-18 13:49:55.000000000 -0400
+++ gcc-4.4.7/gcc/config/mips/mips.md	2011-04-18 13:52:51.000000000 -0400
@@ -564,7 +564,7 @@
 ;; Attribute describing the processor.  This attribute must match exactly
 ;; with the processor_type enumeration in mips.h.
 (define_attr "cpu"
-  "r3000,4kc,4kp,5kc,5kf,20kc,24kc,24kf2_1,24kf1_1,74kc,74kf2_1,74kf1_1,74kf3_2,loongson_2e,loongson_2f,m4k,octeon,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,r10000,sb1,sb1a,sr71000,xlr"
+  "r3000,4kc,4kp,5kc,5kf,20kc,24kc,24kf2_1,24kf1_1,74kc,74kf2_1,74kf1_1,74kf3_2,loongson_2e,loongson_2f,m4k,octeon,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,r10000,sb1,sb1a,sr71000,xlr,xlp"
   (const (symbol_ref "mips_tune")))
 
 ;; The type of hardware hazard associated with this instruction.
@@ -962,6 +962,7 @@
 (include "sb1.md")
 (include "sr71k.md")
 (include "xlr.md")
+(include "xlp.md")
 (include "generic.md")
 
 ;;
diff -Naur gcc-4.4.7.orig/gcc/config/mips/t-linux64-nlm gcc-4.4.7/gcc/config/mips/t-linux64-nlm
--- gcc-4.4.7.orig/gcc/config/mips/t-linux64-nlm	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.4.7/gcc/config/mips/t-linux64-nlm	2011-04-18 13:52:51.000000000 -0400
@@ -0,0 +1,18 @@
+MULTILIB_OPTIONS = march=xlr mabi=n32/mabi=32/mabi=64 EL 
+MULTILIB_DIRNAMES = xlr n32 32 64 el
+
+MULTILIB_MATCHES = EL=mel EB=meb
+
+MULTILIB_OSDIRNAMES  = march.xlr/mabi.n32=../xlr/lib32
+MULTILIB_OSDIRNAMES += march.xlr/mabi.32=../xlr/lib
+MULTILIB_OSDIRNAMES += march.xlr/mabi.64=../xlr/lib64
+MULTILIB_OSDIRNAMES += mabi.n32=../lib32
+MULTILIB_OSDIRNAMES += mabi.32=../lib
+MULTILIB_OSDIRNAMES += mabi.64=../lib64
+
+MULTILIB_OSDIRNAMES += march.xlr/mabi.n32/EL=../xlr/lib32/el
+MULTILIB_OSDIRNAMES += march.xlr/mabi.32/EL=../xlr/lib/el
+MULTILIB_OSDIRNAMES += march.xlr/mabi.64/EL=../xlr/lib64/el
+MULTILIB_OSDIRNAMES += mabi.n32/EL=../lib32/el
+MULTILIB_OSDIRNAMES += mabi.32/EL=../lib/el
+MULTILIB_OSDIRNAMES += mabi.64/EL=../lib64/el
diff -Naur gcc-4.4.7.orig/gcc/config/mips/t-linux64-nlm-native gcc-4.4.7/gcc/config/mips/t-linux64-nlm-native
--- gcc-4.4.7.orig/gcc/config/mips/t-linux64-nlm-native	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.4.7/gcc/config/mips/t-linux64-nlm-native	2011-04-18 13:52:51.000000000 -0400
@@ -0,0 +1,14 @@
+# Use this multilib config file to build 
+# O32 and N64 ABIs for XLP. In addition,
+# configure uses --with-abi=32 & --with-arch=xlp
+# This builds default 32, extra 32 and 64
+
+MULTILIB_OPTIONS = mabi=64/mabi=32
+MULTILIB_DIRNAMES = 64 32
+
+# These are used to correctly pick up LIBC paths
+
+MULTILIB_OSDIRNAMES  = march.xlp/mabi.64=../xlp/lib64
+MULTILIB_OSDIRNAMES += march.xlp/mabi.32=../xlp/lib
+MULTILIB_OSDIRNAMES += mabi.64=../xlp/lib64
+MULTILIB_OSDIRNAMES += mabi.32=../xlp/lib
diff -Naur gcc-4.4.7.orig/gcc/config/mips/t-nlm gcc-4.4.7/gcc/config/mips/t-nlm
--- gcc-4.4.7.orig/gcc/config/mips/t-nlm	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.4.7/gcc/config/mips/t-nlm	2011-04-18 13:52:51.000000000 -0400
@@ -0,0 +1,19 @@
+# Addendum file to the t-elf
+# base file, for the XLP/XLR
+#
+# Float: no soft float for XLP
+#        Hard-Float is built for XLR, but 
+#        march=xlr will pick up soft-float
+
+CRTSTUFF_T_CFLAGS       += -mno-gpopt
+TARGET_LIBGCC2_CFLAGS   += -mno-gpopt
+
+# Default ABI=O32
+
+MULTILIB_OPTIONS         = march=xlp/march=xlr/march=mips32 mabi=64/mabi=n32/mabi=o64 msoft-float EL
+MULTILIB_DIRNAMES        = xlp xlr mips32 lib64 libn32 libo64 soft-float el
+
+# Use MULTILIB_EXCLUSIONS instead of 
+# MULTILIB_EXCEPTIONS for '!' logic.
+
+MULTILIB_EXCLUSIONS      = !march=xlr/msoft-float march=mips32/mabi=64 march=mips32/mabi=o64 march=mips32/mabi=n32
diff -Naur gcc-4.4.7.orig/gcc/config/mips/xlp.md gcc-4.4.7/gcc/config/mips/xlp.md
--- gcc-4.4.7.orig/gcc/config/mips/xlp.md	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.4.7/gcc/config/mips/xlp.md	2011-04-18 13:52:51.000000000 -0400
@@ -0,0 +1,124 @@
+;; Software Code Disclaimer
+;; xlp.md   Machine Description for the RMI XLP Microprocessor
+;; Copyright © 2006 Raza Microelectronics, Inc. "RMI")
+;;  
+;; This program is free software.  You may use it, redistribute it  
+;; and/or modify it under the terms of the GNU General Public License 
+;; as published by the Free Software Foundation; either version two 
+;; of the License or (at your option) any later version.
+;; 								
+;; This program is distributed in the hope that you will find it  
+;; useful.  Notwithstanding the foregoing, you understand and agree  
+;; that this program is provided by RMI "as is," and without any  
+;; warranties, whether express, implied or statutory, including without  
+;; limitation any implied warranty of non-infringement, merchantability  
+;; or fitness for a particular purpose.  In no event will RMI be liable  
+;; for any loss of data, lost profits, cost of procurement of substitute  
+;; technology or services or for any direct, indirect, incidental,        
+;; consequential or special damages arising from the use of this program,  
+;; however caused.  Your unconditional agreement to these terms and    
+;; conditions is an express condition to, and shall be deemed to occur  
+;; upon, your use, redistribution and/or modification of this program.  
+;; 
+;; See the GNU General Public License for more details.
+;;
+;; DFA-based pipeline description for XLP
+;;
+;;
+(define_automaton "xlp_cpu")
+
+;; CPU function units.
+(define_cpu_unit "xlp_ex0" "xlp_cpu")
+(define_cpu_unit "xlp_ex1" "xlp_cpu")
+(define_cpu_unit "xlp_ex2" "xlp_cpu")
+(define_cpu_unit "xlp_ex3" "xlp_cpu")
+
+;; Floating-point units.
+(define_cpu_unit "xlp_fp" "xlp_cpu")
+
+;; Integer Multiply Unit
+(define_cpu_unit "xlp_div" "xlp_cpu")
+
+;; Floating Point Sqrt/Divide
+(define_cpu_unit "xlp_divsq" "xlp_cpu")
+
+;; Define reservations for common combinations.
+
+;;
+;; The ordering of the instruction-execution-path/resource-usage
+;; descriptions (also known as reservation RTL) is roughly ordered
+;; based on the define attribute RTL for the "type" classification.
+;; When modifying, remember that the first test that matches is the
+;; reservation used!
+;;
+(define_insn_reservation "ir_xlp_unknown" 1
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "unknown,multi"))
+  "xlp_ex0+xlp_ex1+xlp_ex2+xlp_ex3")
+
+(define_insn_reservation "ir_xlp_branch" 1
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "branch,jump,call"))
+  "xlp_ex3")
+
+(define_insn_reservation "ir_xlp_prefeth" 1
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "prefetch,prefetchx"))
+  "xlp_ex0|xlp_ex1")
+
+(define_insn_reservation "ir_xlp_load" 4
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "load"))
+  "xlp_ex0 | xlp_ex1")
+
+(define_insn_reservation "ir_xlp_fpload" 5
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "fpload,fpidxload"))
+  "xlp_ex0 | xlp_ex1")
+
+(define_insn_reservation "ir_xlp_alu" 1
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "const,arith,shift,slt,clz,nop"))
+  "xlp_ex0 | xlp_ex1 | xlp_ex2 | xlp_ex3")
+
+(define_insn_reservation "ir_xlp_condmov" 1
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "condmove"))
+  "xlp_ex2")
+
+(define_insn_reservation "ir_xlp_mul" 6
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "imul,imul3,imadd"))
+  "xlp_ex2")
+
+(define_insn_reservation "ir_xlp_div" 36
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "idiv"))
+  "xlp_ex2+xlp_div,xlp_div*35")
+
+(define_insn_reservation "ir_xlp_store" 1
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "store,fpstore,fpidxstore"))
+  "xlp_ex0 | xlp_ex1")
+
+(define_insn_reservation "ir_xlp_fpmove" 2
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "mfc"))
+ "xlp_ex3,xlp_fp")
+
+(define_insn_reservation "ir_xlp_hilo" 1
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "mthilo,mfhilo"))
+  "xlp_ex2")
+
+(define_insn_reservation "ir_xlp_fpsimple" 6
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "fmove,fadd,fmul,fmadd,fabs,fneg,fcmp,fcvt"))
+  "xlp_fp")
+
+(define_insn_reservation "ir_xlp_fpcomplex" 30
+  (and (eq_attr "cpu" "xlp")
+       (eq_attr "type" "fdiv,frdiv,frdiv1,frdiv2,fsqrt,frsqrt,frsqrt1,frsqrt2"))
+  "xlp_fp+xlp_divsq,xlp_divsq*29")
+
+(define_bypass 5 "ir_xlp_mul" "ir_xlp_hilo")
diff -Naur gcc-4.4.7.orig/gcc/config.gcc gcc-4.4.7/gcc/config.gcc
--- gcc-4.4.7.orig/gcc/config.gcc	2011-04-18 13:49:55.000000000 -0400
+++ gcc-4.4.7/gcc/config.gcc	2011-04-18 13:52:51.000000000 -0400
@@ -1574,6 +1574,11 @@
 	tmake_file="${tmake_file} mips/t-linux64 mips/t-libgcc-mips16"
 	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
 	case ${target} in
+		mips64-nlm-linux-gnu)
+			tm_file="${tm_file} mips/linux64nlm.h"
+			tmake_file="${tmake_file} mips/t-linux64-nlm"
+			tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"xlp\\\" MIPS_ISA_DEFAULT=65"
+			;;
 		mips64el-st-linux-gnu)
 			tm_file="${tm_file} mips/st.h"
 			tmake_file="${tmake_file} mips/t-st"
@@ -1646,6 +1651,14 @@
 	    ;;
 	esac
 	;;
+mips64*-nlm-elf*)
+   tm_file="elfos.h ${tm_file} mips/elf.h mips/elfnlm.h"
+   tmake_file="mips/t-elf mips/t-nlm"
+   tm_defines="${tm_defines} MIPS_ISA_DEFAULT=65 MIPS_ABI_DEFAULT=ABI_32 MIPS_CPU_STRING_DEFAULT=\\\"xlp\\\""
+   extra_parts="crtbeginT.o"
+   target_cpu_default="MASK_64BIT|MASK_FLOAT64"
+   use_fixproto=yes
+   ;;
 mipsisa32-*-elf* | mipsisa32el-*-elf* | \
 mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \
 mipsisa64-*-elf* | mipsisa64el-*-elf* | \
diff -Naur gcc-4.4.7.orig/nlm/nlm_linuxtarget_gcc_reqd.patch gcc-4.4.7/nlm/nlm_linuxtarget_gcc_reqd.patch
--- gcc-4.4.7.orig/nlm/nlm_linuxtarget_gcc_reqd.patch	1969-12-31 19:00:00.000000000 -0500
+++ gcc-4.4.7/nlm/nlm_linuxtarget_gcc_reqd.patch	2011-04-18 13:52:51.000000000 -0400
@@ -0,0 +1,363 @@
+Index: libstdc++-v3/configure
+===================================================================
+--- libstdc++-v3/configure	(revision 58)
++++ libstdc++-v3/configure	(working copy)
+@@ -1521,6 +1521,118 @@ echo "$as_me: error: run \`make distclea
+    { (exit 1); exit 1; }; }
+ fi
+ 
++hasabi32=`echo "$CC" | grep 'mabi=32'`
++hasabi64=`echo "$CC" | grep 'mabi=64'`
++hasxlr=`echo "$CC" | grep 'march=xlr'`
++hasel=`echo "$CC" | grep '\-EL'`
++
++# The top-level condition checks are for the ABIs
++
++if [ "$hasabi32" = "$CC" ];
++then
++	if [ "$hasxlr" = "$CC" ];
++	then
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib\/el\//'`
++		else
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib\//'`
++		fi
++	else 
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib\//lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib\/el\//'`
++			CXX=`echo "$CC"` 
++		else
++			CC=`echo "$CC" | sed 's/lib32\//lib\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//lib\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//lib\//'`
++		fi
++	fi
++else
++if [ "$hasabi64" = "$CC" ];
++then
++	if [ "$hasxlr" = "$CC" ];
++	then
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib64\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib64\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib64\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib64\/el\//'`
++		else
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib64\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib64\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib64\//'`
++		fi
++	else
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib64\//lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//lib64\/el\//'`
++			CXX=`echo "$CC"` 
++		else
++			CC=`echo "$CC" | sed 's/lib\//lib64\//'`
++			CC=`echo "$CC" | sed 's/lib32\//lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib\//lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//lib64\//'`
++		fi
++	fi
++else
++	if [ "$hasxlr" = "$CC" ];
++	then
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib32\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib32\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib32\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib32\/el\//'`
++		else
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib32\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib32\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib32\//'`
++		fi
++	else
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib32\//lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib32\/el\//'`
++			CXX=`echo "$CC"` 
++		else
++			CC=`echo "$CC" | sed 's/lib\//lib32\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib\//lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//lib32\//'`
++		fi
++	fi
++fi
++fi
++
+ ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+Index: libstdc++-v3/Makefile.in
+===================================================================
+--- libstdc++-v3/Makefile.in	(revision 58)
++++ libstdc++-v3/Makefile.in	(working copy)
+@@ -327,6 +327,52 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../confi
+ # Multilib support.
+ MAKEOVERRIDES = 
+ 
++ifeq ($(MULTIDIR),32)
++   GCC_FOR_TARGET := $(subst lib,lib,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),64)
++   GCC_FOR_TARGET := $(subst lib,lib64,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/32)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/64)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib64,$(GCC_FOR_TARGET))
++else    
++ifeq ($(MULTIDIR),xlr)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib32,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),el)
++   GCC_FOR_TARGET := $(subst lib,lib32/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),32/el)
++   GCC_FOR_TARGET := $(subst lib,lib/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),64/el)
++   GCC_FOR_TARGET := $(subst lib,lib64/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/el)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib32/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/32/el)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/64/el)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib64/el,$(GCC_FOR_TARGET))
++else    
++   GCC_FOR_TARGET := $(subst lib,lib32,$(GCC_FOR_TARGET))
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++
+ # Work around what appears to be a GNU make bug handling MAKEFLAGS
+ # values defined in terms of make variables, as is the case for CC and
+ # friends when we are called from the top level Makefile.
+Index: libiberty/configure
+===================================================================
+--- libiberty/configure	(revision 58)
++++ libiberty/configure	(working copy)
+@@ -1294,6 +1294,121 @@ echo "$as_me: error: run \`make distclea
+    { (exit 1); exit 1; }; }
+ fi
+ 
++hasabi32=`echo "$CC" | grep 'mabi=32'`
++hasabi64=`echo "$CC" | grep 'mabi=64'`
++hasxlr=`echo "$CC" | grep 'march=xlr'`
++hasel=`echo "$CC" | grep '\-EL'`
++
++# The top-level condition checks are for the ABIs
++
++if [ "$hasabi32" = "$CC" ];
++then
++	if [ "$hasxlr" = "$CC" ];
++	then
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib\/el\//'`
++		else
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib\//'`
++		fi
++	else 
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib\//lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//lib\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib\/el\//'`
++			CXX=`echo "$CC"`
++		else
++			CC=`echo "$CC" | sed 's/lib32\//lib\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//lib\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//lib\//'`
++		fi
++	fi
++else
++if [ "$hasabi64" = "$CC" ];
++then
++	if [ "$hasxlr" = "$CC" ];
++	then
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib64\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib64\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib64\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib64\/el\//'`
++		else
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib64\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib64\//'`
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib64\//'`
++		fi
++	else
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib64\//lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//lib64\/el\//'`
++			CC=`echo "$CC" | sed 's/lib32\//lib64\/el\//'`
++			CXX=`echo "$CC"`
++		else
++			CC=`echo "$CC" | sed 's/lib\//lib64\//'`
++			CC=`echo "$CC" | sed 's/lib32\//lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib\//lib64\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//lib64\//'`
++		fi
++	fi
++else
++	if [ "$hasxlr" = "$CC" ];
++	then
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib32\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib32\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib32\/el\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib32\/el\//'`
++		else
++			CC=`echo "$CC" | sed 's/lib32\//xlr\/lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib32\//xlr\/lib32\//'`
++			CC=`echo "$CC" | sed 's/lib\//xlr\/lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib\//xlr\/lib32\//'`
++			CC=`echo "$CC" | sed 's/lib64\//xlr\/lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//xlr\/lib32\//'`
++		fi
++	else
++		if [ "$hasel" = "$CC" ];
++		then
++			CC=`echo "$CC" | sed 's/lib32\//lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib\//lib32\/el\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib32\/el\//'`
++			CXX=`echo "$CC"`
++		else
++			CC=`echo "$CC" | sed 's/lib\//lib32\//'`
++			CC=`echo "$CC" | sed 's/lib64\//lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib\//lib32\//'`
++			CXX=`echo "$CC" | sed 's/lib64\//lib32\//'`
++		fi
++	fi
++fi
++fi
++
++ac_env_CC_value=$CC
++ac_cv_env_CC_value=$CC
++
+ ac_ext=c
+ ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+Index: libgcc/Makefile.in
+===================================================================
+--- libgcc/Makefile.in	(revision 58)
++++ libgcc/Makefile.in	(working copy)
+@@ -777,6 +777,52 @@ libgcc_s$(SHLIB_EXT): libgcc.map
+ mapfile = libgcc.map
+ endif
+ 
++ifeq ($(MULTIDIR),32)
++   GCC_FOR_TARGET := $(subst lib,lib,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),64)
++   GCC_FOR_TARGET := $(subst lib,lib64,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/32)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/64)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib64,$(GCC_FOR_TARGET))
++else    
++ifeq ($(MULTIDIR),xlr)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib32,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),el)
++   GCC_FOR_TARGET := $(subst lib,lib32/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),32/el)
++   GCC_FOR_TARGET := $(subst lib,lib/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),64/el)
++   GCC_FOR_TARGET := $(subst lib,lib64/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/el)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib32/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/32/el)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib/el,$(GCC_FOR_TARGET))
++else
++ifeq ($(MULTIDIR),xlr/64/el)
++   GCC_FOR_TARGET := $(subst lib,xlr/lib64/el,$(GCC_FOR_TARGET))
++else    
++   GCC_FOR_TARGET := $(subst lib,lib32,$(GCC_FOR_TARGET))
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++endif
++
+ libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
+ 	# @multilib_flags@ is still needed because this may use
+ 	# $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
