Commit 76ef61fb by Edgar E. Iglesias Committed by Michael Eager

config.gcc (microblaze*-linux*): Add TARGET_BIG_ENDIAN_DEFAULT

gcc:
	* config.gcc (microblaze*-linux*): Add TARGET_BIG_ENDIAN_DEFAULT
	(microblaze*-*-elf): Likewise
	* config/microblaze/linux.h: Add -mbig-endian / -mlittle-endian to 
	LINK_SPEC
	* config/microblaze/microblaze-c.c: Add builtin defines for _LITTLE_ENDIAN 
	and _BIG_ENDIAN
	* config/microblaze/microblaze.h: Add TARGET_ENDIAN_DEFAULT and add to 
	TARGET_DEFAULT flags.
	Expand ASM_SPEC and LINK_SPEC.
	Update BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN
	* config/microblaze/microblaze.md: Update extendsidi2 and movdi_internal 
	instructions to use low-order / high-order reg print_operands
	* config/microblaze/microblaze.opt: Add mbig-endian and mlittle-endian 
	options and inversemask / mask of LITTLE_ENDIAN
	* config/microblaze/t-microblaze: Expand multilib options to include mlittle-
	endian (le) and update exceptions patterns
gcc/testsuite:
	* 20101011-1.c: Add __MICROBLAZE__ exception to set DO_TEST 0

