diff mbox

powerpc64le-linux support

Message ID 20130424104744.GO22536@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra April 24, 2013, 10:47 a.m. UTC
This is a first pass at getting powerpc64 little-endian support into
shape.  There are no doubt more bugs lurking, but this lets me build
a little-endian C compiler and libgcc to start the little-endian
bootstrap process.  Bootstrapped and regression tested powerpc64-linux
to ensure this doesn't break big-endian.

OK for mainline?

libgcc/
	* config.host: Match little-endian powerpc-linux.
gcc/
	* config.gcc: Support little-endian powerpc-linux targets.
	* config/rs6000/linux.h (LINK_OS_LINUX_EMUL): Define.
	(LINK_OS_LINUX_SPEC): Define.
	* config/rs6000/linuxspe.h (TARGET_DEFAULT):
	Preserve MASK_LITTLE_ENDIAN.
	* config/rs6000/default64.h (TARGET_DEFAULT): Likewise.
	* config/rs6000/linuxaltivec.h (TARGET_DEFAULT): Likewise.
	* config/rs6000/linux64.h (OPTION_LITTLE_ENDIAN): Don't zero.
	(LINK_OS_LINUX_EMUL32, LINK_OS_LINUX_EMUL64): Define.
	(LINK_OS_LINUX_SPEC32, LINK_OS_LINUX_SPEC64): Use above.
	* config/rs6000/rs6000.c (output_toc): Don't use .tc for TARGET_ELF.
	Correct fp word order for little-endian.  Don't shift toc entries
	smaller than a word for little-endian.
	* config/rs6000/rs6000.md (bswaphi2, bswapsi2 split): Comment.
	(bswapdi2 splits): Correct low-part subreg for little-endian.
	Remove wrong BYTES_BIG_ENDIAN tests, and rename vars to remove
	low/high where such is correct only for be.
	* config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Allow
	little-endian for -mcall-aixdesc.

Comments

David Edelsohn April 24, 2013, 2:08 p.m. UTC | #1
On Wed, Apr 24, 2013 at 6:47 AM, Alan Modra <amodra@gmail.com> wrote:
> This is a first pass at getting powerpc64 little-endian support into
> shape.  There are no doubt more bugs lurking, but this lets me build
> a little-endian C compiler and libgcc to start the little-endian
> bootstrap process.  Bootstrapped and regression tested powerpc64-linux
> to ensure this doesn't break big-endian.
>
> OK for mainline?
>
> libgcc/
>         * config.host: Match little-endian powerpc-linux.
> gcc/
>         * config.gcc: Support little-endian powerpc-linux targets.
>         * config/rs6000/linux.h (LINK_OS_LINUX_EMUL): Define.
>         (LINK_OS_LINUX_SPEC): Define.
>         * config/rs6000/linuxspe.h (TARGET_DEFAULT):
>         Preserve MASK_LITTLE_ENDIAN.
>         * config/rs6000/default64.h (TARGET_DEFAULT): Likewise.
>         * config/rs6000/linuxaltivec.h (TARGET_DEFAULT): Likewise.
>         * config/rs6000/linux64.h (OPTION_LITTLE_ENDIAN): Don't zero.
>         (LINK_OS_LINUX_EMUL32, LINK_OS_LINUX_EMUL64): Define.
>         (LINK_OS_LINUX_SPEC32, LINK_OS_LINUX_SPEC64): Use above.
>         * config/rs6000/rs6000.c (output_toc): Don't use .tc for TARGET_ELF.
>         Correct fp word order for little-endian.  Don't shift toc entries
>         smaller than a word for little-endian.
>         * config/rs6000/rs6000.md (bswaphi2, bswapsi2 split): Comment.
>         (bswapdi2 splits): Correct low-part subreg for little-endian.
>         Remove wrong BYTES_BIG_ENDIAN tests, and rename vars to remove
>         low/high where such is correct only for be.
>         * config/rs6000/sysv4.h (SUBTARGET_OVERRIDE_OPTIONS): Allow
>         little-endian for -mcall-aixdesc.

Okay, but...

> @@ -2158,7 +2161,11 @@
>                          (const_int 16))
>         (rotate:SI (match_dup 1)
>                    (const_int 16)))]
> -  "")
> +  "
> +{
> +  /* We are always BITS_BIG_ENDIAN, so the bit positions above in
> +     zero_extract insns do not change for -mlittle.  */
> +}")

