Merge some alpha patches from base; this does not work yet, but it's better

than what is currently there.  tested by landry@ some time ago

ok brad@
This commit is contained in:
pascal 2014-01-18 11:38:22 +00:00
parent 9e7908fe2e
commit d3a58e667e
6 changed files with 451 additions and 13 deletions

View File

@ -0,0 +1,257 @@
$OpenBSD: patch-gcc_config_alpha_alpha_c,v 1.1 2014/01/18 11:38:22 pascal Exp $
--- gcc/config/alpha/alpha.c.orig Sun Apr 22 03:30:31 2007
+++ gcc/config/alpha/alpha.c Sat Dec 7 10:58:29 2013
@@ -226,6 +226,10 @@ alpha_handle_option (size_t code, const char *arg, int
target_flags |= MASK_IEEE_CONFORMANT;
break;
+ case OPT_mno_ieee:
+ target_flags &= ~(MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT);
+ break;
+
case OPT_mtls_size_:
if (value != 16 && value != 32 && value != 64)
error ("bad value %qs for -mtls-size switch", arg);
@@ -287,12 +291,19 @@ override_options (void)
flag_pic = 0;
}
+#if defined(OPENBSD_NATIVE) || defined(OPENBSD_CROSS)
+ if (TARGET_FLOAT_VAX)
+ alpha_fprm = ALPHA_FPRM_NORM;
+ else
+ alpha_fprm = ALPHA_FPRM_DYN;
+#else
/* On Unicos/Mk, the native compiler consistently generates /d suffices for
floating-point instructions. Make that the default for this target. */
if (TARGET_ABI_UNICOSMK)
alpha_fprm = ALPHA_FPRM_DYN;
else
alpha_fprm = ALPHA_FPRM_NORM;
+#endif
alpha_tp = ALPHA_TP_PROG;
alpha_fptm = ALPHA_FPTM_N;
@@ -482,11 +493,17 @@ override_options (void)
if (!g_switch_set)
g_switch_value = 8;
+#ifdef OPENBSD_NATIVE
+ /* Make -fpic behave as -fPIC unless -msmall-data is specified. */
+ if (flag_pic == 2 && TARGET_SMALL_DATA)
+ warning (0, "-fPIC used with -msmall-data");
+#else
/* Infer TARGET_SMALL_DATA from -fpic/-fPIC. */
if (flag_pic == 1)
target_flags |= MASK_SMALL_DATA;
else if (flag_pic == 2)
target_flags &= ~MASK_SMALL_DATA;
+#endif
/* Align labels and loops for optimal branching. */
/* ??? Kludge these by not doing anything if we don't optimize and also if
@@ -7598,94 +7615,134 @@ alpha_expand_prologue (void)
Note that we are only allowed to adjust sp once in the prologue. */
- if (frame_size <= 32768)
+ if (flag_stack_check || STACK_CHECK_BUILTIN)
{
- if (frame_size > 4096)
+ if (frame_size <= 32768)
{
- int probed;
+ if (frame_size > 4096)
+ {
+ int probed;
- for (probed = 4096; probed < frame_size; probed += 8192)
- emit_insn (gen_probe_stack (GEN_INT (TARGET_ABI_UNICOSMK
- ? -probed + 64
- : -probed)));
+ for (probed = 4096; probed < frame_size; probed += 8192)
+ emit_insn (gen_probe_stack (GEN_INT (TARGET_ABI_UNICOSMK
+ ? -probed + 64
+ : -probed)));
- /* We only have to do this probe if we aren't saving registers. */
- if (sa_size == 0 && frame_size > probed - 4096)
- emit_insn (gen_probe_stack (GEN_INT (-frame_size)));
+ /* We only have to do this probe if we aren't saving
+ registers. */
+ if (sa_size == 0 && frame_size > probed - 4096)
+ emit_insn (gen_probe_stack (GEN_INT (-frame_size)));
+ }
+
+ if (frame_size != 0)
+ FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))));
}
+ else
+ {
+ /* Here we generate code to set R22 to SP + 4096 and set R23 to the
+ number of 8192 byte blocks to probe. We then probe each block
+ in the loop and then set SP to the proper location. If the
+ amount remaining is > 4096, we have to do one more probe if we
+ are not saving any registers. */
- if (frame_size != 0)
- FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (TARGET_ABI_UNICOSMK
- ? -frame_size + 64
- : -frame_size))));
- }
- else
- {
- /* Here we generate code to set R22 to SP + 4096 and set R23 to the
- number of 8192 byte blocks to probe. We then probe each block
- in the loop and then set SP to the proper location. If the
- amount remaining is > 4096, we have to do one more probe if we
- are not saving any registers. */
+ HOST_WIDE_INT blocks = (frame_size + 4096) / 8192;
+ HOST_WIDE_INT leftover = frame_size + 4096 - blocks * 8192;
+ rtx ptr = gen_rtx_REG (DImode, 22);
+ rtx count = gen_rtx_REG (DImode, 23);
+ rtx seq;
- HOST_WIDE_INT blocks = (frame_size + 4096) / 8192;
- HOST_WIDE_INT leftover = frame_size + 4096 - blocks * 8192;
- rtx ptr = gen_rtx_REG (DImode, 22);
- rtx count = gen_rtx_REG (DImode, 23);
- rtx seq;
+ emit_move_insn (count, GEN_INT (blocks));
+ emit_insn (gen_adddi3 (ptr, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? 4096 - 64 : 4096)));
- emit_move_insn (count, GEN_INT (blocks));
- emit_insn (gen_adddi3 (ptr, stack_pointer_rtx,
- GEN_INT (TARGET_ABI_UNICOSMK ? 4096 - 64 : 4096)));
+ /* Because of the difficulty in emitting a new basic block this
+ late in the compilation, generate the loop as a single insn. */
+ emit_insn (gen_prologue_stack_probe_loop (count, ptr));
- /* Because of the difficulty in emitting a new basic block this
- late in the compilation, generate the loop as a single insn. */
- emit_insn (gen_prologue_stack_probe_loop (count, ptr));
+ if (leftover > 4096 && sa_size == 0)
+ {
+ rtx last = gen_rtx_MEM (DImode, plus_constant (ptr, -leftover));
+ MEM_VOLATILE_P (last) = 1;
+ emit_move_insn (last, const0_rtx);
+ }
- if (leftover > 4096 && sa_size == 0)
- {
- rtx last = gen_rtx_MEM (DImode, plus_constant (ptr, -leftover));
- MEM_VOLATILE_P (last) = 1;
- emit_move_insn (last, const0_rtx);
- }
+ if (TARGET_ABI_WINDOWS_NT)
+ {
+ /* For NT stack unwind (done by 'reverse execution'), it's
+ not OK to take the result of a loop, even though the value
+ is already in ptr, so we reload it via a single operation
+ and subtract it to sp.
- if (TARGET_ABI_WINDOWS_NT)
- {
- /* For NT stack unwind (done by 'reverse execution'), it's
- not OK to take the result of a loop, even though the value
- is already in ptr, so we reload it via a single operation
- and subtract it to sp.
+ Yes, that's correct -- we have to reload the whole constant
+ into a temporary via ldah+lda then subtract from sp. */
- Yes, that's correct -- we have to reload the whole constant
- into a temporary via ldah+lda then subtract from sp. */
+ HOST_WIDE_INT lo, hi;
+ lo = ((frame_size & 0xffff) ^ 0x8000) - 0x8000;
+ hi = frame_size - lo;
- HOST_WIDE_INT lo, hi;
- lo = ((frame_size & 0xffff) ^ 0x8000) - 0x8000;
- hi = frame_size - lo;
+ emit_move_insn (ptr, GEN_INT (hi));
+ emit_insn (gen_adddi3 (ptr, ptr, GEN_INT (lo)));
+ seq = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx,
+ ptr));
+ }
+ else
+ {
+ seq = emit_insn (gen_adddi3 (stack_pointer_rtx, ptr,
+ GEN_INT (-leftover)));
+ }
- emit_move_insn (ptr, GEN_INT (hi));
- emit_insn (gen_adddi3 (ptr, ptr, GEN_INT (lo)));
- seq = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx,
- ptr));
+ /* This alternative is special, because the DWARF code cannot
+ possibly intuit through the loop above. So we invent this
+ note it looks at instead. */
+ RTX_FRAME_RELATED_P (seq) = 1;
+ REG_NOTES (seq)
+ = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))),
+ REG_NOTES (seq));
}
+ }
+ else
+ {
+ if (frame_size <= 32768)
+ {
+ if (frame_size != 0)
+ FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))));
+ }
else
{
- seq = emit_insn (gen_adddi3 (stack_pointer_rtx, ptr,
- GEN_INT (-leftover)));
+ rtx count = gen_rtx_REG (DImode, 23);
+ rtx seq;
+
+ emit_move_insn (count, GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size));
+ seq = emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+ count));
+
+ /* This alternative is special, because the DWARF code cannot
+ possibly intuit through the loop above. So we invent this
+ note it looks at instead. */
+ RTX_FRAME_RELATED_P (seq) = 1;
+ REG_NOTES (seq)
+ = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+ gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+ GEN_INT (TARGET_ABI_UNICOSMK
+ ? -frame_size + 64
+ : -frame_size))),
+ REG_NOTES (seq));
}
-
- /* This alternative is special, because the DWARF code cannot
- possibly intuit through the loop above. So we invent this
- note it looks at instead. */
- RTX_FRAME_RELATED_P (seq) = 1;
- REG_NOTES (seq)
- = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
- gen_rtx_SET (VOIDmode, stack_pointer_rtx,
- gen_rtx_PLUS (Pmode, stack_pointer_rtx,
- GEN_INT (TARGET_ABI_UNICOSMK
- ? -frame_size + 64
- : -frame_size))),
- REG_NOTES (seq));
}
if (!TARGET_ABI_UNICOSMK)

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-gcc_config_alpha_alpha_h,v 1.1 2014/01/18 11:38:22 pascal Exp $
--- gcc/config/alpha/alpha.h.orig Sat Dec 7 10:55:11 2013
+++ gcc/config/alpha/alpha.h Sat Dec 7 10:55:53 2013
@@ -373,12 +373,11 @@ extern enum alpha_fp_trap_mode alpha_fptm;
/* Align all constants and variables to at least a word boundary so
we can pick up pieces of them faster. */
-/* ??? Only if block-move stuff knows about different source/destination
- alignment. */
-#if 0
#define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
#define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD)
-#endif
+
+/* Make local arrays of chars word-aligned for the same reasons. */
+#define LOCAL_ALIGNMENT(TYPE, ALIGN) DATA_ALIGNMENT (TYPE, ALIGN)
/* Set this nonzero if move instructions will actually fail to work
when given unaligned data.

View File

@ -0,0 +1,71 @@
$OpenBSD: patch-gcc_config_alpha_alpha_md,v 1.1 2014/01/18 11:38:22 pascal Exp $
--- gcc/config/alpha/alpha.md.orig Sat Jan 18 12:08:20 2014
+++ gcc/config/alpha/alpha.md Sat Jan 18 12:09:04 2014
@@ -1701,9 +1701,10 @@
(mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
(set (match_dup 4)
(ashift:DI (match_dup 3)
- (minus:DI (const_int 64)
+ (minus:DI (const_int 56)
(ashift:DI
- (and:DI (match_dup 2) (const_int 7))
+ (and:DI (plus:DI (match_dup 2) (const_int -1))
+ (const_int 7))
(const_int 3)))))
(set (match_operand:DI 0 "register_operand" "")
(ashiftrt:DI (match_dup 4) (const_int 56)))]
@@ -1751,9 +1752,10 @@
(mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
(set (match_dup 4)
(ashift:DI (match_dup 3)
- (minus:DI (const_int 64)
+ (minus:DI (const_int 56)
(ashift:DI
- (and:DI (match_dup 2) (const_int 7))
+ (and:DI (plus:DI (match_dup 2) (const_int -1))
+ (const_int 7))
(const_int 3)))))
(set (match_operand:DI 0 "register_operand" "")
(ashiftrt:DI (match_dup 4) (const_int 48)))]
@@ -1866,10 +1868,11 @@
[(set (match_operand:DI 0 "register_operand" "=r")
(ashift:DI
(match_operand:DI 1 "reg_or_0_operand" "rJ")
- (minus:DI (const_int 64)
+ (minus:DI (const_int 56)
(ashift:DI
(and:DI
- (match_operand:DI 2 "reg_or_8bit_operand" "rI")
+ (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
+ (const_int -1))
(const_int 7))
(const_int 3)))))]
"! WORDS_BIG_ENDIAN"
@@ -1895,10 +1898,11 @@
(ashift:DI
(and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
(const_int 2147483647))
- (minus:DI (const_int 64)
+ (minus:DI (const_int 56)
(ashift:DI
(and:DI
- (match_operand:DI 2 "reg_or_8bit_operand" "rI")
+ (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
+ (const_int -1))
(const_int 7))
(const_int 3)))))]
"! WORDS_BIG_ENDIAN"
@@ -1927,10 +1931,11 @@
(ashift:DI
(and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
(const_int 65535))
- (minus:DI (const_int 64)
+ (minus:DI (const_int 56)
(ashift:DI
(and:DI
- (match_operand:DI 2 "reg_or_8bit_operand" "rI")
+ (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
+ (const_int -1))
(const_int 7))
(const_int 3)))))]
"! WORDS_BIG_ENDIAN"

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-gcc_config_alpha_alpha_opt,v 1.1 2014/01/18 11:38:22 pascal Exp $
--- gcc/config/alpha/alpha.opt.orig Sat Jun 25 03:22:41 2005
+++ gcc/config/alpha/alpha.opt Sat Dec 7 10:48:00 2013
@@ -43,8 +43,13 @@ mieee
Target Report RejectNegative Mask(IEEE)
Emit IEEE-conformant code, without inexact exceptions
+mno-ieee
+Target Report RejectNegative InverseMask(IEEE)
+Emit non-IEEE-conformant code
+
mieee-with-inexact
Target Report RejectNegative Mask(IEEE_WITH_INEXACT)
+Emit IEEE-conformant code, with inexact exceptions
mbuild-constants
Target Report Mask(BUILD_CONSTANTS)

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-gcc_config_alpha_openbsd1_h,v 1.1 2014/01/18 11:38:22 pascal Exp $
--- gcc/config/alpha/openbsd1.h.orig Sat Dec 7 10:28:36 2013
+++ gcc/config/alpha/openbsd1.h Sat Dec 7 10:28:31 2013
@@ -0,0 +1,23 @@
+/* Configuration fragment for an alpha OpenBSD target.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+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. */
+
+#define OBSD_HAS_DECLARE_FUNCTION_NAME
+#define OBSD_HAS_DECLARE_FUNCTION_SIZE
+#define OBSD_HAS_DECLARE_OBJECT

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-gcc_config_alpha_openbsd_h,v 1.1.1.1 2010/10/10 17:39:06 steven Exp $
$OpenBSD: patch-gcc_config_alpha_openbsd_h,v 1.2 2014/01/18 11:38:22 pascal Exp $
--- gcc/config/alpha/openbsd.h.orig Sat Jun 25 03:22:41 2005
+++ gcc/config/alpha/openbsd.h Mon Jun 14 19:23:03 2010
@@ -18,23 +18,13 @@ along with GCC; see the file COPYING. If not, write t
+++ gcc/config/alpha/openbsd.h Sat Dec 7 10:27:08 2013
@@ -18,82 +18,71 @@ along with GCC; see the file COPYING. If not, write t
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
@ -10,11 +10,30 @@ $OpenBSD: patch-gcc_config_alpha_openbsd_h,v 1.1.1.1 2010/10/10 17:39:06 steven
-
/* Controlling the compilation driver. */
-/* alpha needs __start. */
-#undef LINK_SPEC
-#define LINK_SPEC \
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+ (MASK_FPREGS | MASK_IEEE | MASK_IEEE_CONFORMANT | MASK_GAS)
+
/* alpha needs __start. */
#undef LINK_SPEC
#define LINK_SPEC \
- "%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{assert*}"
-
+ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
+ %{shared:-shared} %{R*} \
+ %{static:-Bstatic} \
+ %{!static:-Bdynamic} \
+ %{rdynamic:-export-dynamic} \
+ %{assert*} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
+/* As an elf system, we need crtbegin/crtend stuff. */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+ crtbegin%O%s} %{shared:crtbeginS%O%s}"
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+
/* run-time target specifications */
#define TARGET_OS_CPP_BUILTINS() \
do { \
@ -27,20 +46,46 @@ $OpenBSD: patch-gcc_config_alpha_openbsd_h,v 1.1.1.1 2010/10/10 17:39:06 steven
} while (0)
/* Layout of source language data types. */
@@ -53,47 +43,4 @@ Boston, MA 02110-1301, USA. */
-/* This must agree with <machine/ansi.h> */
+/* This must agree with <machine/_types.h> */
#undef SIZE_TYPE
#define SIZE_TYPE "long unsigned int"
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "long int"
+#undef INTMAX_TYPE
+#define INTMAX_TYPE "long long int"
+
+#undef UINTMAX_TYPE
+#define UINTMAX_TYPE "long long unsigned int"
+
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
-
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
+#undef WINT_TYPE
+#define WINT_TYPE "int"
+/* Output and generation of labels. */
#define LOCAL_LABEL_PREFIX "."
-
-/* We don't have an init section yet. */
-#undef HAS_INIT_SECTION
-
+/* .set on alpha is not used to output labels. */
+#undef SET_ASM_OP
-/* collect2 support (assembler format: macros for initialization). */
-
+/* don't want no friggin' stack checks. */
+#undef STACK_CHECK_BUILTIN
+#define STACK_CHECK_BUILTIN 0
-/* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld
- library with the proper functions to handle this -> collect2 will
- default to using nm. */
@ -75,3 +120,5 @@ $OpenBSD: patch-gcc_config_alpha_openbsd_h,v 1.1.1.1 2010/10/10 17:39:06 steven
- } while (0)
-
-
+/* don't want bcopy() optimized into memmove() unless correctly aligned */
+#define SUBWORD_ACCESS_P (TARGET_BWX)