From patchwork Mon Jan 24 19:22:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 50414 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 00E7B3858D3C for ; Mon, 24 Jan 2022 19:23:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 00E7B3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643052221; bh=pQyRVfvbb22YZzLgxvGQhEuZu6CQ/jNwmJrBAj0KZE8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=E9n13CgyizE6JxW8d7E2OwcFvwgHSsohS10hT0xctcogpIewKFhzasXpyQRZSTYdz d09UhvF7lapYGvuKWfMt1pAaTSKv15oNokSDU0VrQWic6QgCFOgORDVKXJtX0kxSJQ MbWFjsUIG+ffy5Lmo+sNs+4fsNws+R+2KcMbVaz0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E2DA23858000 for ; Mon, 24 Jan 2022 19:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E2DA23858000 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-302-4yLyQXwKPcOnChqZaEJijg-1; Mon, 24 Jan 2022 14:23:07 -0500 X-MC-Unique: 4yLyQXwKPcOnChqZaEJijg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D192E2E72; Mon, 24 Jan 2022 19:23:05 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.125]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E68E5F4E9; Mon, 24 Jan 2022 19:23:04 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 20OJN1mb460202 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 24 Jan 2022 20:23:01 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 20OJMxjc460201; Mon, 24 Jan 2022 20:22:59 +0100 Date: Mon, 24 Jan 2022 20:22:59 +0100 To: Segher Boessenkool , David Edelsohn Subject: [PATCH] rs6000: Remove GCC 8.1 U10__float128 mangling compatibility [PR104172] Message-ID: <20220124192259.GU2646553@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-58.8 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: Michael Meissner , Bill Schmidt , gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! In GCC 7.x and earlier, while it had -mabi=ieeelongdouble option, that option was undocumented and unsupported. In GCC 8.1 that option got documented and -mabi=ieeelongdouble long double started to be mangled as U10__float128. In GCC 9 and backported to before 8.2 release, that mangling changed to u9__ieee128 and a support for emitting compatibility mangling aliases have been added. Unfortunately, as mentioned in the PR, those don't really work well in many cases, the free_lang_data pass throws away important trees, so e.g. with -flto -ffat-lto-objects the compiler often ICEs on templates that involve IEEE quad long double arguments etc. because the mangling was done too late (at final time). Furthermore, lto1's mangler is not the C++ mangler, so with -flto it would often emit as "mangled identifiers" something that wasn't a valid assembler identifier, e.g. operator+ etc. While it is possible to do such mangling earlier, e.g. at the same time when the C++ FE emits its mangling aliases and untested proof of concept is in the PR, there seems to be agreement that we shouldn't bother with this ABI compatibility with something that probably nobody really used. GCC 8.2 already uses the new mangling, it was just a few months, but more importantly, libstdc++ support for IEEE quad long double on powerpc64le-linux was only added in GCC 11, and glibc support for that some weeks after 8.2 got released. So, the following patch just drops those aliases. Bootstrap/regtest pedning on powerpc64le-linux (both defaulting to ibmlongdouble and ieeelongdouble), ok for trunk if it passes? 2022-01-24 Jakub Jelinek PR target/104172 gcc/ * config/rs6000/rs6000-internal.h (rs6000_passes_ieee128): Don't declare. * config/rs6000/rs6000.cc (rs6000_passes_ieee128, ieee128_mangling_gcc_8_1): Remove. (TARGET_ASM_GLOBALIZE_DECL_NAME): Don't redefine. (rs6000_mangle_type): Return "u9__ieee128" instead of ieee128_mangling_gcc_8_1 ? "U10__float128" : "u9__ieee128". (rs6000_globalize_decl_name): Remove. * config/rs6000/rs6000-call.cc (init_cumulative_args, rs6000_function_arg_advance_1): Don't set rs6000_passes_ieee128. Jakub --- gcc/config/rs6000/rs6000-internal.h.jj 2022-01-18 11:58:59.218987257 +0100 +++ gcc/config/rs6000/rs6000-internal.h 2022-01-24 12:05:56.428125199 +0100 @@ -183,9 +183,6 @@ extern tree rs6000_fold_builtin (tree fn tree *args ATTRIBUTE_UNUSED, bool ignore ATTRIBUTE_UNUSED); -#if TARGET_ELF -extern bool rs6000_passes_ieee128; -#endif extern bool rs6000_passes_float; extern bool rs6000_passes_long_double; extern bool rs6000_passes_vector; --- gcc/config/rs6000/rs6000.cc.jj 2022-01-22 12:02:24.583563625 +0100 +++ gcc/config/rs6000/rs6000.cc 2022-01-24 12:07:05.783152147 +0100 @@ -121,22 +121,9 @@ int dot_symbols; of this machine mode. */ scalar_int_mode rs6000_pmode; -#if TARGET_ELF -/* Note whether IEEE 128-bit floating point was passed or returned, either as - the __float128/_Float128 explicit type, or when long double is IEEE 128-bit - floating point. We changed the default C++ mangling for these types and we - may want to generate a weak alias of the old mangling (U10__float128) to the - new mangling (u9__ieee128). */ -bool rs6000_passes_ieee128 = false; -#endif - /* Track use of r13 in 64bit AIX TLS. */ static bool xcoff_tls_exec_model_detected = false; -/* Generate the manged name (i.e. U10__float128) used in GCC 8.1, and not the - name used in current releases (i.e. u9__ieee128). */ -static bool ieee128_mangling_gcc_8_1; - /* Width in bits of a pointer. */ unsigned rs6000_pointer_size; @@ -1765,11 +1752,6 @@ static const struct attribute_spec rs600 #undef TARGET_STARTING_FRAME_OFFSET #define TARGET_STARTING_FRAME_OFFSET rs6000_starting_frame_offset -#if TARGET_ELF && RS6000_WEAK -#undef TARGET_ASM_GLOBALIZE_DECL_NAME -#define TARGET_ASM_GLOBALIZE_DECL_NAME rs6000_globalize_decl_name -#endif - #undef TARGET_SETJMP_PRESERVES_NONVOLATILE_REGS_P #define TARGET_SETJMP_PRESERVES_NONVOLATILE_REGS_P hook_bool_void_true @@ -20262,7 +20244,7 @@ rs6000_mangle_type (const_tree type) if (SCALAR_FLOAT_TYPE_P (type) && FLOAT128_IBM_P (TYPE_MODE (type))) return "g"; if (SCALAR_FLOAT_TYPE_P (type) && FLOAT128_IEEE_P (TYPE_MODE (type))) - return ieee128_mangling_gcc_8_1 ? "U10__float128" : "u9__ieee128"; + return "u9__ieee128"; if (type == vector_pair_type_node) return "u13__vector_pair"; @@ -28159,39 +28141,6 @@ rs6000_starting_frame_offset (void) } -/* Create an alias for a mangled name where we have changed the mangling (in - GCC 8.1, we used U10__float128, and now we use u9__ieee128). This is called - via the target hook TARGET_ASM_GLOBALIZE_DECL_NAME. */ - -#if TARGET_ELF && RS6000_WEAK -static void -rs6000_globalize_decl_name (FILE * stream, tree decl) -{ - const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); - - targetm.asm_out.globalize_label (stream, name); - - if (rs6000_passes_ieee128 && name[0] == '_' && name[1] == 'Z') - { - tree save_asm_name = DECL_ASSEMBLER_NAME (decl); - const char *old_name; - - ieee128_mangling_gcc_8_1 = true; - lang_hooks.set_decl_assembler_name (decl); - old_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - SET_DECL_ASSEMBLER_NAME (decl, save_asm_name); - ieee128_mangling_gcc_8_1 = false; - - if (strcmp (name, old_name) != 0) - { - fprintf (stream, "\t.weak %s\n", old_name); - fprintf (stream, "\t.set %s,%s\n", old_name, name); - } - } -} -#endif - - /* On 64-bit Linux and Freebsd systems, possibly switch the long double library function names from l to f128 if the default long double type is IEEE 128-bit. Typically, with the C and C++ languages, the standard math.h --- gcc/config/rs6000/rs6000-call.cc.jj 2022-01-19 00:01:41.356806639 +0100 +++ gcc/config/rs6000/rs6000-call.cc 2022-01-24 12:06:22.519759135 +0100 @@ -755,12 +755,6 @@ init_cumulative_args (CUMULATIVE_ARGS *c && (TYPE_MAIN_VARIANT (return_type) == long_double_type_node)))) rs6000_passes_long_double = true; - - /* Note if we passed or return a IEEE 128-bit type. We changed - the mangling for these types, and we may need to make an alias - with the old mangling. */ - if (FLOAT128_IEEE_P (return_mode)) - rs6000_passes_ieee128 = true; } if (ALTIVEC_OR_VSX_VECTOR_MODE (return_mode)) rs6000_passes_vector = true; @@ -1179,12 +1173,6 @@ rs6000_function_arg_advance_1 (CUMULATIV || (type != NULL && TYPE_MAIN_VARIANT (type) == long_double_type_node))) rs6000_passes_long_double = true; - - /* Note if we passed or return a IEEE 128-bit type. We changed the - mangling for these types, and we may need to make an alias with - the old mangling. */ - if (FLOAT128_IEEE_P (mode)) - rs6000_passes_ieee128 = true; } if (named && ALTIVEC_OR_VSX_VECTOR_MODE (mode)) rs6000_passes_vector = true;