From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 44A3C3857C52; Fri, 14 Aug 2020 17:14:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 44A3C3857C52 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07EH3LaI145002; Fri, 14 Aug 2020 13:14:08 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32wx0f1cvg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Aug 2020 13:14:08 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07EH3NVc145482; Fri, 14 Aug 2020 13:14:08 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 32wx0f1cvb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Aug 2020 13:14:08 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07EHAN98005694; Fri, 14 Aug 2020 17:14:07 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma01dal.us.ibm.com with ESMTP id 32skpa8kur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Aug 2020 17:14:07 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07EHE69938011314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Aug 2020 17:14:06 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BECC1AC059; Fri, 14 Aug 2020 17:14:06 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A829AC05E; Fri, 14 Aug 2020 17:14:06 +0000 (GMT) Received: from lexx (unknown [9.163.2.104]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 14 Aug 2020 17:14:05 +0000 (GMT) Message-ID: Subject: Re: [Patch 3/5] rs6000, Add TI to TD (128-bit DFP) and TD to TI support From: will schmidt To: Carl Love , segher@gcc.gnu.org, dje.gcc@gmail.com, gcc-patches@gcc.gnu.org Date: Fri, 14 Aug 2020 12:13:57 -0500 In-Reply-To: <0b7a0fc49cebb090b77ac8270cad41dd3be75758.camel@us.ibm.com> References: <0b7a0fc49cebb090b77ac8270cad41dd3be75758.camel@us.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-14_12:2020-08-14, 2020-08-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 suspectscore=0 phishscore=0 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008140127 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, 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-List-Received-Date: Fri, 14 Aug 2020 17:14:11 -0000 On Tue, 2020-08-11 at 12:22 -0700, Carl Love wrote: > Segher, Will: > > Path 3 adds support for converting to/from 128-bit integers and 128-bit > decimal floating point formats. > > Carl Love > Some cosmetic comments below. overall lgtm. Thanks, -Will > > ---------------------------------------------------------------- > Add TI to TD (128-bit DFP) and TD to TI support > > gcc/ChangeLog > > 2020-08-10 Carl Love > * config/rs6000/dfp.md (floattitd2, fixtdti2): New define_insns. > > gcc/testsuite/ChangeLog > > 2020-08-10 Carl Love > * gcc.target/powerpc/int_128bit-runnable.c: Add tests. Update test. (This test already exists). > --- > gcc/config/rs6000/dfp.md | 15 +++++ > .../gcc.target/powerpc/int_128bit-runnable.c | 64 +++++++++++++++++++ nit - Path to testcase looks strange? > 2 files changed, 79 insertions(+) > > diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md > index 8f822732bac..ac9fe189f3e 100644 > --- a/gcc/config/rs6000/dfp.md > +++ b/gcc/config/rs6000/dfp.md > @@ -222,6 +222,13 @@ > "dcffixq %0,%1" > [(set_attr "type" "dfp")]) > > +(define_insn "floattitd2" > + [(set (match_operand:TD 0 "gpc_reg_operand" "=d") > + (float:TD (match_operand:TI 1 "gpc_reg_operand" "v")))] > + "TARGET_TI_VECTOR_OPS" > + "dcffixqq %0,%1" > + [(set_attr "type" "dfp")]) > + > ;; Convert a decimal64/128 to a decimal64/128 whose value is an integer. > ;; This is the first stage of converting it to an integer type. > Compared to some existing define_insn entries, this matches the style, looks reasonable. > @@ -241,6 +248,14 @@ > "TARGET_DFP" > "dctfix %0,%1" > [(set_attr "type" "dfp")]) > + > + ;; carll Fix comment. > +(define_insn "fixtdti2" > + [(set (match_operand:TI 0 "gpc_reg_operand" "=v") > + (fix:TI (match_operand:TD 1 "gpc_reg_operand" "d")))] > + "TARGET_TI_VECTOR_OPS" > + "dctfixqq %0,%1" > + [(set_attr "type" "dfp")]) > looks reasonable. > ;; Decimal builtin support > > diff --git a/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c b/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c > index c84494fc28d..d1e69cea021 100644 > --- a/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c > +++ b/gcc/testsuite/gcc.target/powerpc/int_128bit-runnable.c > @@ -38,6 +38,7 @@ > #if DEBUG > #include > #include > +#include > > > void print_i128(__int128_t val) > @@ -59,6 +60,13 @@ int main () > __int128_t arg1, result; > __uint128_t uarg2; > > + _Decimal128 arg1_dfp128, result_dfp128, expected_result_dfp128; > + > + struct conv_t { > + __uint128_t u128; > + _Decimal128 d128; > + } conv, conv2; > + > vector signed long long int vec_arg1_di, vec_arg2_di; > vector unsigned long long int vec_uarg1_di, vec_uarg2_di, vec_uarg3_di; > vector unsigned long long int vec_uresult_di; > @@ -2249,6 +2257,62 @@ int main () > abort(); > #endif > } > + > + /* DFP to __int128 and __int128 to DFP conversions */ > + /* Can't get printing of DFP values to work. Print the DFP value as an > + unsigned int so we can see the bit patterns. */ > +#if 1 I'd recommend dropping the #if 1 and matching #endif. > + conv.u128 = 0x2208000000000000ULL; > + conv.u128 = (conv.u128 << 64) | 0x4ULL; //DFP bit pattern for integer 4 > + expected_result_dfp128 = conv.d128; > + > + arg1 = 4; > + > + conv.d128 = (_Decimal128) arg1; > + > + result_dfp128 = (_Decimal128) arg1; > + if (((conv.u128 >>64) != 0x2208000000000000ULL) && > + ((conv.u128 & 0xFFFFFFFFFFFFFFFF) != 0x4ULL)) { > +#if DEBUG > + printf("ERROR: convert int128 value "); > + print_i128 (arg1); > + conv.d128 = result_dfp128; > + printf("\nto DFP value 0x%llx %llx (printed as hex bit string) ", > + (unsigned long long)((conv.u128) >>64), > + (unsigned long long)((conv.u128) & 0xFFFFFFFFFFFFFFFF)); > + > + conv.d128 = expected_result_dfp128; > + printf("\ndoes not match expected_result = 0x%llx %llx\n\n", > + (unsigned long long) (conv.u128>>64), > + (unsigned long long) (conv.u128 & 0xFFFFFFFFFFFFFFFF)); > +#else > + abort(); > +#endif > + } > +#endif > + > + expected_result = 4; > > + conv.u128 = 0x2208000000000000ULL; > + conv.u128 = (conv.u128 << 64) | 0x4ULL; // 4 as DFP > + arg1_dfp128 = conv.d128; > + > + result = (__int128_t) arg1_dfp128; > + > + if (result != expected_result) { > +#if DEBUG > + printf("ERROR: convert DFP value "); > + printf("0x%llx %llx (printed as hex bit string) ", > + (unsigned long long)(conv.u128>>64), > + (unsigned long long)(conv.u128 & 0xFFFFFFFFFFFFFFFF)); > + printf("to __int128 value = "); > + print_i128 (result); > + printf("\ndoes not match expected_result = "); > + print_i128 (expected_result); > + printf("\n"); > +#else > + abort(); > +#endif > + } > return 0; > }