Please move the comment to the MD file above the splitter and not in
the preparation statements.

Thanks, David
diff mbox

Patch

Index: libgcc/config.host
===================================================================
--- libgcc/config.host	(revision 198174)
+++ libgcc/config.host	(working copy)
@@ -882,7 +882,7 @@ 
 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
 	extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
 	;;
-powerpc-*-linux* | powerpc64-*-linux*)
+powerpc*-*-linux*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-softfp-sfdf t-softfp-excl t-dfprules rs6000/t-ppc64-fp t-softfp t-slibgcc-libgcc"
 	extra_parts="$extra_parts ecrti.o ecrtn.o ncrti.o ncrtn.o"
 	md_unwind_header=rs6000/linux-unwind.h
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 198174)
+++ gcc/config.gcc	(working copy)
@@ -2086,20 +2086,24 @@ 
 	extra_options="${extra_options} rs6000/sysv4.opt"
 	tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm"
 	;;
-powerpc-*-linux* | powerpc64-*-linux*)
+powerpc*-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h"
 	extra_options="${extra_options} rs6000/sysv4.opt"
 	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+	case ${target} in
+	    powerpc*le-*-*)
+	    tm_file="${tm_file} rs6000/sysv4le.h" ;;
+	esac
 	maybe_biarch=yes
 	case ${target} in
-	    powerpc64-*-linux*spe* | powerpc64-*-linux*paired*)
+	    powerpc64*-*-linux*spe* | powerpc64*-*-linux*paired*)
 	    	echo "*** Configuration ${target} not supported" 1>&2
 		exit 1
 		;;
-	    powerpc-*-linux*spe* | powerpc-*-linux*paired*)
+	    powerpc*-*-linux*spe* | powerpc*-*-linux*paired*)
 		maybe_biarch=
 		;;
-	    powerpc64-*-linux*)
+	    powerpc64*-*-linux*)
 	    	test x$with_cpu != x || cpu_is_64bit=yes
 		maybe_biarch=always
 		;;
Index: gcc/config/rs6000/linux.h
===================================================================
--- gcc/config/rs6000/linux.h	(revision 198174)
+++ gcc/config/rs6000/linux.h	(working copy)
@@ -79,6 +79,17 @@ 
 #undef	LINK_OS_DEFAULT_SPEC
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
 
+#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+#define LINK_OS_LINUX_EMUL "%{!mbig: %{!mbig-endian: -m elf32lppclinux}}%{mbig|mbig-endian: -m elf32ppclinux}"
+#else
+#define LINK_OS_LINUX_EMUL "%{!mlittle: %{!mlittle-endian: -m elf32ppclinux}}%{mlittle|mlittle-endian: -m elf32lppclinux}"
+#endif
+
+#undef LINK_OS_LINUX_SPEC
+#define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
+  %{rdynamic:-export-dynamic} \
+  -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
+
 #define LINK_GCC_C_SEQUENCE_SPEC \
   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
 
Index: gcc/config/rs6000/linuxspe.h
===================================================================
--- gcc/config/rs6000/linuxspe.h	(revision 198174)
+++ gcc/config/rs6000/linuxspe.h	(working copy)
@@ -20,8 +20,13 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 /* Override rs6000.h and sysv4.h definition.  */
+#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
 #undef	TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_STRICT_ALIGN | MASK_LITTLE_ENDIAN)
+#else
+#undef	TARGET_DEFAULT
 #define TARGET_DEFAULT MASK_STRICT_ALIGN
+#endif
 
 #undef  ASM_DEFAULT_SPEC
 #define	ASM_DEFAULT_SPEC "-mppc -mspe -me500"
Index: gcc/config/rs6000/default64.h
===================================================================
--- gcc/config/rs6000/default64.h	(revision 198174)
+++ gcc/config/rs6000/default64.h	(working copy)
@@ -18,5 +18,10 @@ 
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
 #undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_64BIT | MASK_LITTLE_ENDIAN)
+#else
+#undef TARGET_DEFAULT
 #define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_64BIT)
