From patchwork Fri Feb 26 06:33:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 1444774 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=PifzxYgc; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dn0HG1l1Wz9s1l for ; Fri, 26 Feb 2021 17:33:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 791843850432; Fri, 26 Feb 2021 06:33:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 791843850432 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1614321235; bh=yug8kbV1mg7bj3HuusuHeE1LNIxyzOqvFr3umKNyebc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=PifzxYgcfSnYhu1nIJWzIOJweoXkxR3hQQvvgE0kmbWUPMbrP37VNIWVJMRWUI8gE MhqDXXOpojTxadXQn1etXqhZy8GTMGOk79j//zxIt87VgZ607pPjvEBlOH5Bsifhyz +55V9lFwLetBiKUq5J3AF0aIDUJF0L5eNbSJbH28= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 2ED60385703C for ; Fri, 26 Feb 2021 06:33:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2ED60385703C Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11Q6Wlrk068596; Fri, 26 Feb 2021 01:33:47 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36xrf4mvvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Feb 2021 01:33:47 -0500 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 11Q6WlNF068556; Fri, 26 Feb 2021 01:33:47 -0500 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 36xrf4mvvj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Feb 2021 01:33:47 -0500 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 11Q6M6j2030546; Fri, 26 Feb 2021 06:33:46 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma03wdc.us.ibm.com with ESMTP id 36tt29mj62-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Feb 2021 06:33:46 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 11Q6XiTZ6619550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Feb 2021 06:33:44 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB5ECBE04F; Fri, 26 Feb 2021 06:33:44 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9883BE051; Fri, 26 Feb 2021 06:33:43 +0000 (GMT) Received: from ibm-toto.the-meissners.org (unknown [9.160.18.224]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTPS; Fri, 26 Feb 2021 06:33:43 +0000 (GMT) Date: Fri, 26 Feb 2021 01:33:41 -0500 To: gcc-patches@gcc.gnu.org, Michael Meissner , Segher Boessenkool , David Edelsohn , Bill Schmidt , Peter Bergner , Joseph Myers Subject: [PATCH] Honor --disable-decimal-float in building _Float128 support. Message-ID: <20210226063341.GA28298@ibm-toto.the-meissners.org> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , David Edelsohn , Bill Schmidt , Peter Bergner , Joseph Myers MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-26_01:2021-02-24, 2021-02-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 spamscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102260049 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_MANYTO, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Michael Meissner via Gcc-patches From: Michael Meissner Reply-To: Michael Meissner Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Honor --disable-decimal-float in building _Float128 support. Joseph Myers reported that my previous patch to add conversions between _Float128 and the Decimal types was still being built even if GCC was configured with the --disable-decimal-float option. This patch fixes that by only building the conversion functions if both _Float128 and Decimal support are built into GCC. In addition, I removed the dependency on the target having a valid stdio.h file to declare sprintf in building _sprintfkf.c. Finally I noticed I had a mismatch in the _sprintfkf.h include file, and I fixed that. Joseph, does this patch fix your problem? I have built cross compilers on the x86 with/without --disable-decimal-float and the conversion functions are not built if --disable-decimal-float was used. I have built stage1 compilers with all three long double formats on the native little endian system, and I verified that they conversions are only built if Decimal support is eabled. As I post this, the bootstrap builds are going on. Assuming the bootstrap builds are successful, can I check this patch into the master branch? libgcc/ 2021-02-26 Michael Meissner * config.host (powerpc*-*-linux): Move the Decimal/_Float128 * conversions into t-float128-dec. * config/rs6000/_sprintfkf.c: Do not include stdio.h. Include _sprintfkf.h. * config/rs6000/_sprintfkf.h (__sprintfkf): Update calling signature. (sprintf): Add declaration. * config/rs6000/t-float128 (fp128_dec_funcs): Move to t-float128-dec. (fp128_decstr_funcs): Move to t-float128-dec. (ibm128_dec_funcs): Move to t-float128-dec. (fp128_dec_objs): Move to t-float128-dec. (fp128_decstr_objs): Move to t-float128-dec. (ibm128_dec_objs): Move to t-float128-dec. (FP128_CFLAGS_DECIMAL): Move to t-float128-dec. (IBM128_CFLAGS_DECIMAL): Move to t-float128-dec. * config/rs6000/t-float128-dec: New file. * configure.ac (libgcc_cv_powerpc_float128_dec): New variable, set to yes if both _Float128 and Decimal support are available. * configure: Regenerate. --- libgcc/config.host | 4 +++ libgcc/config/rs6000/_sprintfkf.c | 4 ++- libgcc/config/rs6000/_sprintfkf.h | 2 +- libgcc/config/rs6000/t-float128 | 42 +++++------------------------ libgcc/config/rs6000/t-float128-dec | 37 +++++++++++++++++++++++++ libgcc/configure | 22 ++++++++++++++- libgcc/configure.ac | 8 ++++++ 7 files changed, 80 insertions(+), 39 deletions(-) create mode 100644 libgcc/config/rs6000/t-float128-dec diff --git a/libgcc/config.host b/libgcc/config.host index f808b61be70..b5b4b0b3ba0 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1220,6 +1220,10 @@ powerpc*-*-linux*) tmake_file="${tmake_file} rs6000/t-float128" fi + if test $libgcc_cv_powerpc_float128_dec = yes; then + tmake_file="${tmake_file} rs6000/t-float128-dec" + fi + if test $libgcc_cv_powerpc_float128_hw = yes; then tmake_file="${tmake_file} rs6000/t-float128-hw" fi diff --git a/libgcc/config/rs6000/_sprintfkf.c b/libgcc/config/rs6000/_sprintfkf.c index a7fdfb483c9..b367861fcc3 100644 --- a/libgcc/config/rs6000/_sprintfkf.c +++ b/libgcc/config/rs6000/_sprintfkf.c @@ -27,7 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include #include #include -#include +#include <_sprintfkf.h> + +extern int sprintf (char *restrict, const char *restrict, ...); /* This function must be built with IBM 128-bit as long double, so that we can access the strfroml function if do not have an IEEE 128-bit version, and if diff --git a/libgcc/config/rs6000/_sprintfkf.h b/libgcc/config/rs6000/_sprintfkf.h index 637d104c882..22b245d2cbb 100644 --- a/libgcc/config/rs6000/_sprintfkf.h +++ b/libgcc/config/rs6000/_sprintfkf.h @@ -24,5 +24,5 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Declaration of the conversion function to IEEE 128-bit floating point from string using snprintf. */ -extern int __sprintfkf (char *restrict, const char *restrict, ...); +extern int __sprintfkf (char *restrict, const char *restrict, _Float128); diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128 index 6fb1a3d871b..bbc66465050 100644 --- a/libgcc/config/rs6000/t-float128 +++ b/libgcc/config/rs6000/t-float128 @@ -22,18 +22,6 @@ fp128_softfp_static_obj = $(addsuffix -sw$(objext),$(fp128_softfp_funcs)) fp128_softfp_shared_obj = $(addsuffix -sw_s$(objext),$(fp128_softfp_funcs)) fp128_softfp_obj = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj) -# Decimal <-> _Float128 conversions -fp128_dec_funcs = _kf_to_sd _kf_to_dd _kf_to_td \ - _sd_to_kf _dd_to_kf _td_to_kf - -# _Float128 to/from string conversions that must be compiled with IBM 128-bit -# long double. -fp128_decstr_funcs = _strtokf _sprintfkf - -# Decimal <-> __ibm128 conversions -ibm128_dec_funcs = _tf_to_sd _tf_to_dd _tf_to_td \ - _sd_to_tf _dd_to_tf _td_to_tf - # New functions for software emulation fp128_ppc_funcs = floattikf floatuntikf fixkfti fixunskfti \ extendkftf2-sw trunctfkf2-sw \ @@ -48,13 +36,16 @@ fp128_ppc_obj = $(fp128_ppc_static_obj) $(fp128_ppc_shared_obj) # All functions fp128_funcs = $(fp128_softfp_funcs) $(fp128_ppc_funcs) \ - $(fp128_hw_funcs) $(fp128_ifunc_funcs) + $(fp128_hw_funcs) $(fp128_ifunc_funcs) \ + $(fp128_dec_funcs) fp128_src = $(fp128_softfp_src) $(fp128_ppc_src) \ - $(fp128_hw_src) $(fp128_ifunc_src) + $(fp128_hw_src) $(fp128_ifunc_src) \ + $(fp128_dec_src) fp128_obj = $(fp128_softfp_obj) $(fp128_ppc_obj) \ - $(fp128_hw_obj) $(fp128_ifunc_obj) + $(fp128_hw_obj) $(fp128_ifunc_obj) \ + $(fp128_dec_obj) fp128_sed = $(srcdir)/config/rs6000/float128-sed$(fp128_sed_hw) fp128_dep = $(fp128_sed) $(srcdir)/config/rs6000/t-float128 @@ -82,27 +73,6 @@ $(fp128_ppc_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW) $(fp128_obj) : $(fp128_includes) $(fp128_obj) : $(srcdir)/config/rs6000/quad-float128.h -# Force the TF mode to/from decimal functions to be compiled with IBM long -# double. Add building the KF mode to/from decimal conversions with explict -# IEEE long double. -fp128_dec_objs = $(addsuffix $(objext),$(fp128_dec_funcs)) \ - $(addsuffix _s$(objext),$(fp128_dec_funcs)) - -fp128_decstr_objs = $(addsuffix $(objext),$(fp128_decstr_funcs)) \ - $(addsuffix _s$(objext),$(fp128_decstr_funcs)) - -ibm128_dec_objs = $(addsuffix $(objext),$(ibm128_dec_funcs)) \ - $(addsuffix _s$(objext),$(ibm128_dec_funcs)) - -FP128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ieeelongdouble -IBM128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ibmlongdouble - -$(fp128_dec_objs) : INTERNAL_CFLAGS += $(FP128_CFLAGS_DECIMAL) -$(fp128_decstr_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL) -$(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL) - -$(fp128_decstr_objs) : $(srcdir)/config/rs6000/_strtokf.h \ - $(srcdir)/config/rs6000/_sprintfkf.h \ $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep) @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \ diff --git a/libgcc/config/rs6000/t-float128-dec b/libgcc/config/rs6000/t-float128-dec new file mode 100644 index 00000000000..7a928260cec --- /dev/null +++ b/libgcc/config/rs6000/t-float128-dec @@ -0,0 +1,37 @@ +# Support for adding conversions between __float128 and Decimal to the powerpc. +# The t-float128 makefile fragment includes these objects if both float128 and +# decimal support is built-in. + +# Decimal <-> _Float128 conversions +fp128_dec_funcs = _kf_to_sd _kf_to_dd _kf_to_td \ + _sd_to_kf _dd_to_kf _td_to_kf + +# _Float128 to/from string conversions that must be compiled with IBM 128-bit +# long double. +fp128_decstr_funcs = _strtokf _sprintfkf + +# Decimal <-> __ibm128 conversions +ibm128_dec_funcs = _tf_to_sd _tf_to_dd _tf_to_td \ + _sd_to_tf _dd_to_tf _td_to_tf + +# Force the TF mode to/from decimal functions to be compiled with IBM long +# double. Add building the KF mode to/from decimal conversions with explict +# IEEE long double. +fp128_dec_objs = $(addsuffix $(objext),$(fp128_dec_funcs)) \ + $(addsuffix _s$(objext),$(fp128_dec_funcs)) + +fp128_decstr_objs = $(addsuffix $(objext),$(fp128_decstr_funcs)) \ + $(addsuffix _s$(objext),$(fp128_decstr_funcs)) + +ibm128_dec_objs = $(addsuffix $(objext),$(ibm128_dec_funcs)) \ + $(addsuffix _s$(objext),$(ibm128_dec_funcs)) + +FP128_CFLAGS_DECIMAL = $(FP128_CFLAGS_SW) -Wno-psabi -mabi=ieeelongdouble +IBM128_CFLAGS_DECIMAL = $(FP128_CFLAGS_SW) -Wno-psabi -mabi=ibmlongdouble + +$(fp128_dec_objs) : INTERNAL_CFLAGS += $(FP128_CFLAGS_DECIMAL) +$(fp128_decstr_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL) +$(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL) + +$(fp128_decstr_objs) : $(srcdir)/config/rs6000/_strtokf.h \ + $(srcdir)/config/rs6000/_sprintfkf.h \ diff --git a/libgcc/configure b/libgcc/configure index 78fc22a5784..0d8844e6d99 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -4913,7 +4913,7 @@ case "$host" in case "$enable_cet" in auto) # Check if target supports multi-byte NOPs - # and if assembler supports CET insn. + # and if compiler and assembler support CET insn. cet_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fcf-protection" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5228,6 +5228,26 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128" >&5 $as_echo "$libgcc_cv_powerpc_float128" >&6; } + CFLAGS="$CFLAGS -mvsx -mfloat128" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC __float128 libraries with decimal support" >&5 +$as_echo_n "checking for PowerPC __float128 libraries with decimal support... " >&6; } +if ${libgcc_cv_powerpc_float128_dec+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +_Float128 convert (_Decimal128 a) { return a; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libgcc_cv_powerpc_float128_dec=yes +else + libgcc_cv_powerpc_float128_dec=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128_dec" >&5 +$as_echo "$libgcc_cv_powerpc_float128_dec" >&6; } + CFLAGS="$CFLAGS -mpower9-vector -mfloat128-hardware" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 3.0 to build hardware __float128 libraries" >&5 $as_echo_n "checking for PowerPC ISA 3.0 to build hardware __float128 libraries... " >&6; } diff --git a/libgcc/configure.ac b/libgcc/configure.ac index ed50c0e9b49..b5176265296 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -435,6 +435,14 @@ powerpc*-*-linux*) [libgcc_cv_powerpc_float128=yes], [libgcc_cv_powerpc_float128=no])]) + CFLAGS="$CFLAGS -mvsx -mfloat128" + AC_CACHE_CHECK([for PowerPC __float128 libraries with decimal support], + [libgcc_cv_powerpc_float128_dec], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([_Float128 convert (_Decimal128 a) { return a; }])], + [libgcc_cv_powerpc_float128_dec=yes], + [libgcc_cv_powerpc_float128_dec=no])]) + CFLAGS="$CFLAGS -mpower9-vector -mfloat128-hardware" AC_CACHE_CHECK([for PowerPC ISA 3.0 to build hardware __float128 libraries], [libgcc_cv_powerpc_float128_hw],