From patchwork Wed Jan 17 03:29:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 84226 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A0353857831 for ; Wed, 17 Jan 2024 03:29:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 8CB043858C66 for ; Wed, 17 Jan 2024 03:29:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CB043858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8CB043858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705462168; cv=none; b=io+DNWoUt4zxxcGlA37HHHo1nm1jgn9r/B3p+zlWIK/74r9czPEFSvRAZQ0IKuUjUDuDJhpZXz+KOg1zDkwo2PaxzySc9UgnsVUrsAmgrmp30qMPfo1PPQFmfTdCStYZxow4PkVzI4U06UE0581dW5s6k0nEQBghwOX/ILNFqHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705462168; c=relaxed/simple; bh=8+H/zK+leIVagLoOWyErMUdyTShEdqMMEpTUj99Asz4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=B1kkA9jLJE+PYwXRvK+JBMPI9fY6k+tWLQ9ChDPUdBVpvApkMlvmp9D+TkfeApDM5Lbu/OIsy2UM+JzMXQRYsJvJ6cYhICv8oMkrUarrwEZ7efkeu9btXeeQ6wBOgh5hj+TJs0g47tkaDShh4+GaXbVH30ZtwtCyN/BRA8AjKWc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H1MmdA009189; Wed, 17 Jan 2024 03:29:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=WTtWJpA G7fEXECtQexNbmTL7bUJERl6w8TJ5KXMhN6o=; b=ERpQhlbvbt9EUStA5L4GZul Znp/qeu7JEAnmXge93lGGETq5rYaMBaHiLdKaej7231C5pnQq0K7dxJxSYOFSpqX 81ABWif2aFgVjbsp0vqbalzl//i2DoUhELpoNpnA27Cov/EnhWY1UlHJTtWiExyC hB0J4XzGaLXv/dh2QN/2kcGnbMpK5ce7bIWGUA5JOuM4+FrPE7mU7+kTRkOmIZbo 8YcL7TEERZEiq7jPGXWzGUsgxV04dcJd/KJ2SuqRS8DUSXa7dT4HzmbHtPb1YfR0 9w6SiHAagm8W3NgKDfjj0tkshrSq4tZt5DNP5BSfPz9HHbgvJQNVUCd9osH6aug= = Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vp4ak09x4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 03:29:21 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40H3TLlH005832 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 03:29:21 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 16 Jan 2024 19:29:21 -0800 From: Andrew Pinski To: CC: , Andrew Pinski Subject: [PATCH] aarch64: Fix aarch64_ldp_reg_operand predicate not to allow all subreg [PR113221] Date: Tue, 16 Jan 2024 19:29:04 -0800 Message-ID: <20240117032904.80831-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: gWBfDu3ZCoNSo_rjSYZYFkBTo9l5xgoz X-Proofpoint-GUID: gWBfDu3ZCoNSo_rjSYZYFkBTo9l5xgoz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-16_14,2024-01-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 bulkscore=0 mlxlogscore=432 mlxscore=0 impostorscore=0 phishscore=0 adultscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401170022 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+patchwork=sourceware.org@gcc.gnu.org So the problem here is that aarch64_ldp_reg_operand will all subreg even subreg of lo_sum. When LRA tries to fix that up, all things break. So the fix is to change the check to only allow reg and subreg of regs. Note the tendancy here is to use register_operand but that checks the mode of the register but we need to allow a mismatch modes for this predicate for now. Built and tested for aarch64-linux-gnu with no regressions (Also tested with the LD/ST pair pass back on). PR target/113221 gcc/ChangeLog: * config/aarch64/predicates.md (aarch64_ldp_reg_operand): For subreg, only allow REG operands isntead of allowing all. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/pr113221-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/predicates.md | 8 +++++++- gcc/testsuite/gcc.c-torture/compile/pr113221-1.c | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr113221-1.c diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md index 8a204e48bb5..256268517d8 100644 --- a/gcc/config/aarch64/predicates.md +++ b/gcc/config/aarch64/predicates.md @@ -313,7 +313,13 @@ (define_predicate "pmode_plus_operator" (define_special_predicate "aarch64_ldp_reg_operand" (and - (match_code "reg,subreg") + (ior + (match_code "reg") + (and + (match_code "subreg") + (match_test "GET_CODE (SUBREG_REG (op)) == REG") + ) + ) (match_test "aarch64_ldpstp_operand_mode_p (GET_MODE (op))") (ior (match_test "mode == VOIDmode") diff --git a/gcc/testsuite/gcc.c-torture/compile/pr113221-1.c b/gcc/testsuite/gcc.c-torture/compile/pr113221-1.c new file mode 100644 index 00000000000..152a510786e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr113221-1.c @@ -0,0 +1,12 @@ +/* { dg-options "-fno-move-loop-invariants -funroll-all-loops" } */ +/* PR target/113221 */ +/* This used to ICE after the `load/store pair fusion pass` was added + due to the predicate aarch64_ldp_reg_operand allowing too much. */ + + +void bar(); +void foo(int* b) { + for (;;) + *b++ = (long)bar; +} +