Message ID | 20240124070103.3800874-1-quic_apinski@quicinc.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp817964dyi; Tue, 23 Jan 2024 23:01:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFt4CQoRjq7HOEUW1yzfN661tqcssD67bSzkjE9hIpctjI7YxqufDvw5N4WV+S9jiuGEQNs X-Received: by 2002:a05:6808:221a:b0:3bd:99a3:ef34 with SMTP id bd26-20020a056808221a00b003bd99a3ef34mr1456604oib.12.1706079719610; Tue, 23 Jan 2024 23:01:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706079719; cv=pass; d=google.com; s=arc-20160816; b=GUC+f5FsXtGw4MUqhjuoglZrRqOH1PggxtsVZXn48XmvNJY8WpknQrRqcgf49dW/nZ pq/5YhfXUSiLBhCkIiIVmug1/tt8oAk35H9bNtB6xGV3D6wshf2rmhM6GkzJgwo0kzon mUa3MnmHmj5UpNNC37vWFpR0FIdUs0OQB2JO+OTA6lhKeX3BU+9hUeaWl/nv6jXBXzUe xWgaF9GND7rRsYeNW4nUfWAq7M+GrKfJLz1rTh4rgew8OXbJ/bxL1/SKpqCzUCslP9tL a7bEwtiYd6GPwCKM+r/ZdvxAK0JFoLvMGZ0XLpm3vVdV8HaW8FXkU/xcqPiHOJXYvqLo Lwrg== 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=AxmbpwnS5yLJ8f5hZm8jKZiViwR9Pi1kBuIsYc8ytAE=; fh=o3CEdS3yGN/eIa89Zn0Kf01WYLxTE9IjKuSQGVPeOHI=; b=w33XMfg6obNLjuxA9xWcIusxGPupX72IsypC2XMC0rlH1vQjo/MrOTKsj54/PVp5Wd pFw5n99dLrl/givNkWHZwHasxuKwKubSAlPRCffCdTXysBq+qjV8Iz9TRCsIdG1gH5q6 qKUFB6lEEo9gcXkU8Ub2na6v8AsgL9kngMe/byfkgKG4xCCTg6E2uR/hAqUocnf7VShW 4/euIaI1Hg7hvGZsbkUP+qHjIF/wo87lIDHiAxfQb6BM0dhQ1VYaXDgLJqJhSgaDgDEr 9CSMEGocMyRnIpD5lg+rFX+JHcdkIH+Ci3SzPsKXhEFZJLOVRBK4TRiZWvVmnQJxCRAX Xg7Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hoj+5cLk; 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 l16-20020a05622a051000b0042a0c937975si9998826qtx.545.2024.01.23.23.01.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 23:01:59 -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=hoj+5cLk; 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 4AE4538582B0 for <ouuuleilei@gmail.com>; Wed, 24 Jan 2024 07:01:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 5B3453858D37 for <gcc-patches@gcc.gnu.org>; Wed, 24 Jan 2024 07:01:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5B3453858D37 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 5B3453858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706079679; cv=none; b=hAWmJiQhUxwB88fk3z5q5I2+G7nqjkeohKI8grdNxWcgNXhKzvpJJdZFArMYwpKam2zmDw8HlzHL1YYt4h/GA0/PZCeKF/szMFA6pHLo4IWGydqkdJByKwED71XUu3oIBGOilbCjkjYQasRJmlB0hatdESz5u89CaLs2oeZY5gg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706079679; c=relaxed/simple; bh=xHR3DGYJstbgkyulc2MaqfCnjjK8zeMlTHLlcj1gORY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RWLCY13MnMmwDi1CI1siMZlt84y2YJNrcZa2JJnKuxHg47F8OIBO7FkTSGee3swdOKkliwB+zQsnN5Msl6Po7qm6YnigpadrNnWkMHaQw2IPg5r0LN4+hQ3GTvavPaNqCi1zxKtVNQFQOR708VfkH8yxAWtEFHNnBai2fCPSOsY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O4jQth016839 for <gcc-patches@gcc.gnu.org>; Wed, 24 Jan 2024 07:01:17 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=Axmbpwn S5yLJ8f5hZm8jKZiViwR9Pi1kBuIsYc8ytAE=; b=hoj+5cLkw5UU2vNdnHNQQ9G 2Jtthq3r7PkpSC6hG+iiHmwjqoLWweQrDL4k/6zMbhK1P+qojH/HZZBmkHsNVRVy XZuRf1hq04D2t1wI30CjSwpSNnJAeM1G0Xa4DUzHzfYySBA4bRnAErSTW/GTzRKJ 2O5Natv9WJnz0Kq6VaYzolrt3L79aWgpBXaXqzubNkMmEuMTwdvYE5n3cXnoq6pU X14KJvN835SAH/nXBF0h3YV2w0GGSXv+nW6W+YDrzOJQoPN/Dh8cvFsx2KejOSx2 oAICSBe+rEGrKX00EfnpfWglECFZOwMQO0/jU2Foy6J/tj77InWWJuqFUe1DXaw= = Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vtmhr10yj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Wed, 24 Jan 2024 07:01:16 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40O71FWl013701 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Wed, 24 Jan 2024 07:01:15 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, 23 Jan 2024 23:01:15 -0800 From: Andrew Pinski <quic_apinski@quicinc.com> To: <gcc-patches@gcc.gnu.org> CC: Andrew Pinski <quic_apinski@quicinc.com> Subject: [PATCH] aarch64: Fix movv8di for overlapping register and memory load [PR113550] Date: Tue, 23 Jan 2024 23:01:03 -0800 Message-ID: <20240124070103.3800874-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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: 5Q83j8r3Tw3ASNkan_ziBnPMltPdh2WX X-Proofpoint-GUID: 5Q83j8r3Tw3ASNkan_ziBnPMltPdh2WX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-24_02,2024-01-23_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 mlxlogscore=802 mlxscore=0 bulkscore=0 phishscore=0 malwarescore=0 adultscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401240050 X-Spam-Status: No, score=-13.2 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788954248073108891 X-GMAIL-MSGID: 1788954248073108891 |
Series |
aarch64: Fix movv8di for overlapping register and memory load [PR113550]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Andrew Pinski (QUIC)
Jan. 24, 2024, 7:01 a.m. UTC
The split for movv8di is not ready to handle the case where the setting
register overlaps with the address of the memory that is being load.
Fixing the split than just making the output constraint as an early clobber
for this alternative. The split would first need to figure out which register
is overlapping with the address and then only emit that move last.
Build and tested for aarch64-linux-gnu with no regressions
gcc/ChangeLog:
* config/aarch64/aarch64-simd.md (*aarch64_movv8di): Mark the last
alternative's output constraint as an early clobber.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
gcc/config/aarch64/aarch64-simd.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Andrew Pinski <quic_apinski@quicinc.com> writes: > The split for movv8di is not ready to handle the case where the setting > register overlaps with the address of the memory that is being load. > Fixing the split than just making the output constraint as an early clobber > for this alternative. The split would first need to figure out which register > is overlapping with the address and then only emit that move last. I was curious how strained that detection would be in practice, and in the end it didn't seem too bad. I pushed the following variant after testing on aarch64-linux-gnu. Thanks, Richard The LS64 movv8di pattern didn't handle loads that overlapped with the address register (unless the overlap happened to be in the last subload). gcc/ PR target/113550 * config/aarch64/aarch64-simd.md: In the movv8di splitter, check whether each split instruction is a load that clobbers the source address. Emit that instruction last if so. gcc/testsuite/ PR target/113550 * gcc.target/aarch64/pr113550.c: New test. --- gcc/config/aarch64/aarch64-simd.md | 18 ++++++-- gcc/testsuite/gcc.target/aarch64/pr113550.c | 48 +++++++++++++++++++++ 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr113550.c diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 48f0741e7d0..f036f6ce997 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -8221,11 +8221,21 @@ (define_split || (memory_operand (operands[0], V8DImode) && register_operand (operands[1], V8DImode))) { + std::pair<rtx, rtx> last_pair = {}; for (int offset = 0; offset < 64; offset += 16) - emit_move_insn (simplify_gen_subreg (TImode, operands[0], - V8DImode, offset), - simplify_gen_subreg (TImode, operands[1], - V8DImode, offset)); + { + std::pair<rtx, rtx> pair = { + simplify_gen_subreg (TImode, operands[0], V8DImode, offset), + simplify_gen_subreg (TImode, operands[1], V8DImode, offset) + }; + if (register_operand (pair.first, TImode) + && reg_overlap_mentioned_p (pair.first, pair.second)) + last_pair = pair; + else + emit_move_insn (pair.first, pair.second); + } + if (last_pair.first) + emit_move_insn (last_pair.first, last_pair.second); DONE; } else diff --git a/gcc/testsuite/gcc.target/aarch64/pr113550.c b/gcc/testsuite/gcc.target/aarch64/pr113550.c new file mode 100644 index 00000000000..0ff3c7b5c00 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr113550.c @@ -0,0 +1,48 @@ +/* { dg-options "-O" } */ +/* { dg-do run } */ + +#pragma GCC push_options +#pragma GCC target "+ls64" +#pragma GCC aarch64 "arm_acle.h" +#pragma GCC pop_options + +#define DEF_FUNCTION(NAME, ARGS) \ + __attribute__((noipa)) \ + __arm_data512_t \ + NAME ARGS \ + { \ + return *ptr; \ + } + +DEF_FUNCTION (f0, (__arm_data512_t *ptr)) +DEF_FUNCTION (f1, (int x0, __arm_data512_t *ptr)) +DEF_FUNCTION (f2, (int x0, int x1, __arm_data512_t *ptr)) +DEF_FUNCTION (f3, (int x0, int x1, int x2, __arm_data512_t *ptr)) +DEF_FUNCTION (f4, (int x0, int x1, int x2, int x3, __arm_data512_t *ptr)) +DEF_FUNCTION (f5, (int x0, int x1, int x2, int x3, int x4, + __arm_data512_t *ptr)) +DEF_FUNCTION (f6, (int x0, int x1, int x2, int x3, int x4, int x5, + __arm_data512_t *ptr)) +DEF_FUNCTION (f7, (int x0, int x1, int x2, int x3, int x4, int x5, int x6, + __arm_data512_t *ptr)) + +int +main (void) +{ + __arm_data512_t x = { 0, 10, 20, 30, 40, 50, 60, 70 }; + __arm_data512_t res[8] = + { + f0 (&x), + f1 (0, &x), + f2 (0, 1, &x), + f3 (0, 1, 2, &x), + f4 (0, 1, 2, 3, &x), + f5 (0, 1, 2, 3, 4, &x), + f6 (0, 1, 2, 3, 4, 5, &x), + f7 (0, 1, 2, 3, 4, 5, 6, &x) + }; + for (int i = 0; i < 8; ++i) + if (__builtin_memcmp (&x, &res[i], sizeof (x)) != 0) + __builtin_abort (); + return 0; +}
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 662ef696630..ba079298b84 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -7985,7 +7985,7 @@ (define_insn "*aarch64_mov<mode>" ) (define_insn "*aarch64_movv8di" - [(set (match_operand:V8DI 0 "nonimmediate_operand" "=r,m,r") + [(set (match_operand:V8DI 0 "nonimmediate_operand" "=r,m,&r") (match_operand:V8DI 1 "general_operand" " r,r,m"))] "(register_operand (operands[0], V8DImode) || register_operand (operands[1], V8DImode))"