From patchwork Thu Mar 30 14:37:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 745290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vv6fc3VJ3z9s1y for ; Fri, 31 Mar 2017 01:37:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hF+qqlPv"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:date:mime-version:in-reply-to :content-type:content-transfer-encoding:message-id; q=dns; s= default; b=I0556coG6/TyWhTpNVRe9aMMJYtxfgZAHY5wr31A4fQC8xFpNsmEx a3egIMf4LJ+H+KUb2Rqs4WwIGxG9cAsY3oBawxJOWvmmkJhMTOwZTyV6W+UeOICf 2YObb4Eq7mj0GmyKvgFk4N/QbfePb3iylynxLWraeHNTcU+v2gRxnA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:date:mime-version:in-reply-to :content-type:content-transfer-encoding:message-id; s=default; bh=X3cjVig5NIm/AfNaAVneht/+hIw=; b=hF+qqlPv7k3MsyBQU+s8n94gQq6l Cl4slbeCEVO3WfhXBpM8NbFSwQs7TTNd+lQLs5s1ZGbUIVYBGkVsk9jcVlKtr/pQ rCiZh2/2pSsqoUXlawgQhJDgZ1QW8/S9mpyWZgru3WzVdFMxhbQ0hji3HWXzAufX jFLZ8+zpyGhqQbs= Received: (qmail 112510 invoked by alias); 30 Mar 2017 14:37:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 112494 invoked by uid 89); 30 Mar 2017 14:37:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=teh X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Mar 2017 14:37:11 +0000 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2UETBFZ132661 for ; Thu, 30 Mar 2017 10:37:11 -0400 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0a-001b2d01.pphosted.com with ESMTP id 29h1peff8t-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 30 Mar 2017 10:37:11 -0400 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Mar 2017 10:37:09 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 30 Mar 2017 10:37:06 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2UEb5lJ44630102; Thu, 30 Mar 2017 14:37:06 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6D2AAC06F; Thu, 30 Mar 2017 10:36:56 -0400 (EDT) Received: from otta.rchland.ibm.com (unknown [9.10.86.70]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 55D22AC040; Thu, 30 Mar 2017 10:36:56 -0400 (EDT) Subject: Re: [PATCH, rs6000] Fix PR target/80246, DFP builtins using the wrong types To: Segher Boessenkool References: <20170329222858.GZ4402@gate.crashing.org> <530c97bd-1669-dd67-528e-3f879efa8bac@vnet.ibm.com> Cc: GCC Patches , David Edelsohn , Bill Schmidt From: Peter Bergner Date: Thu, 30 Mar 2017 09:37:05 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <530c97bd-1669-dd67-528e-3f879efa8bac@vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17033014-0036-0000-0000-000001C7C4A2 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006875; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00840826; UDB=6.00413887; IPR=6.00618820; BA=6.00005248; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014865; XFM=3.00000013; UTC=2017-03-30 14:37:08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17033014-0037-0000-0000-00003F4F470B Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-30_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703300130 X-IsSubscribed: yes On 3/29/17 6:29 PM, Peter Bergner wrote: > On 3/29/17 5:28 PM, Segher Boessenkool wrote: >>> +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ >>> +/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ >>> +/* { dg-require-effective-target dfp } */ >> >> You can leave off the default arguments "*" "". Do we really need to >> explicitly skip on Darwin and SPE if there is a test for DFP anyway? Ok, I removed the darwin and spe tests, since the dfp requirement will disallow those. I made the same change to teh dfp-builtin-1.c test case as well. I also failed to realize that dfp-builtin-1.c was failing due to the check for no "stfd" and "lfd", which we will now expect to see, since we're compiling the test case with -mcpu=power7, therefore I updated the test case to expect them. >>> +/* { dg-final { scan-assembler-not "drintn\\." } } */ >>> +/* { dg-final { scan-assembler-not "drintnq\\." } } */ >>> +/* { dg-final { scan-assembler-not "dctfix" } } */ >>> +/* { dg-final { scan-assembler-not "dctfixq" } } */ >> >> If there is no "dctfix" there surely is no "dctfixq" either (i.e., your >> regexen aren't very tight). > > Ahh, true. I suppose I could also just look for "drintn" too, > since that would catch both drintn. and drintnq., ok with that > change? Fixed. Here is an updated patch. Is this better? Peter gcc/ PR target/80246 * config/rs6000/dfp.md (dfp_dxex_): Update mode of operand 0. (dfp_diex_): Update mode of operand 1. * doc/extend.texi (dxex, dxexq): Document change to return type. (diex, diexq): Document change to argument type. gcc/testsuite/ PR target/80246 * gcc.target/powerpc/dfp-builtin-1.c (dxex, dxexq): Update return types. (diex, diexq): Update argument type. * gcc.target/powerpc/pr80246.c: New test. Index: gcc/config/rs6000/dfp.md =================================================================== --- gcc/config/rs6000/dfp.md (revision 246539) +++ gcc/config/rs6000/dfp.md (working copy) @@ -348,9 +348,9 @@ [(set_attr "type" "dfp")]) (define_insn "dfp_dxex_" - [(set (match_operand:D64_D128 0 "gpc_reg_operand" "=d") - (unspec:D64_D128 [(match_operand:D64_D128 1 "gpc_reg_operand" "d")] - UNSPEC_DXEX))] + [(set (match_operand:DI 0 "gpc_reg_operand" "=d") + (unspec:DI [(match_operand:D64_D128 1 "gpc_reg_operand" "d")] + UNSPEC_DXEX))] "TARGET_DFP" "dxex %0,%1" [(set_attr "type" "dfp")]) @@ -357,7 +357,7 @@ (define_insn "dfp_diex_" [(set (match_operand:D64_D128 0 "gpc_reg_operand" "=d") - (unspec:D64_D128 [(match_operand:D64_D128 1 "gpc_reg_operand" "d") + (unspec:D64_D128 [(match_operand:DI 1 "gpc_reg_operand" "d") (match_operand:D64_D128 2 "gpc_reg_operand" "d")] UNSPEC_DXEX))] "TARGET_DFP" Index: gcc/doc/extend.texi =================================================================== --- gcc/doc/extend.texi (revision 246539) +++ gcc/doc/extend.texi (working copy) @@ -15427,14 +15427,14 @@ of processors when hardware decimal floating point (@option{-mhard-dfp}) is available: @smallexample -_Decimal64 __builtin_dxex (_Decimal64); -_Decimal128 __builtin_dxexq (_Decimal128); +long long __builtin_dxex (_Decimal64); +long long __builtin_dxexq (_Decimal128); _Decimal64 __builtin_ddedpd (int, _Decimal64); _Decimal128 __builtin_ddedpdq (int, _Decimal128); _Decimal64 __builtin_denbcd (int, _Decimal64); _Decimal128 __builtin_denbcdq (int, _Decimal128); -_Decimal64 __builtin_diex (_Decimal64, _Decimal64); -_Decimal128 _builtin_diexq (_Decimal128, _Decimal128); +_Decimal64 __builtin_diex (long long, _Decimal64); +_Decimal128 _builtin_diexq (long long, _Decimal128); _Decimal64 __builtin_dscli (_Decimal64, int); _Decimal128 __builtin_dscliq (_Decimal128, int); _Decimal64 __builtin_dscri (_Decimal64, int); Index: gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c (revision 246539) +++ gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c (working copy) @@ -1,6 +1,4 @@ /* { dg-do compile { target { powerpc*-*-linux* } } } */ -/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ /* { dg-options "-mcpu=power7 -O2" } */ @@ -10,11 +8,13 @@ /* { dg-final { scan-assembler-times "diex " 1 } } */ /* { dg-final { scan-assembler-times "dscli " 2 } } */ /* { dg-final { scan-assembler-times "dscri " 2 } } */ +/* { dg-final { scan-assembler-times "std " 1 } } */ +/* { dg-final { scan-assembler-times "ld " 1 } } */ +/* { dg-final { scan-assembler-times "stfd " 1 } } */ +/* { dg-final { scan-assembler-times "lfd " 1 } } */ /* { dg-final { scan-assembler-not "bl __builtin" } } */ /* { dg-final { scan-assembler-not "dctqpq" } } */ /* { dg-final { scan-assembler-not "drdpq" } } */ -/* { dg-final { scan-assembler-not "stfd" } } */ -/* { dg-final { scan-assembler-not "lfd" } } */ _Decimal64 do_dedpd_0 (_Decimal64 a) @@ -52,7 +52,7 @@ return __builtin_denbcd (1, a); } -_Decimal64 +long long do_xex (_Decimal64 a) { return __builtin_dxex (a); @@ -59,7 +59,7 @@ } _Decimal64 -do_iex (_Decimal64 a, _Decimal64 b) +do_iex (long long a, _Decimal64 b) { return __builtin_diex (a, b); } Index: gcc/testsuite/gcc.target/powerpc/pr80246.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr80246.c (nonexistent) +++ gcc/testsuite/gcc.target/powerpc/pr80246.c (working copy) @@ -0,0 +1,35 @@ +/* { dg-do compile { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target dfp } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "dxex " 1 } } */ +/* { dg-final { scan-assembler-times "dxexq " 1 } } */ +/* { dg-final { scan-assembler-times "diex " 1 } } */ +/* { dg-final { scan-assembler-times "diexq " 1 } } */ +/* { dg-final { scan-assembler-not "bl __builtin" } } */ +/* { dg-final { scan-assembler-not "drintn" } } */ +/* { dg-final { scan-assembler-not "dctfix" } } */ +/* { dg-final { scan-assembler-not "dcffix" } } */ + +long long +do_xex (_Decimal64 arg) +{ + return __builtin_dxex (arg); +} + +long long +do_xexq (_Decimal128 arg) +{ + return __builtin_dxexq (arg); +} + +_Decimal64 +do_iex (long long exp, _Decimal64 arg) +{ + return __builtin_diex (exp, arg); +} + +_Decimal128 +do_iexq (long long exp, _Decimal128 arg) +{ + return __builtin_diexq (exp, arg); +}