From patchwork Tue Jun 2 21:02:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Sawdey X-Patchwork-Id: 1302634 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org 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=VG/CvnmD; 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 49c4Jm6vTPz9sT5 for ; Wed, 3 Jun 2020 07:03:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B614389851A; Tue, 2 Jun 2020 21:03:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B614389851A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591131812; bh=YitBZJGXwMN+beMXNhfX9+S42uX/b2Myz6MNeJP05FQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=VG/CvnmDNwODvq17XRo/ar1NstVjChgNUVThYHs4N5JA539NEn4J5Gdzbqjj98WgB SIFY09RxRf9R7OOgujO9qBk+qmRjb2GWmJM+YyI5QyB/Iot5tTcQwv6cXnDUCHo10y 5m71GtGejkHfDWyDY1nYq9tfcFi1I2Z0GGJaWYNo= 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 F26333898517 for ; Tue, 2 Jun 2020 21:03:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F26333898517 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 052L3Qrd172914; Tue, 2 Jun 2020 17:03:29 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 31dkc15r12-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Jun 2020 17:03:27 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 052KtvQv008796; Tue, 2 Jun 2020 21:02:26 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma03dal.us.ibm.com with ESMTP id 31bf49n9pu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Jun 2020 21:02:26 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 052L2OiY39125288 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Jun 2020 21:02:24 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 623596A047; Tue, 2 Jun 2020 21:02:24 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C4A16A066; Tue, 2 Jun 2020 21:02:24 +0000 (GMT) Received: from marlin.aus.stglabs.ibm.com (unknown [9.40.194.84]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTPS; Tue, 2 Jun 2020 21:02:24 +0000 (GMT) Received: from marlin.aus.stglabs.ibm.com (localhost [127.0.0.1]) by marlin.aus.stglabs.ibm.com (8.15.2/8.15.2/Debian-10) with ESMTP id 052L2Nkp022852; Tue, 2 Jun 2020 16:02:23 -0500 Received: (from sawdey@localhost) by marlin.aus.stglabs.ibm.com (8.15.2/8.15.2/Submit) id 052L2Mt8022676; Tue, 2 Jun 2020 16:02:22 -0500 To: gcc-patches@gcc.gnu.org Subject: [PATCH] rs6000: identify lfs prefixed case PR95347 Date: Tue, 2 Jun 2020 16:02:17 -0500 Message-Id: <20200602210217.20140-1-acsawdey@linux.ibm.com> X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-02_15:2020-06-02, 2020-06-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 mlxlogscore=999 spamscore=0 mlxscore=0 bulkscore=0 cotscore=-2147483648 lowpriorityscore=0 impostorscore=0 suspectscore=1 priorityscore=1501 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006020150 X-Spam-Status: No, score=-24.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Aaron Sawdey via Gcc-patches From: Aaron Sawdey Reply-To: Aaron Sawdey Cc: meissner@linux.ibm.com, wschmidt@linux.ibm.com, segher@kernel.crashing.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The same problem also arises for plfs where prefixed_load_p() doesn't recognize it so we get just lfs in the asm output with a @pcrel address. OK for trunk if regstrap on ppc64le passes? Thanks, Aaron PR target/95347 * config/rs6000/rs6000.c (is_stfs_insn): Rename to is_lfs_stfs_insn and make it recognize lfs as well. (prefixed_store_p): Use is_lfs_stfs_insn(). (prefixed_load_p): Use is_lfs_stfs_insn() to recognize lfs. --- gcc/config/rs6000/rs6000.c | 41 +++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index ba9069ecc3b..8ed8ae04e7a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -24980,14 +24980,18 @@ address_to_insn_form (rtx addr, return INSN_FORM_BAD; } -/* Helper function to see if we're potentially looking at stfs. +/* Helper function to see if we're potentially looking at lfs/stfs. - PARALLEL containing a SET and a CLOBBER - - SET is from UNSPEC_SI_FROM_SF to MEM:SI - - CLOBBER is a V4SF + - stfs: + - SET is from UNSPEC_SI_FROM_SF to MEM:SI + - CLOBBER is a V4SF + - lfs: + - SET is from UNSPEC_SF_FROM_SI to REG:SF + - CLOBBER is a DI */ static bool -is_stfs_insn (rtx_insn *insn) +is_lfs_stfs_insn (rtx_insn *insn) { rtx pattern = PATTERN (insn); if (GET_CODE (pattern) != PARALLEL) @@ -25013,16 +25017,22 @@ is_stfs_insn (rtx_insn *insn) rtx src = SET_SRC (set); rtx scratch = SET_DEST (clobber); - if (GET_CODE (src) != UNSPEC || XINT (src, 1) != UNSPEC_SI_FROM_SF) + if (GET_CODE (src) != UNSPEC) return false; - if (GET_CODE (dest) != MEM || GET_MODE (dest) != SImode) - return false; + /* stfs case. */ + if (XINT (src, 1) == UNSPEC_SI_FROM_SF + && GET_CODE (dest) == MEM && GET_MODE (dest) == SImode + && GET_CODE (scratch) == SCRATCH && GET_MODE (scratch) == V4SFmode) + return true; - if (GET_CODE (scratch) != SCRATCH || GET_MODE (scratch) != V4SFmode) - return false; + /* lfs case. */ + if (XINT (src, 1) == UNSPEC_SF_FROM_SI + && GET_CODE (dest) == REG && GET_MODE (dest) == SFmode + && GET_CODE (scratch) == SCRATCH && GET_MODE (scratch) == DImode) + return true; - return true; + return false; } /* Helper function to take a REG and a MODE and turn it into the non-prefixed @@ -25135,7 +25145,14 @@ prefixed_load_p (rtx_insn *insn) else non_prefixed = reg_to_non_prefixed (reg, mem_mode); - return address_is_prefixed (XEXP (mem, 0), mem_mode, non_prefixed); + fprintf(stderr,"prefixed_load_p regmode %s memmode %s non_prefixed %d\n", + GET_MODE_NAME(reg_mode), GET_MODE_NAME(mem_mode), non_prefixed); + debug_rtx(insn); + + if (non_prefixed == NON_PREFIXED_X && is_lfs_stfs_insn (insn)) + return address_is_prefixed (XEXP (mem, 0), mem_mode, NON_PREFIXED_DEFAULT); + else + return address_is_prefixed (XEXP (mem, 0), mem_mode, non_prefixed); } /* Whether a store instruction is a prefixed instruction. This is called from @@ -25170,7 +25187,7 @@ prefixed_store_p (rtx_insn *insn) /* Need to make sure we aren't looking at a stfs which doesn't look like the other things reg_to_non_prefixed/address_is_prefixed looks for. */ - if (non_prefixed == NON_PREFIXED_X && is_stfs_insn (insn)) + if (non_prefixed == NON_PREFIXED_X && is_lfs_stfs_insn (insn)) return address_is_prefixed (addr, mem_mode, NON_PREFIXED_DEFAULT); else return address_is_prefixed (addr, mem_mode, non_prefixed);