From patchwork Sat Aug 28 07:38:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 62897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8C399B70EC for ; Sat, 28 Aug 2010 17:38:41 +1000 (EST) Received: (qmail 1364 invoked by alias); 28 Aug 2010 07:38:37 -0000 Received: (qmail 1345 invoked by uid 22791); 28 Aug 2010 07:38:35 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 28 Aug 2010 07:38:30 +0000 Received: by vws9 with SMTP id 9so865416vws.20 for ; Sat, 28 Aug 2010 00:38:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.88.155 with SMTP id a27mr1189755vcm.9.1282981108649; Sat, 28 Aug 2010 00:38:28 -0700 (PDT) Received: by 10.220.181.131 with HTTP; Sat, 28 Aug 2010 00:38:28 -0700 (PDT) In-Reply-To: <3F93A208-94A7-4EC3-B71B-CA2C634EDA35@gmail.com> References: <201008280036.o7S0a3E2017670@ignucius.se.axis.com> <3F93A208-94A7-4EC3-B71B-CA2C634EDA35@gmail.com> Date: Sat, 28 Aug 2010 00:38:28 -0700 Message-ID: Subject: Re: Non-TFmode targets broken with "[fortran, patch] Complete front-end support for __float128" From: Andrew Pinski To: FX Cc: Hans-Peter Nilsson , burnus@net-b.de, fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Sat, Aug 28, 2010 at 12:35 AM, FX wrote: >> Breaking targets without TFmode, like cris-elf > > Sorry for breaking bootstraps on (apparently) all targets. I thought I had tested it independently from library support, but apparently I failed to redo so properly after getting rid of the option. > > I committed the following fix as rev. 163611 to restore bootstrap: Here is a very untested patch which should improve the issue. I say untested because I was writing this for Tobias just for sample code. -- Pinski Index: trans-types.c =================================================================== --- trans-types.c (revision 163610) +++ trans-types.c (working copy) @@ -415,7 +415,7 @@ gfc_init_kinds (void) if (mode != TYPE_MODE (float_type_node) && (mode != TYPE_MODE (double_type_node)) && (mode != TYPE_MODE (long_double_type_node)) - && (mode != TFmode)) + && (float128_type_node && mode != TYPE_MODE (float128_type_node))) continue; /* Let the kind equal the precision divided by 8, rounding up. Again, @@ -718,7 +718,8 @@ gfc_build_real_type (gfc_real_info *info info->c_double = 1; if (mode_precision == LONG_DOUBLE_TYPE_SIZE) info->c_long_double = 1; - if (mode_precision != LONG_DOUBLE_TYPE_SIZE && mode_precision == 128) + if (mode_precision != LONG_DOUBLE_TYPE_SIZE + && float128_type_node && TYPE_PRECISION (float128_type_node) == mode_precision) { info->c_float128 = 1; gfc_real16_is_float128 = true; @@ -731,6 +732,9 @@ gfc_build_real_type (gfc_real_info *info if (TYPE_PRECISION (long_double_type_node) == mode_precision) return long_double_type_node; + if (float128_type_node && TYPE_PRECISION (float128_type_node) == mode_precision) + return float128_type_node; + new_type = make_node (REAL_TYPE); TYPE_PRECISION (new_type) = mode_precision; layout_type (new_type); @@ -750,6 +754,8 @@ gfc_build_complex_type (tree scalar_type return complex_double_type_node; if (scalar_type == long_double_type_node) return complex_long_double_type_node; + if (float128_type_node && scalar_type == float128_type_node) + return complex_float128_type_node; new_type = make_node (COMPLEX_TYPE); TREE_TYPE (new_type) = scalar_type; @@ -847,17 +853,12 @@ gfc_init_types (void) gfc_real_kinds[index].kind); PUSH_TYPE (name_buf, type); - if (gfc_real_kinds[index].c_float128) - float128_type_node = type; - type = gfc_build_complex_type (type); gfc_complex_types[index] = type; snprintf (name_buf, sizeof(name_buf), "complex(kind=%d)", gfc_real_kinds[index].kind); PUSH_TYPE (name_buf, type); - if (gfc_real_kinds[index].c_float128) - complex_float128_type_node = type; } for (index = 0; gfc_character_kinds[index].kind != 0; ++index) @@ -2626,4 +2627,19 @@ gfc_get_array_descr_info (const_tree typ return true; } +/* Registration of machine- or os-specific builtin types. */ +void +gfc_register_builtin_type (tree type, + const char *name) +{ + /* Record the __float128 type and the corresponding complex type too. */ + if (strcmp (name, "__float128")) + { + float128_type_node = type; + complex_float128_type_node = make_node (COMPLEX_TYPE); + TREE_TYPE (complex_float128_type_node) = scalar_type; + layout_type (complex_float128_type_node); + } +} + #include "gt-fortran-trans-types.h" Index: trans-types.h =================================================================== --- trans-types.h (revision 163610) +++ trans-types.h (working copy) @@ -101,4 +101,6 @@ tree gfc_get_dtype (tree); tree gfc_get_ppc_type (gfc_component *); +void gfc_register_builtin_type (tree, const char *); + #endif Index: f95-lang.c =================================================================== --- f95-lang.c (revision 163610) +++ f95-lang.c (working copy) @@ -155,6 +155,7 @@ static void gfc_init_ts (void); gfc_omp_firstprivatize_type_sizes #define LANG_HOOKS_BUILTIN_FUNCTION gfc_builtin_function #define LANG_HOOKS_GET_ARRAY_DESCR_INFO gfc_get_array_descr_info +#define LANG_HOOKS_REGISTER_BUILTIN_TYPE gfc_register_builtin_type struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;