+#endif
Index: gcc/config/rs6000/linuxaltivec.h
===================================================================
--- gcc/config/rs6000/linuxaltivec.h	(revision 198174)
+++ gcc/config/rs6000/linuxaltivec.h	(working copy)
@@ -20,8 +20,13 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 /* Override rs6000.h and sysv4.h definition.  */
+#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
 #undef	TARGET_DEFAULT
+#define	TARGET_DEFAULT (MASK_ALTIVEC | MASK_LITTLE_ENDIAN)
+#else
+#undef	TARGET_DEFAULT
 #define	TARGET_DEFAULT MASK_ALTIVEC
+#endif
 
 #undef  SUBSUBTARGET_OVERRIDE_OPTIONS
 #define SUBSUBTARGET_OVERRIDE_OPTIONS rs6000_altivec_abi = 1
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h	(revision 198174)
+++ gcc/config/rs6000/linux64.h	(working copy)
@@ -212,10 +215,6 @@ 
 
 #ifndef RS6000_BI_ARCH
 
-/* 64-bit PowerPC Linux is always big-endian.  */
-#undef	OPTION_LITTLE_ENDIAN
-#define OPTION_LITTLE_ENDIAN	0
-
 /* 64-bit PowerPC Linux always has a TOC.  */
 #undef  TARGET_TOC
 #define	TARGET_TOC		1
@@ -376,12 +381,19 @@ 
 #define GNU_USER_DYNAMIC_LINKER64 \
   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
 
+#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+#define LINK_OS_LINUX_EMUL32 "%{!mbig: %{!mbig-endian: -m elf32lppclinux}}%{mbig|mbig-endian: -m elf32ppclinux}"
+#define LINK_OS_LINUX_EMUL64 "%{!mbig: %{!mbig-endian: -m elf64lppc}}%{mbig|mbig-endian: -m elf64ppc}"
+#else
+#define LINK_OS_LINUX_EMUL32 "%{!mlittle: %{!mlittle-endian: -m elf32ppclinux}}%{mlittle|mlittle-endian: -m elf32lppclinux}"
+#define LINK_OS_LINUX_EMUL64 "%{!mlittle: %{!mlittle-endian: -m elf64ppc}}%{mlittle|mlittle-endian: -m elf64lppc}"
+#endif
 
-#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
   %{rdynamic:-export-dynamic} \
   -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"
 
