From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66353 invoked by alias); 4 Dec 2017 21:32:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 66344 invoked by uid 89); 4 Dec 2017 21:32:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=meissner, Meissner X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Dec 2017 21:32:02 +0000 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vB4LTGdF095516 for ; Mon, 4 Dec 2017 16:32:00 -0500 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 2endqrseeu-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 04 Dec 2017 16:32:00 -0500 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Dec 2017 14:31:59 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 4 Dec 2017 14:31:57 -0700 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vB4LVuGM7471492; Mon, 4 Dec 2017 14:31:56 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7FFE6E040; Mon, 4 Dec 2017 14:31:56 -0700 (MST) Received: from ibm-tiger.the-meissners.org (unknown [9.32.77.111]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 9D6476E03F; Mon, 4 Dec 2017 14:31:56 -0700 (MST) Received: by ibm-tiger.the-meissners.org (Postfix, from userid 500) id 105EC483C7; Mon, 4 Dec 2017 16:31:55 -0500 (EST) Date: Mon, 04 Dec 2017 21:32:00 -0000 From: Michael Meissner To: Segher Boessenkool Cc: Michael Meissner , GCC Patches , David Edelsohn , Bill Schmidt Subject: Re: [PATCH #2], PR target/81959, Fix ++int to _Float128 conversion on power9 Mail-Followup-To: Michael Meissner , Segher Boessenkool , GCC Patches , David Edelsohn , Bill Schmidt References: <20171130215244.GA21037@ibm-tiger.the-meissners.org> <20171201233339.GI10515@gate.crashing.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: <20171201233339.GI10515@gate.crashing.org> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 17120421-0008-0000-0000-000008FA8EE9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008152; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000243; SDB=6.00955464; UDB=6.00482901; IPR=6.00735501; BA=6.00005727; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018345; XFM=3.00000015; UTC=2017-12-04 21:31:58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17120421-0009-0000-0000-00004507136E Message-Id: <20171204213155.GA14761@ibm-tiger.the-meissners.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-04_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712040302 X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00170.txt.bz2 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1190 On Fri, Dec 01, 2017 at 05:33:39PM -0600, Segher Boessenkool wrote: > Okay for trunk. Further improvements welcome ;-) Thanks! Here is the patch for GCC 7 (the bug shows up in GCC 7). It is slightly different due to the surrounding lines in rs6000.c being different. Is it ok to apply? There were no regressions in the build. This patch will not be needed in GCC 6. [gcc] 2017-12-04 Michael Meissner Back port from trunk 2017-12-01 Michael Meissner PR target/81959 * config/rs6000/rs6000.c (rs6000_address_for_fpconvert): Check for whether we can allocate pseudos before trying to fix an address. * config/rs6000/rs6000.md (float_si2_hw): Make sure the memory address is indexed or indirect. (floatuns_si2_hw2): Likewise. [gcct/testsuite] 2017-12-04 Michael Meissner Back port from trunk 2017-12-01 Michael Meissner PR target/81959 * gcc.target/powerpc/pr81959.c: New test. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pr81959.patch06b" Content-length: 2507 Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 255341) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -39938,7 +39938,8 @@ rs6000_address_for_fpconvert (rtx x) gcc_assert (MEM_P (x)); addr = XEXP (x, 0); - if (! legitimate_indirect_address_p (addr, strict_p) + if (can_create_pseudo_p () + && ! legitimate_indirect_address_p (addr, strict_p) && ! legitimate_indexed_address_p (addr, strict_p)) { if (GET_CODE (addr) == PRE_INC || GET_CODE (addr) == PRE_DEC) Index: gcc/config/rs6000/rs6000.md =================================================================== --- gcc/config/rs6000/rs6000.md (revision 255341) +++ gcc/config/rs6000/rs6000.md (working copy) @@ -14642,6 +14642,9 @@ (define_insn_and_split "float_si2_ { if (GET_CODE (operands[2]) == SCRATCH) operands[2] = gen_reg_rtx (DImode); + + if (MEM_P (operands[1])) + operands[1] = rs6000_address_for_fpconvert (operands[1]); }) (define_insn_and_split "float2" @@ -14705,6 +14708,9 @@ (define_insn_and_split "floatuns_s { if (GET_CODE (operands[2]) == SCRATCH) operands[2] = gen_reg_rtx (DImode); + + if (MEM_P (operands[1])) + operands[1] = rs6000_address_for_fpconvert (operands[1]); }) (define_insn_and_split "floatuns2" Index: gcc/testsuite/gcc.target/powerpc/pr81959.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr81959.c (nonexistent) +++ gcc/testsuite/gcc.target/powerpc/pr81959.c (working copy) @@ -0,0 +1,25 @@ +/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mpower9-vector -O2 -mfloat128" } */ + +/* PR 81959, the compiler raised on unrecognizable insn message in converting + int to __float128, where the int had a PRE_INC in the address. */ + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE 1024 +#endif + +void +convert_int_to_float128 (__float128 * __restrict__ p, + int * __restrict__ q) +{ + unsigned long i; + + for (i = 0; i < ARRAY_SIZE; i++) + p[i] = (__float128)q[i]; +} + +/* { dg-final { scan-assembler {\mlfiwax\M|\mlxsiwax\M} } } */ +/* { dg-final { scan-assembler {\mxscvsdqp\M} } } */ +/* { dg-final { scan-assembler-not {\mmtvsrd\M} } } */ +/* { dg-final { scan-assembler-not {\mmtvsrw[sz]\M} } } */ --0OAP2g/MAC+5xKAE--