From patchwork Mon Jun 21 09:27:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1494973 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@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=hfCdVhEO; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4G7kj31NH5z9sW7 for ; Mon, 21 Jun 2021 19:28:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9D7A53893C7D for ; Mon, 21 Jun 2021 09:28:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D7A53893C7D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1624267682; bh=5nerNlLTjX+mKEEJuBz1Ro2Izi8B+JzMQxMHMk9IJ7Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=hfCdVhEOERdkmrDCcyoAfSwkJ8ethCAZCVDA2mCSTgdAyJHntq4VPbhOb47kIRiQf hiSPSpMwPBSm5SmSlI+7qAWmUvyNNEykmWhS9OkGV1JOKxDMXmnZ0YdtOjkI8/jD42 N3pq8IDmvMNogzlAJNY1aFuVRqFJ4cUMRTxsFzRU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id B3C643893C41 for ; Mon, 21 Jun 2021 09:27:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B3C643893C41 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15L93pw6103907; Mon, 21 Jun 2021 05:27:15 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39aq869pgn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Jun 2021 05:27:15 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15L946xY104888; Mon, 21 Jun 2021 05:27:14 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 39aq869pg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Jun 2021 05:27:14 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15L9FI0w002111; Mon, 21 Jun 2021 09:27:12 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma02fra.de.ibm.com with ESMTP id 3998788ec8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Jun 2021 09:27:12 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15L9RAgr13697432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Jun 2021 09:27:10 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55B1F4C052; Mon, 21 Jun 2021 09:27:10 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 789794C044; Mon, 21 Jun 2021 09:27:08 +0000 (GMT) Received: from kewenlins-mbp.cn.ibm.com (unknown [9.200.147.148]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 21 Jun 2021 09:27:08 +0000 (GMT) To: GCC Patches Subject: rs6000: Fix typos in float128 ISA3.1 support Message-ID: <32c02216-9f50-8b1b-9d5d-43a769c3c149@linux.ibm.com> Date: Mon, 21 Jun 2021 17:27:06 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: vMFKUhYf_ZG0OZFHTkvyqzQsiBodKQlY X-Proofpoint-ORIG-GUID: 1HvGHHPNLSgVGktwvGUXS4oNIjVx18G3 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-21_03:2021-06-20, 2021-06-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106210053 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, 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: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Bill Schmidt , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, Recently if we build gcc on Power with the assembler which doesn't have Power10 support, the build will fail when building libgcc with one error message like: Error: invalid switch -mpower10 Error: unrecognized option -mpower10 make[2]: *** [...gcc/gcc-base/libgcc/shared-object.mk:14: float128-p10.o] Error 1 By checking the culprit commit r12-1340, it's caused by some typos. What the proposed patch does: - fix test target typo libgcc_cv_powerpc_3_1_float128_hw (written wrongly as libgcc_cv_powerpc_float128_hw, so it's going to build ISA3.1 stuffs just when detecting ISA3.0). - fix test case used for libgcc_cv_powerpc_3_1_float128_hw check. - fix test option used for libgcc_cv_powerpc_3_1_float128_hw check. - remove the ISA3.1 related contents from t-float128-hw. - add new macro FLOAT128_HW_INSNS_ISA3_1 to differentiate ISA3.1 content from ISA3.0 part in ifunc support. For the last two points, I think it's by design, when the assembler only supports power9 insns but not power10 insns, we are unable to build power10 hw supported function successfully, so we shouldn't generate related ifunc stuffs which rely on p10 insns. This patch makes the build happy even without p10 supported as. Bootstrapped/regtested on: - powerpc64le-linux-gnu P10 - powerpc64le-linux-gnu P9 (w/i and w/o p10 supported as) - powerpc64-linux-gnu P8 (w/i and w/o p10 supported as) BTW, there are some noises during regression testings due to newer versions binutils, but they were identified as unrelated after some checkings. Is it ok for trunk? BR, Kewen ----- libgcc/ChangeLog: * configure: Regenerate. * configure.ac (test for libgcc_cv_powerpc_3_1_float128_hw): Fix typos among name, CFLAGS and test case. * config/rs6000/t-float128-hw(fp128_3_1_hw_funcs, fp128_3_1_hw_src, fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj, fp128_3_1_hw_obj): Remove variables for ISA 3.1 support. * config/rs6000/t-float128-p10-hw (FLOAT128_HW_INSNS): Append macro FLOAT128_HW_INSNS_ISA3_1 for ISA 3.1 support. (FP128_3_1_CFLAGS_HW): Fix option typo. * config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): Guarded with FLOAT128_HW_INSNS_ISA3_1. (__floattikf_resolve): Likewise. (__floatuntikf_resolve): Likewise. (__fixkfti_resolve): Likewise. (__fixunskfti_resolve): Likewise. (__floattikf): Likewise. (__floatuntikf): Likewise. (__fixkfti): Likewise. (__fixunskfti): Likewise. libgcc/config/rs6000/float128-ifunc.c | 9 ++++++++- libgcc/config/rs6000/t-float128-hw | 16 ---------------- libgcc/config/rs6000/t-float128-p10-hw | 4 ++-- libgcc/configure | 18 +++++++++--------- libgcc/configure.ac | 14 +++++++------- 5 files changed, 26 insertions(+), 35 deletions(-) diff --git a/libgcc/config/rs6000/float128-ifunc.c b/libgcc/config/rs6000/float128-ifunc.c index 57545dd7edb..ef7f731bf0b 100644 --- a/libgcc/config/rs6000/float128-ifunc.c +++ b/libgcc/config/rs6000/float128-ifunc.c @@ -46,7 +46,9 @@ #endif #define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW) +#ifdef FLOAT128_HW_INSNS_ISA3_1 #define SW_OR_HW_ISA3_1(SW, HW) (__builtin_cpu_supports ("arch_3_1") ? HW : SW) +#endif /* Resolvers. */ static __typeof__ (__addkf3_sw) * @@ -97,6 +99,7 @@ __floatdikf_resolve (void) return SW_OR_HW (__floatdikf_sw, __floatdikf_hw); } +#ifdef FLOAT128_HW_INSNS_ISA3_1 static __typeof__ (__floattikf_sw) * __floattikf_resolve (void) { @@ -108,6 +111,7 @@ __floatuntikf_resolve (void) { return SW_OR_HW_ISA3_1 (__floatuntikf_sw, __floatuntikf_hw); } +#endif static __typeof__ (__floatunsikf_sw) * __floatunsikf_resolve (void) @@ -121,7 +125,7 @@ __floatundikf_resolve (void) return SW_OR_HW (__floatundikf_sw, __floatundikf_hw); } - +#ifdef FLOAT128_HW_INSNS_ISA3_1 static __typeof__ (__fixkfti_sw) * __fixkfti_resolve (void) { @@ -133,6 +137,7 @@ __fixunskfti_resolve (void) { return SW_OR_HW_ISA3_1 (__fixunskfti_sw, __fixunskfti_hw); } +#endif static __typeof__ (__fixkfsi_sw) * __fixkfsi_resolve (void) @@ -323,6 +328,7 @@ TFtype __floatsikf (SItype_ppc) TFtype __floatdikf (DItype_ppc) __attribute__ ((__ifunc__ ("__floatdikf_resolve"))); +#ifdef FLOAT128_HW_INSNS_ISA3_1 TFtype __floattikf (TItype_ppc) __attribute__ ((__ifunc__ ("__floattikf_resolve"))); @@ -334,6 +340,7 @@ TItype_ppc __fixkfti (TFtype) UTItype_ppc __fixunskfti (TFtype) __attribute__ ((__ifunc__ ("__fixunskfti_resolve"))); +#endif TFtype __floatunsikf (USItype_ppc) __attribute__ ((__ifunc__ ("__floatunsikf_resolve"))); diff --git a/libgcc/config/rs6000/t-float128-hw b/libgcc/config/rs6000/t-float128-hw index c0827366cc4..d64ca4dd694 100644 --- a/libgcc/config/rs6000/t-float128-hw +++ b/libgcc/config/rs6000/t-float128-hw @@ -13,13 +13,6 @@ fp128_hw_static_obj = $(addsuffix $(objext),$(fp128_hw_funcs)) fp128_hw_shared_obj = $(addsuffix _s$(objext),$(fp128_hw_funcs)) fp128_hw_obj = $(fp128_hw_static_obj) $(fp128_hw_shared_obj) -# New functions for ISA 3.1 hardware support -fp128_3_1_hw_funcs = float128-p10 -fp128_3_1_hw_src = $(srcdir)/config/rs6000/float128-p10.c -fp128_3_1_hw_static_obj = $(addsuffix $(objext),$(fp128_3_1_hw_funcs)) -fp128_3_1_hw_shared_obj = $(addsuffix _s$(objext),$(fp128_3_1_hw_funcs)) -fp128_3_1_hw_obj = $(fp128_3_1_hw_static_obj) $(fp128_3_1_hw_shared_obj) - fp128_ifunc_funcs = float128-ifunc fp128_ifunc_src = $(srcdir)/config/rs6000/float128-ifunc.c fp128_ifunc_static_obj = float128-ifunc$(objext) @@ -37,18 +30,9 @@ FP128_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \ -I$(srcdir)/config/rs6000 \ $(FLOAT128_HW_INSNS) -FP128_3_1_CFLAGS_HW = -Wno-type-limits -mvsx -mcpu=power10 \ - -mfloat128-hardware -mno-gnu-attribute \ - -I$(srcdir)/soft-fp \ - -I$(srcdir)/config/rs6000 \ - $(FLOAT128_HW_INSNS) - $(fp128_hw_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_HW) $(fp128_hw_obj) : $(srcdir)/config/rs6000/t-float128-hw -$(fp128_3_1_hw_obj) : INTERNAL_CFLAGS += $(FP128_3_1_CFLAGS_HW) -$(fp128_3_1_hw_obj) : $(srcdir)/config/rs6000/t-float128-p10-hw - $(fp128_ifunc_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW) $(fp128_ifunc_obj) : $(srcdir)/config/rs6000/t-float128-hw diff --git a/libgcc/config/rs6000/t-float128-p10-hw b/libgcc/config/rs6000/t-float128-p10-hw index de36227c3d1..edaaee0e478 100644 --- a/libgcc/config/rs6000/t-float128-p10-hw +++ b/libgcc/config/rs6000/t-float128-p10-hw @@ -2,7 +2,7 @@ # Tell the float128 functions that the ISA 3.1 hardware support can # be compiled it to be selected via IFUNC functions. -FLOAT128_HW_INSNS = -DFLOAT128_HW_INSNS +FLOAT128_HW_INSNS += -DFLOAT128_HW_INSNS_ISA3_1 # New functions for hardware support @@ -14,7 +14,7 @@ fp128_3_1_hw_obj = $(fp128_3_1_hw_static_obj) $(fp128_3_1_hw_shared_obj) # Build the hardware support functions with appropriate hardware support FP128_3_1_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \ - -mpower10 \ + -mcpu=power10 \ -mfloat128-hardware -mno-gnu-attribute \ -I$(srcdir)/soft-fp \ -I$(srcdir)/config/rs6000 \ diff --git a/libgcc/configure b/libgcc/configure index ce05e0dd48b..4919a56f518 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -5265,10 +5265,10 @@ $as_echo "$libgcc_cv_powerpc_float128_hw" >&6; } CFLAGS="$saved_CFLAGS" saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mpower10 -mfloat128-hardware" + CFLAGS="$CFLAGS -mcpu=power10 -mfloat128-hardware" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 3.1 to build hardware __float128 libraries" >&5 $as_echo_n "checking for PowerPC ISA 3.1 to build hardware __float128 libraries... " >&6; } -if ${libgcc_cv_powerpc_float128_hw+:} false; then : +if ${libgcc_cv_powerpc_3_1_float128_hw+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5280,15 +5280,15 @@ else #ifndef __BUILTIN_CPU_SUPPORTS__ #error "__builtin_cpu_supports is not available" #endif - vector unsigned char add (vector unsigned char a, vector unsigned char b) + vector unsigned char conv (vector unsigned char qs) { vector unsigned char ret; - __asm__ ("xscvsqqp %0,%1,%2" : "=v" (ret) : "v" (a), "v" (b)); + __asm__ ("xscvsqqp %0,%1" : "=v" (ret) : "v" (qs)); return ret; } - void *add_resolver (void) { return (void *) add; } - __float128 add_ifunc (__float128, __float128) - __attribute__ ((__ifunc__ ("add_resolver"))); + void *conv_resolver (void) { return (void *) conv; } + __float128 conv_ifunc (__float128) + __attribute__ ((__ifunc__ ("conv_resolver"))); _ACEOF if ac_fn_c_try_compile "$LINENO"; then : libgcc_cv_powerpc_3_1_float128_hw=yes @@ -5297,8 +5297,8 @@ else 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_hw" >&5 - $as_echo "$libgcc_cv_powerpc_float128_hw" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_3_1_float128_hw" >&5 +$as_echo "$libgcc_cv_powerpc_3_1_float128_hw" >&6; } CFLAGS="$saved_CFLAGS" esac diff --git a/libgcc/configure.ac b/libgcc/configure.ac index bc315dec7e4..13a80b2551b 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -460,9 +460,9 @@ powerpc*-*-linux*) CFLAGS="$saved_CFLAGS" saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mpower10 -mfloat128-hardware" + CFLAGS="$CFLAGS -mcpu=power10 -mfloat128-hardware" AC_CACHE_CHECK([for PowerPC ISA 3.1 to build hardware __float128 libraries], - [libgcc_cv_powerpc_float128_hw], + [libgcc_cv_powerpc_3_1_float128_hw], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE([#include #ifndef AT_PLATFORM @@ -471,15 +471,15 @@ powerpc*-*-linux*) #ifndef __BUILTIN_CPU_SUPPORTS__ #error "__builtin_cpu_supports is not available" #endif - vector unsigned char add (vector unsigned char a, vector unsigned char b) + vector unsigned char conv (vector unsigned char qs) { vector unsigned char ret; - __asm__ ("xscvsqqp %0,%1,%2" : "=v" (ret) : "v" (a), "v" (b)); + __asm__ ("xscvsqqp %0,%1" : "=v" (ret) : "v" (qs)); return ret; } - void *add_resolver (void) { return (void *) add; } - __float128 add_ifunc (__float128, __float128) - __attribute__ ((__ifunc__ ("add_resolver")));])], + void *conv_resolver (void) { return (void *) conv; } + __float128 conv_ifunc (__float128) + __attribute__ ((__ifunc__ ("conv_resolver")));])], [libgcc_cv_powerpc_3_1_float128_hw=yes], [libgcc_cv_powerpc_3_1_float128_hw=no])]) CFLAGS="$saved_CFLAGS"