config.host: Match little-endian powerpc-linux.

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.

From-SVN: r198273
This commit is contained in:
Alan Modra 2013-04-25 10:27:16 +09:30 committed by Alan Modra
parent 87f7337481
commit b9a7eb5db3
12 changed files with 136 additions and 88 deletions

View File

@ -1,3 +1,25 @@
2013-04-25 Alan Modra <amodra@gmail.com>
* 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.
2013-04-25 Alan Modra <amodra@gmail.com>
* config/rs6000/rs6000.c (rs6000_secondary_reload_inner): Use

View File

@ -2086,20 +2086,24 @@ powerpc-*-rtems*)
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
;;

View File

@ -18,5 +18,10 @@ 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/>. */
#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

View File

@ -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}"

View File

@ -212,10 +212,6 @@ extern int dot_symbols;
#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 +372,19 @@ extern int dot_symbols;
#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 "}}"

View File

@ -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

View File

@ -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"

View File

@ -22408,20 +22408,22 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
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],",
@ -22448,18 +22450,19 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
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],",
@ -22483,7 +22486,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
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);
@ -22492,7 +22495,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
}
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);
@ -22524,9 +22527,8 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
}
#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.)
@ -22537,7 +22539,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
/* 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),
@ -22552,7 +22554,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
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],",
@ -22565,7 +22567,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
{
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],",
@ -22575,7 +22577,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
}
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);
@ -22613,7 +22615,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
gcc_unreachable ();
}
if (TARGET_MINIMAL_TOC)
if (TARGET_ELF || TARGET_MINIMAL_TOC)
fputs (TARGET_32BIT ? "\t.long " : DOUBLE_INT_ASM_OP, file);
else
{

View File

@ -2090,6 +2090,8 @@
[(set_attr "length" "4,4,12")
(set_attr "type" "load,store,*")])
;; We are always BITS_BIG_ENDIAN, so the (const_int 16) below is
;; correct for -mlittle as well as -mbig.
(define_split
[(set (match_operand:HI 0 "gpc_reg_operand" "")
(bswap:HI (match_operand:HI 1 "gpc_reg_operand" "")))
@ -2143,6 +2145,8 @@
[(set_attr "length" "4,4,12")
(set_attr "type" "load,store,*")])
;; We are always BITS_BIG_ENDIAN, so the bit positions below in
;; zero_extract insns do not change for -mlittle.
(define_split
[(set (match_operand:SI 0 "gpc_reg_operand" "")
(bswap:SI (match_operand:SI 1 "gpc_reg_operand" "")))]
@ -2225,8 +2229,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 +2292,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 +2355,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 +2384,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 +2417,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 +2432,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 +2465,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 +2480,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"

View File

@ -187,12 +187,6 @@ do { \
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"); \

View File

@ -1,3 +1,7 @@
2013-04-25 Alan Modra <amodra@gmail.com>
* config.host: Match little-endian powerpc-linux.
2013-04-19 Yufeng Zhang <yufeng.zhang@arm.com>
* config/aarch64/sfp-machine.h (_FP_W_TYPE): Change to define

View File

@ -882,7 +882,7 @@ powerpc-*-rtems*)
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