From-SVN: r195893
parent 5df81313
2013-02-08 Edgar E. Iglesias <edgar.iglesias@gmail.com>
* config.gcc (microblaze*-linux*): Add TARGET_BIG_ENDIAN_DEFAULT
(microblaze*-*-elf): Likewise
* config/microblaze/linux.h: Add -mbig-endian / -mlittle-endian to
LINK_SPEC
* config/microblaze/microblaze-c.c: Add builtin defines for _LITTLE_ENDIAN
and _BIG_ENDIAN
* config/microblaze/microblaze.h: Add TARGET_ENDIAN_DEFAULT and add to
TARGET_DEFAULT flags.
Expand ASM_SPEC and LINK_SPEC.
Update BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN
* config/microblaze/microblaze.md: Update extendsidi2 and movdi_internal
instructions to use low-order / high-order reg print_operands
* config/microblaze/microblaze.opt: Add mbig-endian and mlittle-endian
options and inversemask / mask of LITTLE_ENDIAN
* config/microblaze/t-microblaze: Expand multilib options to include mlittle-
endian (le) and update exceptions patterns
2013-02-08 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/56195
......
......@@ -1737,11 +1737,20 @@ mep-*-*)
use_gcc_stdint=wrap
;;
microblaze*-linux*)
case $target in
microblazeel-*)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0"
;;
microblaze-*)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321"
;;
esac
tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h"
tm_file="${tm_file} glibc-stdint.h"
c_target_objs="${c_target_objs} microblaze-c.o"
cxx_target_objs="${cxx_target_objs} microblaze-c.o"
tmake_file="${tmake_file} microblaze/t-microblaze"
tmake_file="${tmake_file} microblaze/t-microblaze-linux"
;;
microblaze*-*-rtems*)
tm_file="${tm_file} dbxelf.h"
......@@ -1752,6 +1761,14 @@ microblaze*-*-rtems*)
tmake_file="${tmake_file} t-rtems microblaze/t-rtems"
;;
microblaze*-*-elf)
case $target in
microblazeel-*)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0"
;;
microblaze-*)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321"
;;
esac
tm_file="${tm_file} dbxelf.h newlib-stdint.h"
c_target_objs="${c_target_objs} microblaze-c.o"
cxx_target_objs="${cxx_target_objs} microblaze-c.o"
......
......@@ -31,7 +31,9 @@
%{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker %(dynamic_linker)} \
%{static:-static}}"
%{static:-static}} \
%{mbig-endian:-EB} \
%{mlittle-endian:-EL}"
/* For the microblaze-*-linux* subtarget. */
#undef TARGET_OS_CPP_BUILTINS
......
......@@ -41,6 +41,19 @@ microblaze_cpp_define (cpp_reader *pfile)
builtin_assert ("cpu=microblaze");
builtin_assert ("machine=microblaze");
builtin_define ("__MICROBLAZE__");
builtin_define ("__microblaze__");
if (TARGET_LITTLE_ENDIAN)
{
builtin_define ("_LITTLE_ENDIAN");
builtin_define ("__LITTLE_ENDIAN__");
builtin_define ("__MICROBLAZEEL__");
}
else
{
builtin_define ("_BIG_ENDIAN");
builtin_define ("__BIG_ENDIAN__");
builtin_define ("__MICROBLAZEEB__");
}
if (!TARGET_SOFT_MUL)
{
if (!flag_iso)
......
......@@ -46,8 +46,17 @@ extern enum pipeline_type microblaze_pipe;
#define OBJECT_FORMAT_ELF
#if TARGET_BIG_ENDIAN_DEFAULT
#define TARGET_ENDIAN_DEFAULT 0
#define TARGET_ENDIAN_OPTION "mbig-endian"
#else
#define TARGET_ENDIAN_DEFAULT MASK_LITTLE_ENDIAN
#define TARGET_ENDIAN_OPTION "mlittle-endian"
#endif
/* Default target_flags if no switches are specified */
#define TARGET_DEFAULT (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT)
#define TARGET_DEFAULT (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT \
| TARGET_ENDIAN_DEFAULT)
/* What is the default setting for -mcpu= . We set it to v4.00.a even though
we are actually ahead. This is safest version that has generate code
......@@ -77,12 +86,16 @@ extern enum pipeline_type microblaze_pipe;
#define TARGET_ASM_SPEC ""
#define ASM_SPEC "\
%(target_asm_spec)"
%(target_asm_spec) \
%{mbig-endian:-EB} \
%{mlittle-endian:-EL}"
/* Extra switches sometimes passed to the linker. */
/* -xl-mode-xmdstub translated to -Zxl-mode-xmdstub -- deprecated. */
#define LINK_SPEC "%{shared:-shared} -N -relax \
%{mbig-endian:-EB --oformat=elf32-microblaze} \
%{mlittle-endian:-EL --oformat=elf32-microblazeel} \
%{Zxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} \
%{mxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} \
%{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0} \
......@@ -167,8 +180,8 @@ extern enum pipeline_type microblaze_pipe;
/* Target machine storage layout */
#define BITS_BIG_ENDIAN 0
#define BYTES_BIG_ENDIAN 1
#define WORDS_BIG_ENDIAN 1
#define BYTES_BIG_ENDIAN (TARGET_LITTLE_ENDIAN == 0)
#define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN)
#define BITS_PER_UNIT 8
#define BITS_PER_WORD 32
#define UNITS_PER_WORD 4
......
......@@ -822,14 +822,14 @@
""
{
if (which_alternative == 0)
output_asm_insn ("addk\t%D0,r0,%1", operands);
output_asm_insn ("addk\t%L0,r0,%1", operands);
else
output_asm_insn ("lw%i1\t%D0,%1", operands);
output_asm_insn ("lw%i1\t%L0,%1", operands);
output_asm_insn ("add\t%0,%D0,%D0", operands);
output_asm_insn ("addc\t%0,r0,r0", operands);
output_asm_insn ("beqi\t%0,.+8", operands);
return "addi\t%0,r0,0xffffffff";
output_asm_insn ("add\t%M0,%L0,%L0", operands);
output_asm_insn ("addc\t%M0,r0,r0", operands);
output_asm_insn ("beqi\t%M0,.+8", operands);
return "addi\t%M0,r0,0xffffffff";
}
[(set_attr "type" "multi,multi,multi")
(set_attr "mode" "DI")
......@@ -887,7 +887,7 @@
case 0:
return "addk\t%0,%1\n\taddk\t%D0,%d1";
case 1:
return "addik\t%0,r0,%h1\n\taddik\t%D0,r0,%j1 #li => la";
return "addik\t%M0,r0,%h1\n\taddik\t%L0,r0,%j1 #li => la";
case 2:
return "addk\t%0,r0,r0\n\taddk\t%D0,r0,r0";
case 3:
......
......@@ -55,6 +55,14 @@ mmemcpy
Target Mask(MEMCPY)
Don't optimize block moves, use memcpy
mbig-endian
Target Report RejectNegative InverseMask(LITTLE_ENDIAN)
Assume target CPU is configured as big endian
mlittle-endian
Target Report RejectNegative Mask(LITTLE_ENDIAN)
Assume target CPU is configured as little endian
mxl-soft-mul
Target Mask(SOFT_MUL)
Use the soft multiply emulation (default)
......
MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high
MULTILIB_DIRNAMES = bs m mh
MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high mlittle-endian
MULTILIB_DIRNAMES = bs m mh le
MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high
MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high/mlittle-endian
MULTILIB_EXCEPTIONS += mxl-multiply-high/mlittle-endian
# Extra files
microblaze-c.o: $(srcdir)/config/microblaze/microblaze-c.c \
......
MULTILIB_OPTIONS = mxl-barrel-shift mno-xl-soft-mul mxl-multiply-high
MULTILIB_DIRNAMES = bs m mh
MULTILIB_EXCEPTIONS = *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high
2013-02-08 Edgar E. Iglesias <edgar.iglesias@gmail.com>
* 20101011-1.c: Add __MICROBLAZE__ exception to set DO_TEST 0
2013-02-08 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/56195
......
......@@ -29,6 +29,9 @@
/* Not all Linux kernels deal correctly the breakpoints generated by
MIPS16 divisions by zero. They show up as a SIGTRAP instead. */
# define DO_TEST 0
#elif defined (__MICROBLAZE__)
/* We cannot rely on division by zero generating a trap. */
# define DO_TEST 0
#elif defined (__epiphany__)
/* Epiphany does not have hardware division, and the software implementation
has truly undefined behaviour for division by 0. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment