binutils-gdb/sim/ppc/sim-endian-n.h

135 lines
2.7 KiB
C
Raw Normal View History

/* This file is part of the program psim.
Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef N
#error "N must be #defined"
#endif
/* NOTE: See end of file for #undef */
#define unsigned_N XCONCAT2(unsigned_,N)
#define endian_t2h_N XCONCAT2(endian_t2h_,N)
#define endian_h2t_N XCONCAT2(endian_h2t_,N)
#define _SWAP_N XCONCAT2(_SWAP_,N)
#define swap_N XCONCAT2(swap_,N)
#define endian_h2be_N XCONCAT2(endian_h2be_,N)
#define endian_be2h_N XCONCAT2(endian_be2h_,N)
#define endian_h2le_N XCONCAT2(endian_h2le_,N)
#define endian_le2h_N XCONCAT2(endian_le2h_,N)
* support sim-fpu.c for correct FP emulation. * Makefile.in (LIB_OBJ): Add @sim_fpu@. (ICACHE_CFLAGS, SEMANTICS_CFLAGS): New variables. (icache.o, semantics.o): Add new ICACHE_FLAGS & SEMANTICS_FLAGS. (sim-fpu.o, sim-bits.o, tconfig.h): New targets. * configure.in: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS. Add a check for sim/common/sim-fpu.c. Output sim_fpu and sim_fpu_cflags. * configure: Regenerate. * device.h (device_find_integer_array_property): Match function definition. * gen-icache.c (print_icache_internal_function_declaration): Rename INLINE_ICACHE to PSIM_INLINE_ICACHE. * gen-idecode.c (print_idecode_run_function_header): Rename INLINE_IDECODE to PSIM_INLINE_IDECODE. * gen-semantics.c (print_semantic_function_header): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. * gen-support.c (print_support_function_name): Rename INLINE_SUPPORT to PSIM_INLINE_SUPPORT. * igen.c (print_function_name): Also escape `(' and `)'. (gen_semantics_h): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. (gen_semantics_c): Likewise. Also output includes for "sim-fpu.h" * inline.h (INLINE_SIM_ENDIAN): Renamed INLINE_PSIM_ENDIAN. (EXTERN_SIM_ENDIAN): Renamed EXTERN_PSIM_ENDIAN. (STATIC_INLINE_SIM_ENDIAN): Renamed STATIC_INLINE_PSIM_ENDIAN. (INLINE_LOCALS): Renamed PSIM_INLINE_LOCALS. (EXTERN_SUPPORT): Renamed PSIM_EXTERN_SUPPORT. (INLINE_SUPPORT): Renamed PSIM_INLINE_SUPPORT. (EXTERN_SEMANTICS): Renamed PSIM_EXTERN_SEMANTICS. (INLINE_SEMANTICS): Renamed PSIM_INLINE_SEMANTICS. (EXTERN_IDECODE): Renamed PSIM_EXTERN_IDECODE. (INLINE_IDECODE): Renamed PSIM_INLINE_IDECODE. (EXTERN_ICACHE): Renamed PSIM_EXTERN_ICACHE. (INLINE_ICACHE): Renamed PSIM_INLINE_ICACHE. * options.c (options_inline): Fix names. * sim-endian-n.h: Change INLINE_SIM_ENDIAN to INLINE_PSIM_ENDIAN. * sim-endian.h: Likewise. * sim-main.h: New file. * std-config.h: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS.
2001-12-14 01:22:13 +01:00
INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_t2h_N(unsigned_N raw_in)
{
if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) {
return raw_in;
}
else {
_SWAP_N(return,raw_in);
}
}
* support sim-fpu.c for correct FP emulation. * Makefile.in (LIB_OBJ): Add @sim_fpu@. (ICACHE_CFLAGS, SEMANTICS_CFLAGS): New variables. (icache.o, semantics.o): Add new ICACHE_FLAGS & SEMANTICS_FLAGS. (sim-fpu.o, sim-bits.o, tconfig.h): New targets. * configure.in: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS. Add a check for sim/common/sim-fpu.c. Output sim_fpu and sim_fpu_cflags. * configure: Regenerate. * device.h (device_find_integer_array_property): Match function definition. * gen-icache.c (print_icache_internal_function_declaration): Rename INLINE_ICACHE to PSIM_INLINE_ICACHE. * gen-idecode.c (print_idecode_run_function_header): Rename INLINE_IDECODE to PSIM_INLINE_IDECODE. * gen-semantics.c (print_semantic_function_header): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. * gen-support.c (print_support_function_name): Rename INLINE_SUPPORT to PSIM_INLINE_SUPPORT. * igen.c (print_function_name): Also escape `(' and `)'. (gen_semantics_h): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. (gen_semantics_c): Likewise. Also output includes for "sim-fpu.h" * inline.h (INLINE_SIM_ENDIAN): Renamed INLINE_PSIM_ENDIAN. (EXTERN_SIM_ENDIAN): Renamed EXTERN_PSIM_ENDIAN. (STATIC_INLINE_SIM_ENDIAN): Renamed STATIC_INLINE_PSIM_ENDIAN. (INLINE_LOCALS): Renamed PSIM_INLINE_LOCALS. (EXTERN_SUPPORT): Renamed PSIM_EXTERN_SUPPORT. (INLINE_SUPPORT): Renamed PSIM_INLINE_SUPPORT. (EXTERN_SEMANTICS): Renamed PSIM_EXTERN_SEMANTICS. (INLINE_SEMANTICS): Renamed PSIM_INLINE_SEMANTICS. (EXTERN_IDECODE): Renamed PSIM_EXTERN_IDECODE. (INLINE_IDECODE): Renamed PSIM_INLINE_IDECODE. (EXTERN_ICACHE): Renamed PSIM_EXTERN_ICACHE. (INLINE_ICACHE): Renamed PSIM_INLINE_ICACHE. * options.c (options_inline): Fix names. * sim-endian-n.h: Change INLINE_SIM_ENDIAN to INLINE_PSIM_ENDIAN. * sim-endian.h: Likewise. * sim-main.h: New file. * std-config.h: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS.
2001-12-14 01:22:13 +01:00
INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_h2t_N(unsigned_N raw_in)
{
if (CURRENT_TARGET_BYTE_ORDER == CURRENT_HOST_BYTE_ORDER) {
return raw_in;
}
else {
_SWAP_N(return,raw_in);
}
}
* support sim-fpu.c for correct FP emulation. * Makefile.in (LIB_OBJ): Add @sim_fpu@. (ICACHE_CFLAGS, SEMANTICS_CFLAGS): New variables. (icache.o, semantics.o): Add new ICACHE_FLAGS & SEMANTICS_FLAGS. (sim-fpu.o, sim-bits.o, tconfig.h): New targets. * configure.in: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS. Add a check for sim/common/sim-fpu.c. Output sim_fpu and sim_fpu_cflags. * configure: Regenerate. * device.h (device_find_integer_array_property): Match function definition. * gen-icache.c (print_icache_internal_function_declaration): Rename INLINE_ICACHE to PSIM_INLINE_ICACHE. * gen-idecode.c (print_idecode_run_function_header): Rename INLINE_IDECODE to PSIM_INLINE_IDECODE. * gen-semantics.c (print_semantic_function_header): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. * gen-support.c (print_support_function_name): Rename INLINE_SUPPORT to PSIM_INLINE_SUPPORT. * igen.c (print_function_name): Also escape `(' and `)'. (gen_semantics_h): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. (gen_semantics_c): Likewise. Also output includes for "sim-fpu.h" * inline.h (INLINE_SIM_ENDIAN): Renamed INLINE_PSIM_ENDIAN. (EXTERN_SIM_ENDIAN): Renamed EXTERN_PSIM_ENDIAN. (STATIC_INLINE_SIM_ENDIAN): Renamed STATIC_INLINE_PSIM_ENDIAN. (INLINE_LOCALS): Renamed PSIM_INLINE_LOCALS. (EXTERN_SUPPORT): Renamed PSIM_EXTERN_SUPPORT. (INLINE_SUPPORT): Renamed PSIM_INLINE_SUPPORT. (EXTERN_SEMANTICS): Renamed PSIM_EXTERN_SEMANTICS. (INLINE_SEMANTICS): Renamed PSIM_INLINE_SEMANTICS. (EXTERN_IDECODE): Renamed PSIM_EXTERN_IDECODE. (INLINE_IDECODE): Renamed PSIM_INLINE_IDECODE. (EXTERN_ICACHE): Renamed PSIM_EXTERN_ICACHE. (INLINE_ICACHE): Renamed PSIM_INLINE_ICACHE. * options.c (options_inline): Fix names. * sim-endian-n.h: Change INLINE_SIM_ENDIAN to INLINE_PSIM_ENDIAN. * sim-endian.h: Likewise. * sim-main.h: New file. * std-config.h: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS.
2001-12-14 01:22:13 +01:00
INLINE_PSIM_ENDIAN\
(unsigned_N)
swap_N(unsigned_N raw_in)
{
_SWAP_N(return,raw_in);
}
* support sim-fpu.c for correct FP emulation. * Makefile.in (LIB_OBJ): Add @sim_fpu@. (ICACHE_CFLAGS, SEMANTICS_CFLAGS): New variables. (icache.o, semantics.o): Add new ICACHE_FLAGS & SEMANTICS_FLAGS. (sim-fpu.o, sim-bits.o, tconfig.h): New targets. * configure.in: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS. Add a check for sim/common/sim-fpu.c. Output sim_fpu and sim_fpu_cflags. * configure: Regenerate. * device.h (device_find_integer_array_property): Match function definition. * gen-icache.c (print_icache_internal_function_declaration): Rename INLINE_ICACHE to PSIM_INLINE_ICACHE. * gen-idecode.c (print_idecode_run_function_header): Rename INLINE_IDECODE to PSIM_INLINE_IDECODE. * gen-semantics.c (print_semantic_function_header): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. * gen-support.c (print_support_function_name): Rename INLINE_SUPPORT to PSIM_INLINE_SUPPORT. * igen.c (print_function_name): Also escape `(' and `)'. (gen_semantics_h): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. (gen_semantics_c): Likewise. Also output includes for "sim-fpu.h" * inline.h (INLINE_SIM_ENDIAN): Renamed INLINE_PSIM_ENDIAN. (EXTERN_SIM_ENDIAN): Renamed EXTERN_PSIM_ENDIAN. (STATIC_INLINE_SIM_ENDIAN): Renamed STATIC_INLINE_PSIM_ENDIAN. (INLINE_LOCALS): Renamed PSIM_INLINE_LOCALS. (EXTERN_SUPPORT): Renamed PSIM_EXTERN_SUPPORT. (INLINE_SUPPORT): Renamed PSIM_INLINE_SUPPORT. (EXTERN_SEMANTICS): Renamed PSIM_EXTERN_SEMANTICS. (INLINE_SEMANTICS): Renamed PSIM_INLINE_SEMANTICS. (EXTERN_IDECODE): Renamed PSIM_EXTERN_IDECODE. (INLINE_IDECODE): Renamed PSIM_INLINE_IDECODE. (EXTERN_ICACHE): Renamed PSIM_EXTERN_ICACHE. (INLINE_ICACHE): Renamed PSIM_INLINE_ICACHE. * options.c (options_inline): Fix names. * sim-endian-n.h: Change INLINE_SIM_ENDIAN to INLINE_PSIM_ENDIAN. * sim-endian.h: Likewise. * sim-main.h: New file. * std-config.h: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS.
2001-12-14 01:22:13 +01:00
INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_h2be_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) {
return raw_in;
}
else {
_SWAP_N(return,raw_in);
}
}
* support sim-fpu.c for correct FP emulation. * Makefile.in (LIB_OBJ): Add @sim_fpu@. (ICACHE_CFLAGS, SEMANTICS_CFLAGS): New variables. (icache.o, semantics.o): Add new ICACHE_FLAGS & SEMANTICS_FLAGS. (sim-fpu.o, sim-bits.o, tconfig.h): New targets. * configure.in: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS. Add a check for sim/common/sim-fpu.c. Output sim_fpu and sim_fpu_cflags. * configure: Regenerate. * device.h (device_find_integer_array_property): Match function definition. * gen-icache.c (print_icache_internal_function_declaration): Rename INLINE_ICACHE to PSIM_INLINE_ICACHE. * gen-idecode.c (print_idecode_run_function_header): Rename INLINE_IDECODE to PSIM_INLINE_IDECODE. * gen-semantics.c (print_semantic_function_header): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. * gen-support.c (print_support_function_name): Rename INLINE_SUPPORT to PSIM_INLINE_SUPPORT. * igen.c (print_function_name): Also escape `(' and `)'. (gen_semantics_h): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. (gen_semantics_c): Likewise. Also output includes for "sim-fpu.h" * inline.h (INLINE_SIM_ENDIAN): Renamed INLINE_PSIM_ENDIAN. (EXTERN_SIM_ENDIAN): Renamed EXTERN_PSIM_ENDIAN. (STATIC_INLINE_SIM_ENDIAN): Renamed STATIC_INLINE_PSIM_ENDIAN. (INLINE_LOCALS): Renamed PSIM_INLINE_LOCALS. (EXTERN_SUPPORT): Renamed PSIM_EXTERN_SUPPORT. (INLINE_SUPPORT): Renamed PSIM_INLINE_SUPPORT. (EXTERN_SEMANTICS): Renamed PSIM_EXTERN_SEMANTICS. (INLINE_SEMANTICS): Renamed PSIM_INLINE_SEMANTICS. (EXTERN_IDECODE): Renamed PSIM_EXTERN_IDECODE. (INLINE_IDECODE): Renamed PSIM_INLINE_IDECODE. (EXTERN_ICACHE): Renamed PSIM_EXTERN_ICACHE. (INLINE_ICACHE): Renamed PSIM_INLINE_ICACHE. * options.c (options_inline): Fix names. * sim-endian-n.h: Change INLINE_SIM_ENDIAN to INLINE_PSIM_ENDIAN. * sim-endian.h: Likewise. * sim-main.h: New file. * std-config.h: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS.
2001-12-14 01:22:13 +01:00
INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_be2h_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == BIG_ENDIAN) {
return raw_in;
}
else {
_SWAP_N(return,raw_in);
}
}
* support sim-fpu.c for correct FP emulation. * Makefile.in (LIB_OBJ): Add @sim_fpu@. (ICACHE_CFLAGS, SEMANTICS_CFLAGS): New variables. (icache.o, semantics.o): Add new ICACHE_FLAGS & SEMANTICS_FLAGS. (sim-fpu.o, sim-bits.o, tconfig.h): New targets. * configure.in: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS. Add a check for sim/common/sim-fpu.c. Output sim_fpu and sim_fpu_cflags. * configure: Regenerate. * device.h (device_find_integer_array_property): Match function definition. * gen-icache.c (print_icache_internal_function_declaration): Rename INLINE_ICACHE to PSIM_INLINE_ICACHE. * gen-idecode.c (print_idecode_run_function_header): Rename INLINE_IDECODE to PSIM_INLINE_IDECODE. * gen-semantics.c (print_semantic_function_header): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. * gen-support.c (print_support_function_name): Rename INLINE_SUPPORT to PSIM_INLINE_SUPPORT. * igen.c (print_function_name): Also escape `(' and `)'. (gen_semantics_h): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. (gen_semantics_c): Likewise. Also output includes for "sim-fpu.h" * inline.h (INLINE_SIM_ENDIAN): Renamed INLINE_PSIM_ENDIAN. (EXTERN_SIM_ENDIAN): Renamed EXTERN_PSIM_ENDIAN. (STATIC_INLINE_SIM_ENDIAN): Renamed STATIC_INLINE_PSIM_ENDIAN. (INLINE_LOCALS): Renamed PSIM_INLINE_LOCALS. (EXTERN_SUPPORT): Renamed PSIM_EXTERN_SUPPORT. (INLINE_SUPPORT): Renamed PSIM_INLINE_SUPPORT. (EXTERN_SEMANTICS): Renamed PSIM_EXTERN_SEMANTICS. (INLINE_SEMANTICS): Renamed PSIM_INLINE_SEMANTICS. (EXTERN_IDECODE): Renamed PSIM_EXTERN_IDECODE. (INLINE_IDECODE): Renamed PSIM_INLINE_IDECODE. (EXTERN_ICACHE): Renamed PSIM_EXTERN_ICACHE. (INLINE_ICACHE): Renamed PSIM_INLINE_ICACHE. * options.c (options_inline): Fix names. * sim-endian-n.h: Change INLINE_SIM_ENDIAN to INLINE_PSIM_ENDIAN. * sim-endian.h: Likewise. * sim-main.h: New file. * std-config.h: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS.
2001-12-14 01:22:13 +01:00
INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_h2le_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) {
return raw_in;
}
else {
_SWAP_N(return,raw_in);
}
}
* support sim-fpu.c for correct FP emulation. * Makefile.in (LIB_OBJ): Add @sim_fpu@. (ICACHE_CFLAGS, SEMANTICS_CFLAGS): New variables. (icache.o, semantics.o): Add new ICACHE_FLAGS & SEMANTICS_FLAGS. (sim-fpu.o, sim-bits.o, tconfig.h): New targets. * configure.in: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS. Add a check for sim/common/sim-fpu.c. Output sim_fpu and sim_fpu_cflags. * configure: Regenerate. * device.h (device_find_integer_array_property): Match function definition. * gen-icache.c (print_icache_internal_function_declaration): Rename INLINE_ICACHE to PSIM_INLINE_ICACHE. * gen-idecode.c (print_idecode_run_function_header): Rename INLINE_IDECODE to PSIM_INLINE_IDECODE. * gen-semantics.c (print_semantic_function_header): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. * gen-support.c (print_support_function_name): Rename INLINE_SUPPORT to PSIM_INLINE_SUPPORT. * igen.c (print_function_name): Also escape `(' and `)'. (gen_semantics_h): Rename EXTERN_SEMANTICS to PSIM_EXTERN_SEMANTICS. (gen_semantics_c): Likewise. Also output includes for "sim-fpu.h" * inline.h (INLINE_SIM_ENDIAN): Renamed INLINE_PSIM_ENDIAN. (EXTERN_SIM_ENDIAN): Renamed EXTERN_PSIM_ENDIAN. (STATIC_INLINE_SIM_ENDIAN): Renamed STATIC_INLINE_PSIM_ENDIAN. (INLINE_LOCALS): Renamed PSIM_INLINE_LOCALS. (EXTERN_SUPPORT): Renamed PSIM_EXTERN_SUPPORT. (INLINE_SUPPORT): Renamed PSIM_INLINE_SUPPORT. (EXTERN_SEMANTICS): Renamed PSIM_EXTERN_SEMANTICS. (INLINE_SEMANTICS): Renamed PSIM_INLINE_SEMANTICS. (EXTERN_IDECODE): Renamed PSIM_EXTERN_IDECODE. (INLINE_IDECODE): Renamed PSIM_INLINE_IDECODE. (EXTERN_ICACHE): Renamed PSIM_EXTERN_ICACHE. (INLINE_ICACHE): Renamed PSIM_INLINE_ICACHE. * options.c (options_inline): Fix names. * sim-endian-n.h: Change INLINE_SIM_ENDIAN to INLINE_PSIM_ENDIAN. * sim-endian.h: Likewise. * sim-main.h: New file. * std-config.h: Rename INLINE_LOCALS to PSIM_INLINE_LOCALS.
2001-12-14 01:22:13 +01:00
INLINE_PSIM_ENDIAN\
(unsigned_N)
endian_le2h_N(unsigned_N raw_in)
{
if (CURRENT_HOST_BYTE_ORDER == LITTLE_ENDIAN) {
return raw_in;
}
else {
_SWAP_N(return,raw_in);
}
}
/* NOTE: See start of file for #define */
#undef unsigned_N
#undef endian_t2h_N
#undef endian_h2t_N
#undef _SWAP_N
#undef swap_N
#undef endian_h2be_N
#undef endian_be2h_N
#undef endian_h2le_N
#undef endian_le2h_N