diff options
Diffstat (limited to 'gcc-4.4.0/gcc/config')
-rw-r--r-- | gcc-4.4.0/gcc/config/arm/arm.c | 130 | ||||
-rw-r--r-- | gcc-4.4.0/gcc/config/arm/arm.md | 42 | ||||
-rw-r--r-- | gcc-4.4.0/gcc/config/i386/i386.c | 2 | ||||
-rw-r--r-- | gcc-4.4.0/gcc/config/i386/linux.h | 6 | ||||
-rw-r--r-- | gcc-4.4.0/gcc/config/i386/linux64.h | 9 | ||||
-rw-r--r-- | gcc-4.4.0/gcc/config/linux-grtev1.h | 43 |
6 files changed, 228 insertions, 4 deletions
diff --git a/gcc-4.4.0/gcc/config/arm/arm.c b/gcc-4.4.0/gcc/config/arm/arm.c index d0866963d..211db12db 100644 --- a/gcc-4.4.0/gcc/config/arm/arm.c +++ b/gcc-4.4.0/gcc/config/arm/arm.c @@ -126,6 +126,7 @@ static bool arm_function_ok_for_sibcall (tree, tree); static void arm_internal_label (FILE *, const char *, unsigned long); static void arm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); +static bool arm_have_conditional_execution (void); static bool arm_rtx_costs_1 (rtx, enum rtx_code, int*, bool); static bool arm_size_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *); static bool arm_slowmul_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool); @@ -368,6 +369,9 @@ static bool arm_allocate_stack_slots_for_args (void); #define TARGET_HAVE_TLS true #endif +#undef TARGET_HAVE_CONDITIONAL_EXECUTION +#define TARGET_HAVE_CONDITIONAL_EXECUTION arm_have_conditional_execution + #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM arm_cannot_force_const_mem @@ -5589,6 +5593,121 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) } } +/* Estimates the size cost of thumb1 instructions. + For now most of the code is copied from thumb1_rtx_costs. We need more + fine grain tuning when we have more related test cases. */ +static inline int +thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer) +{ + enum machine_mode mode = GET_MODE (x); + + switch (code) + { + case ASHIFT: + case ASHIFTRT: + case LSHIFTRT: + case ROTATERT: + case PLUS: + case MINUS: + case COMPARE: + case NEG: + case NOT: + return COSTS_N_INSNS (1); + + case MULT: + if (GET_CODE (XEXP (x, 1)) == CONST_INT) + { + /* Thumb1 mul instruction can't operate on const. We must Load it + into a register first. */ + int const_size = thumb1_size_rtx_costs (XEXP (x, 1), CONST_INT, SET); + return COSTS_N_INSNS (1) + const_size; + } + return COSTS_N_INSNS (1); + + case SET: + return (COSTS_N_INSNS (1) + + 4 * ((GET_CODE (SET_SRC (x)) == MEM) + + GET_CODE (SET_DEST (x)) == MEM)); + + case CONST_INT: + if (outer == SET) + { + if ((unsigned HOST_WIDE_INT) INTVAL (x) < 256) + return 0; + if (thumb_shiftable_const (INTVAL (x))) + return COSTS_N_INSNS (2); + return COSTS_N_INSNS (3); + } + else if ((outer == PLUS || outer == COMPARE) + && INTVAL (x) < 256 && INTVAL (x) > -256) + return 0; + else if ((outer == IOR || outer == XOR || outer == AND) + && INTVAL (x) < 256 && INTVAL (x) >= -256) + return COSTS_N_INSNS (1); + else if (outer == ASHIFT || outer == ASHIFTRT + || outer == LSHIFTRT) + return 0; + return COSTS_N_INSNS (2); + + case CONST: + case CONST_DOUBLE: + case LABEL_REF: + case SYMBOL_REF: + return COSTS_N_INSNS (3); + + case UDIV: + case UMOD: + case DIV: + case MOD: + return 100; + + case TRUNCATE: + return 99; + + case AND: + case XOR: + case IOR: + /* XXX guess. */ + return 8; + + case MEM: + /* XXX another guess. */ + /* Memory costs quite a lot for the first word, but subsequent words + load at the equivalent of a single insn each. */ + return (10 + 4 * ((GET_MODE_SIZE (mode) - 1) / UNITS_PER_WORD) + + ((GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x)) + ? 4 : 0)); + + case IF_THEN_ELSE: + /* XXX a guess. */ + if (GET_CODE (XEXP (x, 1)) == PC || GET_CODE (XEXP (x, 2)) == PC) + return 14; + return 2; + + case ZERO_EXTEND: + /* XXX still guessing. */ + switch (GET_MODE (XEXP (x, 0))) + { + case QImode: + return (1 + (mode == DImode ? 4 : 0) + + (GET_CODE (XEXP (x, 0)) == MEM ? 10 : 0)); + + case HImode: + return (4 + (mode == DImode ? 4 : 0) + + (GET_CODE (XEXP (x, 0)) == MEM ? 10 : 0)); + + case SImode: + return (1 + (GET_CODE (XEXP (x, 0)) == MEM ? 10 : 0)); + + default: + return 99; + } + + default: + return 99; + } +} + /* RTX costs when optimizing for size. */ static bool arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code, @@ -5597,8 +5716,7 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code, enum machine_mode mode = GET_MODE (x); if (TARGET_THUMB1) { - /* XXX TBD. For now, use the standard costs. */ - *total = thumb1_rtx_costs (x, code, outer_code); + *total = thumb1_size_rtx_costs (x, code, outer_code); return true; } @@ -19714,4 +19832,12 @@ arm_optimization_options (int level, int size ATTRIBUTE_UNUSED) flag_section_anchors = 2; } +/* Only thumb1 can't support conditional execution, so return true if + the target is not thumb1. */ +static bool +arm_have_conditional_execution (void) +{ + return !TARGET_THUMB1; +} + #include "gt-arm.h" diff --git a/gcc-4.4.0/gcc/config/arm/arm.md b/gcc-4.4.0/gcc/config/arm/arm.md index dfab0aa0a..4415ddfed 100644 --- a/gcc-4.4.0/gcc/config/arm/arm.md +++ b/gcc-4.4.0/gcc/config/arm/arm.md @@ -5833,7 +5833,7 @@ (define_split [(set (match_operand:SF 0 "arm_general_register_operand" "") (match_operand:SF 1 "immediate_operand" ""))] - "TARGET_32BIT + "TARGET_EITHER && reload_completed && GET_CODE (operands[1]) == CONST_DOUBLE" [(set (match_dup 2) (match_dup 3))] @@ -6485,6 +6485,7 @@ (const_int 6) (const_int 8))))] ) + (define_insn "*movsi_cbranchsi4" [(set (pc) (if_then_else @@ -6548,6 +6549,45 @@ (const_int 10)))))] ) +(define_peephole2 + [(set (match_operand:SI 0 "low_register_operand" "") + (match_operand:SI 1 "low_register_operand" "")) + (set (pc) + (if_then_else (match_operator 2 "arm_comparison_operator" + [(match_dup 1) (const_int 0)]) + (label_ref (match_operand 3 "" "")) + (pc)))] + "TARGET_THUMB1" + [(parallel + [(set (pc) + (if_then_else (match_op_dup 2 [(match_dup 1) (const_int 0)]) + (label_ref (match_dup 3)) + (pc))) + (set (match_dup 0) (match_dup 1))])] + "" +) + +;; Sigh! This variant shouldn't be needed, but combine often fails to +;; merge cases like this because the op1 is a hard register in +;; CLASS_LIKELY_SPILLED_P. +(define_peephole2 + [(set (match_operand:SI 0 "low_register_operand" "") + (match_operand:SI 1 "low_register_operand" "")) + (set (pc) + (if_then_else (match_operator 2 "arm_comparison_operator" + [(match_dup 0) (const_int 0)]) + (label_ref (match_operand 3 "" "")) + (pc)))] + "TARGET_THUMB1" + [(parallel + [(set (pc) + (if_then_else (match_op_dup 2 [(match_dup 1) (const_int 0)]) + (label_ref (match_dup 3)) + (pc))) + (set (match_dup 0) (match_dup 1))])] + "" +) + (define_insn "*negated_cbranchsi4" [(set (pc) (if_then_else diff --git a/gcc-4.4.0/gcc/config/i386/i386.c b/gcc-4.4.0/gcc/config/i386/i386.c index d42f6c345..9d9efb8f7 100644 --- a/gcc-4.4.0/gcc/config/i386/i386.c +++ b/gcc-4.4.0/gcc/config/i386/i386.c @@ -25491,7 +25491,7 @@ ix86_veclibabi_acml (enum built_in_function fn, tree type_out, tree type_in) static tree ix86_vectorize_builtin_conversion (unsigned int code, tree type) { - if (TREE_CODE (type) != VECTOR_TYPE) + if (!TARGET_SSE2 || TREE_CODE (type) != VECTOR_TYPE) return NULL_TREE; switch (code) diff --git a/gcc-4.4.0/gcc/config/i386/linux.h b/gcc-4.4.0/gcc/config/i386/linux.h index 9809c5988..6b8b3bec4 100644 --- a/gcc-4.4.0/gcc/config/i386/linux.h +++ b/gcc-4.4.0/gcc/config/i386/linux.h @@ -110,8 +110,14 @@ along with GCC; see the file COPYING3. If not see "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" +/* These may be provided by config/linux-grtev1.h. */ +#ifndef LINUX_GRTE_EXTRA_SPECS +#define LINUX_GRTE_EXTRA_SPECS +#endif + #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ + LINUX_GRTE_EXTRA_SPECS \ { "link_emulation", LINK_EMULATION },\ { "dynamic_linker", LINUX_DYNAMIC_LINKER } diff --git a/gcc-4.4.0/gcc/config/i386/linux64.h b/gcc-4.4.0/gcc/config/i386/linux64.h index 379e2c7d8..759b855dc 100644 --- a/gcc-4.4.0/gcc/config/i386/linux64.h +++ b/gcc-4.4.0/gcc/config/i386/linux64.h @@ -87,6 +87,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see %{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \ %{static:-static}}" +/* These may be provided by config/linux-grtev1.h. */ +#ifndef LINUX_GRTE_EXTRA_SPECS +#define LINUX_GRTE_EXTRA_SPECS +#endif + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + LINUX_GRTE_EXTRA_SPECS + /* Similar to standard Linux, but adding -ffast-math support. */ #undef ENDFILE_SPEC #define ENDFILE_SPEC \ diff --git a/gcc-4.4.0/gcc/config/linux-grtev1.h b/gcc-4.4.0/gcc/config/linux-grtev1.h new file mode 100644 index 000000000..4eb847041 --- /dev/null +++ b/gcc-4.4.0/gcc/config/linux-grtev1.h @@ -0,0 +1,43 @@ +/* Definitions for Linux-based GRTE (Google RunTime Environment) version 1. + Copyright (C) 2009 Free Software Foundation, Inc. + Contributed by Chris Demetriou. + +This file is part of GCC. + +GCC 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 3, or (at your option) +any later version. + +GCC 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. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +/* Overrides LIB_SPEC from linux.h. */ +#undef LIB_SPEC +#define LIB_SPEC \ + "%{pthread:-lpthread} \ + %{shared:-lc} \ + %{!shared:%{mieee-fp:-lieee} %{profile:%(libc_p)}%{!profile:%(libc)}}" + +/* When GRTE links statically, it needs its NSS and resolver libraries + linked in as well. Note that when linking statically, these are + enclosed in a group by LINK_GCC_C_SEQUENCE_SPEC. */ +#undef LINUX_GRTE_EXTRA_SPECS +#define LINUX_GRTE_EXTRA_SPECS \ + { "libc", "%{static:%(libc_static);:-lc}" }, \ + { "libc_p", "%{static:%(libc_p_static);:-lc_p}" }, \ + { "libc_static", \ + "-lc -lnss_borg -lnss_cache -lnss_dns -lnss_files -lresolv" }, \ + { "libc_p_static", \ + "-lc_p -lnss_borg_p -lnss_cache_p -lnss_dns_p -lnss_files_p -lresolv_p" }, |