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 (QUIC)" X-Patchwork-Id: 188671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp671924dye; Tue, 16 Jan 2024 19:30:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpBpqbCfCm4DUPAJ/hgG6+giO4CS6/ug0pt0m/YvB1Y+HN6fzkXUjwN7IyLgaLPBodr9Hm X-Received: by 2002:a05:622a:9:b0:42a:b14:7f0 with SMTP id x9-20020a05622a000900b0042a0b1407f0mr1274388qtw.129.1705462207845; Tue, 16 Jan 2024 19:30:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705462207; cv=pass; d=google.com; s=arc-20160816; b=WM6qQz2xlg6r1HJN7p1S471tdAJnqKZTBMvNPjuW6TnYHlG1FR6uiERXTmNd2IRhkB SH9xLQ5CPuNV5U9xohLi7GWO+sURNli5yCw+zwRE5IFjTjZN52EmI//yvqIV1mcqkhyZ P+n4jqHoZ79z+AvgRqb+30UTIHSRsoMMBhTw+XXajgAD8a/DEaMlYvX6PasO98f0z1q0 XOU+BCGwkOEULcjDNI7YoRfBZVT6NdZoXHLdhByanZlwtlZdWmOevAvnK/gpe+7IJZg7 ZeTit/LXxNU9EunEiY+cHH08Jv//BCbQrmkBkJH0AekojgCBh1U9qZvRAeHjy8tQGkO7 PRGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=WTtWJpAG7fEXECtQexNbmTL7bUJERl6w8TJ5KXMhN6o=; fh=kodc3I6nw0bwAg58UUCvA1kViQoE0s8fDHGb3kZUBv4=; b=cT40onVaMWLLm4YBgASJwzcn55PanvUSqpPVsuvCrduCNGWY52nT5vuWavC2BRiw9i 9zMVUwEgt2jdwHBOG/I3MthNe+qEJK9YW+WeOw41SYZxp0n2EA1h1qwZ9QFvVBZvNS1F ydwaIgG6Eywa6uPqZFWMThsOvW7CEgjWMZHLsTiYt2eCPRfu8qQYkFmGPJ80xCdAEYUj LekhVR8IrE2TnA77dLs+giiNmCv8dYnobN6CiJLINp88RdYUU5J1VPGx9pbO+j/PaSmo Uhj03XDj5OLKjThOS9o4QRnbVLJI+mcOcAB+F965tk7zFR9AJUINlAOwzFeF+k3nGV2X 7ctQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ERpQhlbv; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id p9-20020a05622a048900b00429b3b3dc08si11179780qtx.742.2024.01.16.19.30.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 19:30:07 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ERpQhlbv; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8518C3858409 for ; Wed, 17 Jan 2024 03:30:07 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788306739739677243 X-GMAIL-MSGID: 1788306739739677243 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; +} +