From patchwork Fri Jul 12 07:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1959692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=UQ+c0iDh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WL2gj0CBwz1xqc for ; Fri, 12 Jul 2024 17:06:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 413083842FEF for ; Fri, 12 Jul 2024 07:06:07 +0000 (GMT) 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 6B7B93858D39 for ; Fri, 12 Jul 2024 07:05:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B7B93858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6B7B93858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720767943; cv=none; b=F7GwSWdNVSQq+kaPEA5RjvuS19drzgz6BW0NORTIzY5oRLMBypqlZqVfettcBvBpx018/IPLiQQm9cCetR7+ZeQ5qwoLPYysdMYRmKqDNcmEU5r6DSr22C7XQBk+fjVnMTXqcVf9k1zYarKcLj5QLenL0NkUXi+1LKA6bBouubE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720767943; c=relaxed/simple; bh=Qr7h0+cn66NmiZt49q3T+7cxMaPfu8RM1ZeU0fRnLhw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=hitJ45MdV6dGbnCu/Ehh3VT9ucE+CPwynuVTEy759LsghHdkiA37CrPR7FtjpHSHfink8798ktBPr91c7kjuWfA0BMgJ3SialOCeAR0hDCRbshCZXBt0fhKyIiSWoJv9AR4EEQGUfqIZBxc8y5wMJypwnCCIojGtm9lEwEwPD80= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46C6wsso010761; Fri, 12 Jul 2024 07:05:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= message-id:date:mime-version:subject:from:to:cc:references :in-reply-to:content-type:content-transfer-encoding; s=pp1; bh=R sK2mmYI3vo1Gwzc3UGFiUcNVU5yFF2vBwbksZgJ2ZM=; b=UQ+c0iDhzT7jwHDNU KqSTfD412SX3OZflxwaoP1QaYuptjia6XHx3yZ8FzaZyStyilhxp9/6eYHlhOAhr REReZfh5XF8R9k+u83gZQUFHT9dQImvBd+UTZpq4IJIgS25Xjtw/1vE0jHzJGY+B 2djRlGyHoznNXoXKIJ3uscNUxTiNLcHr7ikOjr6SgrEjNKEelpepa5rWoLIko+dN Tp5O/dGl9S6GaZ8CYPPQEuLw5gr0PFC1zKtafxYSJ8WHjwib3wZC562dpgFeN27E SH58nFdRcbrulTX0UvafLe+49ygJzPvagtIM8p5cI3Zs8eknpgQypZb752T4AVBT eDe8g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40aypkr13j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 07:05:37 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 46C75aBl023967; Fri, 12 Jul 2024 07:05:37 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40aypkr13g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 07:05:36 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 46C4MaB4013998; Fri, 12 Jul 2024 07:05:36 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 407jy3mua6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Jul 2024 07:05:35 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 46C75W7O52756966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2024 07:05:34 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48BD720049; Fri, 12 Jul 2024 07:05:32 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70FA820040; Fri, 12 Jul 2024 07:05:30 +0000 (GMT) Received: from [9.197.243.49] (unknown [9.197.243.49]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2024 07:05:30 +0000 (GMT) Message-ID: <2fcb1f59-94ac-95d5-fe6f-13e873b5edca@linux.ibm.com> Date: Fri, 12 Jul 2024 15:05:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: [PATCH] rs6000: Change optab for ibm128 and ieee128 conversion Content-Language: en-US From: "Kewen.Lin" To: GCC Patches Cc: Segher Boessenkool , Peter Bergner , David Edelsohn , Richard Sandiford References: <4db7560b-5195-8ae0-dfe9-bae0d1e17dc4@linux.ibm.com> <74dc1a17-8d2d-229c-313b-c11ccc1d7bac@linux.ibm.com> In-Reply-To: <74dc1a17-8d2d-229c-313b-c11ccc1d7bac@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: HeHQcLxzRjgHai4URZTSviii5ZvXBJDB X-Proofpoint-ORIG-GUID: 9lfEj1nQiwry3fsl3fUvKFU5KHRdhlLK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-12_04,2024-07-11_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxlogscore=704 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2407120046 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, Currently for 128 bit floating-point ibm128 and ieee128 formats conversion, the corresponding libcalls are: ibm128 -> ieee128 "__trunctfkf2" ieee128 -> ibm128 "__extendkftf2" , and generic code handling (like convert_mode_scalar) also adopts sext_optab for ieee128 -> ibm128 while trunc_optab for ibm128 -> ieee128. But in rs6000 port as function rs6000_expand_float128_convert and init_float128_ieee show, we adopt sext_optab for ibm128 -> ieee128 with "__trunctfkf2" while trunc_optab for ieee128 -> ibm128 with "__extendkftf2". To make them consistent and avoid some surprises, this patch is to adjust rs6000 internal handlings by adopting trunc_optab for ibm128 -> ieee128 with "__trunctfkf2" while sext_optab for ieee128 -> ibm128 with "__extendkftf2". Bootstrapped and regtested on powerpc64{,le}-linux-gnu (ibm128 long double default) and powerpc64le-linux-gnu (ieee128 long double default). I'm going to install this next week if no objections. BR, Kewen ----- gcc/ChangeLog: * config/rs6000/rs6000.cc (init_float128_ieee): Use trunc_optab rather than sext_optab for converting FLOAT128_IBM_P mode to FLOAT128_IEEE_P mode, and use sext_optab rather than trunc_optab for converting FLOAT128_IEEE_P mode to FLOAT128_IBM_P mode. (rs6000_expand_float128_convert): Likewise. --- gcc/config/rs6000/rs6000.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.43.5 diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 4af1eeb3722..7e30ab5b207 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -11460,13 +11460,13 @@ init_float128_ieee (machine_mode mode) set_conv_libfunc (trunc_optab, SFmode, mode, "__trunckfsf2"); set_conv_libfunc (trunc_optab, DFmode, mode, "__trunckfdf2"); - set_conv_libfunc (sext_optab, mode, IFmode, "__trunctfkf2"); + set_conv_libfunc (trunc_optab, mode, IFmode, "__trunctfkf2"); if (mode != TFmode && FLOAT128_IBM_P (TFmode)) - set_conv_libfunc (sext_optab, mode, TFmode, "__trunctfkf2"); + set_conv_libfunc (trunc_optab, mode, TFmode, "__trunctfkf2"); - set_conv_libfunc (trunc_optab, IFmode, mode, "__extendkftf2"); + set_conv_libfunc (sext_optab, IFmode, mode, "__extendkftf2"); if (mode != TFmode && FLOAT128_IBM_P (TFmode)) - set_conv_libfunc (trunc_optab, TFmode, mode, "__extendkftf2"); + set_conv_libfunc (sext_optab, TFmode, mode, "__extendkftf2"); set_conv_libfunc (sext_optab, mode, SDmode, "__dpd_extendsdkf"); set_conv_libfunc (sext_optab, mode, DDmode, "__dpd_extendddkf"); @@ -15624,7 +15624,7 @@ rs6000_expand_float128_convert (rtx dest, rtx src, bool unsigned_p) case E_IFmode: case E_TFmode: if (FLOAT128_IBM_P (src_mode)) - cvt = sext_optab; + cvt = trunc_optab; else do_move = true; break; @@ -15686,7 +15686,7 @@ rs6000_expand_float128_convert (rtx dest, rtx src, bool unsigned_p) case E_IFmode: case E_TFmode: if (FLOAT128_IBM_P (dest_mode)) - cvt = trunc_optab; + cvt = sext_optab; else do_move = true; break;