-#define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
   %{rdynamic:-export-dynamic} \
   -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"
 
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 198174)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -22423,20 +22476,22 @@ 
 
       if (TARGET_64BIT)
 	{
-	  if (TARGET_MINIMAL_TOC)
+	  if (TARGET_ELF || TARGET_MINIMAL_TOC)
 	    fputs (DOUBLE_INT_ASM_OP, file);
 	  else
 	    fprintf (file, "\t.tc FT_%lx_%lx_%lx_%lx[TC],",
 		     k[0] & 0xffffffff, k[1] & 0xffffffff,
 		     k[2] & 0xffffffff, k[3] & 0xffffffff);
 	  fprintf (file, "0x%lx%08lx,0x%lx%08lx\n",
-		   k[0] & 0xffffffff, k[1] & 0xffffffff,
-		   k[2] & 0xffffffff, k[3] & 0xffffffff);
+		   k[WORDS_BIG_ENDIAN ? 0 : 1] & 0xffffffff,
+		   k[WORDS_BIG_ENDIAN ? 1 : 0] & 0xffffffff,
+		   k[WORDS_BIG_ENDIAN ? 2 : 3] & 0xffffffff,
+		   k[WORDS_BIG_ENDIAN ? 3 : 2] & 0xffffffff);
 	  return;
 	}
       else
 	{
-	  if (TARGET_MINIMAL_TOC)
+	  if (TARGET_ELF || TARGET_MINIMAL_TOC)
 	    fputs ("\t.long ", file);
 	  else
 	    fprintf (file, "\t.tc FT_%lx_%lx_%lx_%lx[TC],",
@@ -22463,18 +22518,19 @@ 
 
       if (TARGET_64BIT)
 	{
-	  if (TARGET_MINIMAL_TOC)
+	  if (TARGET_ELF || TARGET_MINIMAL_TOC)
 	    fputs (DOUBLE_INT_ASM_OP, file);
 	  else
 	    fprintf (file, "\t.tc FD_%lx_%lx[TC],",
 		     k[0] & 0xffffffff, k[1] & 0xffffffff);
 	  fprintf (file, "0x%lx%08lx\n",
-		   k[0] & 0xffffffff, k[1] & 0xffffffff);
+		   k[WORDS_BIG_ENDIAN ? 0 : 1] & 0xffffffff,
+		   k[WORDS_BIG_ENDIAN ? 1 : 0] & 0xffffffff);
 	  return;
 	}
       else
 	{
-	  if (TARGET_MINIMAL_TOC)
+	  if (TARGET_ELF || TARGET_MINIMAL_TOC)
 	    fputs ("\t.long ", file);
 	  else
 	    fprintf (file, "\t.tc FD_%lx_%lx[TC],",
@@ -22498,7 +22554,7 @@ 
 
       if (TARGET_64BIT)
 	{
-	  if (TARGET_MINIMAL_TOC)
+	  if (TARGET_ELF || TARGET_MINIMAL_TOC)
 	    fputs (DOUBLE_INT_ASM_OP, file);
 	  else
 	    fprintf (file, "\t.tc FS_%lx[TC],", l & 0xffffffff);
@@ -22507,7 +22563,7 @@ 
 	}
       else
 	{
-	  if (TARGET_MINIMAL_TOC)
+	  if (TARGET_ELF || TARGET_MINIMAL_TOC)
 	    fputs ("\t.long ", file);
 	  else
 	    fprintf (file, "\t.tc FS_%lx[TC],", l & 0xffffffff);
@@ -22539,9 +22595,8 @@ 
 	}
 #endif
 
-      /* TOC entries are always Pmode-sized, but since this
-	 is a bigendian machine then if we're putting smaller
-	 integer constants in the TOC we have to pad them.
+      /* TOC entries are always Pmode-sized, so when big-endian
+	 smaller integer constants in the TOC need to be padded.
 	 (This is still a win over putting the constants in
 	 a separate constant pool, because then we'd have
 	 to have both a TOC entry _and_ the actual constant.)
@@ -22552,7 +22607,7 @@ 
       /* It would be easy to make this work, but it doesn't now.  */
       gcc_assert (!TARGET_64BIT || POINTER_SIZE >= GET_MODE_BITSIZE (mode));
 
-      if (POINTER_SIZE > GET_MODE_BITSIZE (mode))
+      if (WORDS_BIG_ENDIAN && POINTER_SIZE > GET_MODE_BITSIZE (mode))
 	{
 #if HOST_BITS_PER_WIDE_INT == 32
 	  lshift_double (low, high, POINTER_SIZE - GET_MODE_BITSIZE (mode),
@@ -22567,7 +22622,7 @@ 
 
       if (TARGET_64BIT)
 	{
-	  if (TARGET_MINIMAL_TOC)
+	  if (TARGET_ELF || TARGET_MINIMAL_TOC)
 	    fputs (DOUBLE_INT_ASM_OP, file);
 	  else
 	    fprintf (file, "\t.tc ID_%lx_%lx[TC],",
@@ -22580,7 +22635,7 @@ 
 	{
 	  if (POINTER_SIZE < GET_MODE_BITSIZE (mode))
 	    {
-	      if (TARGET_MINIMAL_TOC)
+	      if (TARGET_ELF || TARGET_MINIMAL_TOC)
 		fputs ("\t.long ", file);
 	      else
 		fprintf (file, "\t.tc ID_%lx_%lx[TC],",
@@ -22590,7 +22645,7 @@ 
 	    }
 	  else
 	    {
-	      if (TARGET_MINIMAL_TOC)
+	      if (TARGET_ELF || TARGET_MINIMAL_TOC)
 		fputs ("\t.long ", file);
 	      else
 		fprintf (file, "\t.tc IS_%lx[TC],", (long) low & 0xffffffff);
@@ -22628,7 +22683,7 @@ 
       gcc_unreachable ();
     }
 
-  if (TARGET_MINIMAL_TOC)
+  if (TARGET_ELF || TARGET_MINIMAL_TOC)
     fputs (TARGET_32BIT ? "\t.long " : DOUBLE_INT_ASM_OP, file);
   else
     {
Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md	(revision 198174)
+++ gcc/config/rs6000/rs6000.md	(working copy)
@@ -2110,6 +2111,8 @@ 
 {
   operands[3] = simplify_gen_subreg (SImode, operands[0], HImode, 0);
   operands[4] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
+  /* We are always BITS_BIG_ENDIAN, so the (const_int 16) above is
+     correct for -mlittle as well as -mbig.  */
 }")
 
 (define_insn "*bswapsi2_extenddi"
@@ -2158,7 +2161,11 @@ 
 			 (const_int 16))
 	(rotate:SI (match_dup 1)
 		   (const_int 16)))]
-  "")
+  "
+{
+  /* We are always BITS_BIG_ENDIAN, so the bit positions above in
+     zero_extract insns do not change for -mlittle.  */
+}")
 
 (define_expand "bswapdi2"
   [(parallel [(set (match_operand:DI 0 "reg_or_mem_operand" "")
@@ -2225,8 +2232,10 @@ 
   rtx op2    = operands[2];
   rtx op3    = operands[3];
   rtx op4    = operands[4];
-  rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode, 4);
-  rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode, 4);
+  rtx op3_32 = simplify_gen_subreg (SImode, op3, DImode,
+				    BYTES_BIG_ENDIAN ? 4 : 0);
+  rtx op4_32 = simplify_gen_subreg (SImode, op4, DImode,
+				    BYTES_BIG_ENDIAN ? 4 : 0);
   rtx addr1;
   rtx addr2;
   rtx word_high;
@@ -2286,8 +2295,10 @@ 
   rtx src    = operands[1];
   rtx op2    = operands[2];
   rtx op3    = operands[3];
-  rtx src_si = simplify_gen_subreg (SImode, src, DImode, 4);
-  rtx op3_si = simplify_gen_subreg (SImode, op3, DImode, 4);
+  rtx src_si = simplify_gen_subreg (SImode, src, DImode,
+				    BYTES_BIG_ENDIAN ? 4 : 0);
+  rtx op3_si = simplify_gen_subreg (SImode, op3, DImode,
+				    BYTES_BIG_ENDIAN ? 4 : 0);
   rtx addr1;
   rtx addr2;
   rtx word_high;
@@ -2347,10 +2358,11 @@ 
   rtx src     = operands[1];
   rtx op2     = operands[2];
   rtx op3     = operands[3];
-  rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, 4);
-  rtx src_si  = simplify_gen_subreg (SImode, src, DImode, 4);
-  rtx op2_si  = simplify_gen_subreg (SImode, op2, DImode, 4);
-  rtx op3_si  = simplify_gen_subreg (SImode, op3, DImode, 4);
+  int lo_off  = BYTES_BIG_ENDIAN ? 4 : 0;
+  rtx dest_si = simplify_gen_subreg (SImode, dest, DImode, lo_off);
+  rtx src_si  = simplify_gen_subreg (SImode, src, DImode, lo_off);
+  rtx op2_si  = simplify_gen_subreg (SImode, op2, DImode, lo_off);
+  rtx op3_si  = simplify_gen_subreg (SImode, op3, DImode, lo_off);
 
   emit_insn (gen_lshrdi3 (op2, src, GEN_INT (32)));
   emit_insn (gen_bswapsi2 (dest_si, src_si));
@@ -2375,15 +2387,15 @@ 
   [(const_int 0)]
   "
 {
-  rtx dest   = operands[0];
-  rtx src    = operands[1];
-  rtx op2    = operands[2];
-  rtx dest_hi = simplify_gen_subreg (SImode, dest, DImode, 0);
-  rtx dest_lo = simplify_gen_subreg (SImode, dest, DImode, 4);
+  rtx dest  = operands[0];
+  rtx src   = operands[1];
+  rtx op2   = operands[2];
+  rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
+  rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
   rtx addr1;
   rtx addr2;
-  rtx word_high;
-  rtx word_low;
+  rtx word1;
+  rtx word2;
 
   addr1 = XEXP (src, 0);
   if (GET_CODE (addr1) == PLUS)
@@ -2408,19 +2420,11 @@ 
       addr2 = gen_rtx_PLUS (SImode, op2, addr1);
     }
 
-  if (BYTES_BIG_ENDIAN)
-    {
-      word_high = change_address (src, SImode, addr1);
-      word_low  = change_address (src, SImode, addr2);
-    }
-  else
-    {
-      word_high = change_address (src, SImode, addr2);
-      word_low  = change_address (src, SImode, addr1);
-    }
+  word1 = change_address (src, SImode, addr1);
+  word2 = change_address (src, SImode, addr2);
 
-  emit_insn (gen_bswapsi2 (dest_hi, word_low));
-  emit_insn (gen_bswapsi2 (dest_lo, word_high));
+  emit_insn (gen_bswapsi2 (dest2, word1));
+  emit_insn (gen_bswapsi2 (dest1, word2));
 }")
 
 (define_split
@@ -2431,15 +2435,15 @@ 
   [(const_int 0)]
   "
 {
-  rtx dest     = operands[0];
-  rtx src      = operands[1];
-  rtx op2      = operands[2];
-  rtx src_high = simplify_gen_subreg (SImode, src, DImode, 0);
-  rtx src_low  = simplify_gen_subreg (SImode, src, DImode, 4);
+  rtx dest = operands[0];
+  rtx src  = operands[1];
+  rtx op2  = operands[2];
+  rtx src1 = simplify_gen_subreg (SImode, src, DImode, 0);
+  rtx src2 = simplify_gen_subreg (SImode, src, DImode, 4);
   rtx addr1;
   rtx addr2;
-  rtx word_high;
-  rtx word_low;
+  rtx word1;
+  rtx word2;
 
   addr1 = XEXP (dest, 0);
   if (GET_CODE (addr1) == PLUS)
@@ -2464,19 +2468,11 @@ 
       addr2 = gen_rtx_PLUS (SImode, op2, addr1);
     }
 
-  if (BYTES_BIG_ENDIAN)
-    {
-      word_high = change_address (dest, SImode, addr1);
-      word_low  = change_address (dest, SImode, addr2);
-    }
-  else
-    {
-      word_high = change_address (dest, SImode, addr2);
-      word_low  = change_address (dest, SImode, addr1);
-    }
+  word1 = change_address (dest, SImode, addr1);
+  word2 = change_address (dest, SImode, addr2);
 
-  emit_insn (gen_bswapsi2 (word_high, src_low));
-  emit_insn (gen_bswapsi2 (word_low, src_high));
+  emit_insn (gen_bswapsi2 (word2, src1));
+  emit_insn (gen_bswapsi2 (word1, src2));
 }")
 
 (define_split
@@ -2487,15 +2483,15 @@ 
   [(const_int 0)]
   "
 {
-  rtx dest      = operands[0];
-  rtx src       = operands[1];
-  rtx src_high  = simplify_gen_subreg (SImode, src, DImode, 0);
-  rtx src_low   = simplify_gen_subreg (SImode, src, DImode, 4);
-  rtx dest_high = simplify_gen_subreg (SImode, dest, DImode, 0);
-  rtx dest_low  = simplify_gen_subreg (SImode, dest, DImode, 4);
+  rtx dest  = operands[0];
+  rtx src   = operands[1];
+  rtx src1  = simplify_gen_subreg (SImode, src, DImode, 0);
+  rtx src2  = simplify_gen_subreg (SImode, src, DImode, 4);
+  rtx dest1 = simplify_gen_subreg (SImode, dest, DImode, 0);
+  rtx dest2 = simplify_gen_subreg (SImode, dest, DImode, 4);
 
-  emit_insn (gen_bswapsi2 (dest_high, src_low));
-  emit_insn (gen_bswapsi2 (dest_low, src_high));
+  emit_insn (gen_bswapsi2 (dest1, src2));
+  emit_insn (gen_bswapsi2 (dest2, src1));
 }")
 
 (define_insn "mulsi3"
Index: gcc/config/rs6000/sysv4.h
===================================================================
--- gcc/config/rs6000/sysv4.h	(revision 198174)
+++ gcc/config/rs6000/sysv4.h	(working copy)
@@ -187,12 +187,6 @@ 
 	     rs6000_abi_name);						\
     }									\
 									\
-  if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN)		\
-    {									\
-      rs6000_isa_flags &= ~OPTION_MASK_LITTLE_ENDIAN;			\
-      error ("-mcall-aixdesc must be big endian");			\
-    }									\
-									\
   if (TARGET_SECURE_PLT != secure_plt)					\
     {									\
       error ("-msecure-plt not supported by your assembler");		\