Commit 9db1d521 by Hartmut Penner

s390.c: New.

        * config/s390/s390.c: New. Subroutines for code generation.
        * config/s390/s390.h: New. Definitions for s/390.
        * config/s390/s390-protos.h: New. Prototypes.
        * config/s390/linux.h: New. Definitions for linux for s/390.
        * config/s390/linux64.h: New. Definitions for linux for zSeries.
        * config/s390/t-linux: New. Makefile fragment.
        * config/s390/s390.md: New. Machine description for s/390 and zSeries.
        * config/s390/fixdfdi.h: New. Fix L_fix*di.
---------------------------------------------------------------------

From-SVN: r43980
parent f3ba35e4
#ifdef L_fixunsdfdi
#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
#define EXCESSD 1022
#define SIGNBIT 0x80000000
#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
#define FRACD_LL(fp) (fp.ll & (HIDDEND_LL-1))
#define HIDDEND_LL ((long long)1 << 52)
union double_long {
double d;
struct {
long upper;
unsigned long lower;
} l;
long long ll;
};
/* convert double to unsigned int */
unsigned long long
__fixunsdfdi (double a1)
{
register union double_long dl1;
register int exp;
register long long l;
dl1.d = a1;
/* +/- 0, denormalized, negativ */
if (!EXPD (dl1) || SIGND(dl1))
return 0;
exp = EXPD (dl1) - EXCESSD - 53;
/* number < 1 */
if (exp < -53)
return 0;
/* NaN */
if ((EXPD(dl1) == 0x7ff) && (FRACD_LL(dl1) != 0)) /* NaN */
return 0x0ULL;
/* Number big number & + inf */
if (exp >= 12) {
return 0xFFFFFFFFFFFFFFFFULL;
}
l = MANTD_LL(dl1);
/* shift down until exp < 12 or l = 0 */
if (exp > 0)
l <<= exp;
else
l >>= -exp;
return l;
}
#define __fixunsdfdi ___fixunsdfdi
#endif
#undef L_fixunsdfdi
#ifdef L_fixdfdi
#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
#define EXCESSD 1022
#define SIGNBIT 0x80000000
#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
#define FRACD_LL(fp) (fp.ll & (HIDDEND_LL-1))
#define HIDDEND_LL ((long long)1 << 52)
union double_long {
double d;
struct {
long upper;
unsigned long lower;
} l;
long long ll;
};
/* convert double to int */
long long
__fixdfdi (double a1)
{
register union double_long dl1;
register int exp;
register long long l;
dl1.d = a1;
/* +/- 0, denormalized */
if (!EXPD (dl1))
return 0;
exp = EXPD (dl1) - EXCESSD - 53;
/* number < 1 */
if (exp < -53)
return 0;
/* NaN */
if ((EXPD(dl1) == 0x7ff) && (FRACD_LL(dl1) != 0)) /* NaN */
return 0x8000000000000000ULL;
/* Number big number & +/- inf */
if (exp >= 11) {
l = (long long)1<<63;
if (!SIGND(dl1))
l--;
return l;
}
l = MANTD_LL(dl1);
/* shift down until exp < 12 or l = 0 */
if (exp > 0)
l <<= exp;
else
l >>= -exp;
return (SIGND (dl1) ? -l : l);
}
#define __fixdfdi ___fixdfdi
#endif
#undef L_fixdfdi
/* Definitions for Linux for s/390 zSeries
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com) and
Ulrich Weigand (weigand@de.ibm.com).
This file is part of GNU CC.
GNU CC 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, or (at your option)
any later version.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _LINUX64_H
#define _LINUX64_H
#include <s390/linux.h> /* Base linux target machine definitions*/
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "long int"
#undef TARGET_DEFAULT
#define TARGET_DEFAULT 0x13
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (Linux for S/390 zSeries 64 bit)");
/* Names to predefine in the preprocessor for this target machine. */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES "-Dlinux -Asystem(linux) -Acpu(s390) -Amachine(s390) -D__s390x__ -Asystem(unix) -Dunix -D__ELF__"
#undef LINK_SPEC
#ifdef CROSS_COMPILE
#define LINK_SPEC "-m elf64_s390 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld64.so.1 \
-rpath-link=/usr/local/s390x-ibm-linux/lib}} \
%{static:-static}}}"
#else
#define LINK_SPEC "-m elf64_s390 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld64.so.1}} \
%{static:-static}}}"
#endif
#undef INT_ASM_OP
#define INT_ASM_OP "\t.quad\t"
#undef PROMOTE_PROTOTYPES
#undef MASK_RETURN_ADDR
#undef SELECT_SECTION
/* With 64 bit new linkage for floating point registers. */
#undef CALL_USED_REGISTERS
#define CALL_USED_REGISTERS \
{ 1, 1, 1, 1, \
1, 1, 0, 0, \
0, 0, 0, 0, \
0, 1, 1, 1, \
1, 1, 1, 1, \
1, 1, 1, 1, \
0, 0, 0, 0, \
0, 0, 0, 0, \
1 }
#endif
/* Definitions of target machine for GNU compiler, for IBM S/390.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com)
This file is part of GNU CC.
GNU CC 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, or (at your option)
any later version.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Declare functions in s390.c and linux.c */
#ifdef RTX_CODE
#ifdef TREE_CODE
extern void init_cumulative_args PARAMS ((CUMULATIVE_ARGS *, tree, rtx, int));
extern void s390_va_start PARAMS ((int, tree, rtx));
#endif /* TREE_CODE */
extern int fp_operand PARAMS ((rtx, enum machine_mode));
extern int s_operand PARAMS ((rtx, enum machine_mode));
extern int larl_operand PARAMS ((rtx, enum machine_mode));
extern int r_or_im8_operand PARAMS ((rtx, enum machine_mode));
extern int r_or_s_operand PARAMS ((rtx, enum machine_mode));
extern int r_or_s_or_im8_operand PARAMS ((rtx, enum machine_mode));
extern int r_or_x_or_im16_operand PARAMS ((rtx, enum machine_mode));
extern int bras_sym_operand PARAMS ((rtx, enum machine_mode));
extern int load_multiple_operation PARAMS ((rtx, enum machine_mode));
extern int store_multiple_operation PARAMS ((rtx, enum machine_mode));
extern int dead_p PARAMS ((rtx, rtx));
extern void print_operand PARAMS ((FILE *, rtx, char));
extern void print_operand_address PARAMS ((FILE *, rtx));
extern int legitimate_pic_operand_p PARAMS ((rtx));
extern int legitimate_constant_p PARAMS ((rtx));
extern int unsigned_comparison_operator PARAMS ((rtx));
extern int unsigned_jump_follows_p PARAMS ((rtx));
extern void update_cc PARAMS ((rtx, rtx));
extern void s390_initialize_trampoline PARAMS ((rtx, rtx, rtx));
extern void s390_output_symbolic_const PARAMS ((FILE *, rtx));
extern int s390_adjust_cost PARAMS ((rtx, rtx, rtx, int));
extern int s390_stop_dump_lit_p PARAMS ((rtx));
extern void s390_dump_literal_pool PARAMS ((rtx, rtx));
extern void s390_expand_eh_epilogue PARAMS ((rtx, rtx, rtx));
extern void s390_asm_output_external_libcall PARAMS ((FILE *, rtx));
#endif /* RTX_CODE */
#ifdef TREE_CODE
extern void s390_function_arg_advance PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int));
extern struct rtx_def *s390_function_arg PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode, tree, int));
extern int s390_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode, tree, int));
extern int s390_function_arg_pass_by_reference PARAMS ((enum machine_mode, tree));
extern void setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode, tree,
int *, int));
extern struct rtx_def *s390_va_arg PARAMS ((tree, tree));
extern union tree_node *s390_build_va_list PARAMS ((void));
extern void s390_asm_output_pool_prologue PARAMS ((FILE *, char *, tree, int));
extern void encode_section_info PARAMS ((tree));
#endif /* TREE_CODE */
extern void s390_trampoline_template PARAMS ((FILE *));
extern void s390_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
extern void s390_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
extern void s390_final_chunkify PARAMS ((int));
extern int s390_arg_frame_offset PARAMS ((void));
This source diff could not be displayed because it is too large. You can view the blob instead.
# The crtbegin and crtend must not depend on a small GOT
CRTSTUFF_T_CFLAGS = -O2 -fPIC
linux.o: $(srcdir)/config/s390/linux.c $(CONFIG_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/s390/linux.c
# Compile libgcc2.a with pic.
TARGET_LIBGCC2_CFLAGS = -fPIC -include $(srcdir)/config/s390/fixdfdi.h
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