From patchwork Sun Sep 25 11:25:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1026547wrt; Sun, 25 Sep 2022 04:26:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75WYlSXQZ6gZDfPZ+d4blZJSrGn6+nd33J8NyXpRvAgkKlx+Gbz+HtwJCBtwTAU8JSK+Rw X-Received: by 2002:a05:6402:3408:b0:43c:2dd3:d86b with SMTP id k8-20020a056402340800b0043c2dd3d86bmr17507827edc.108.1664105196903; Sun, 25 Sep 2022 04:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664105196; cv=none; d=google.com; s=arc-20160816; b=sLUc8yTViQ4X8q+uIr5erenXhwS45+POaOfjnnZBBl6U/Gsc8E0XBcck98SYrn1Guu EJsDbWpKpNp7gRBD7QV5KzWtyV3ek1wjQoKgZmVTW2ySfWia53EFUky+dnc5fbCMLZ/u FUHCYIka7uu6XKiZhAn9feilIUQ6xeRcoH79GEIxxJi+VJDQlbOo8O6Xv17jT4mGsMNi j3oWjzjNhqR2PyhenIrX82ieVYZPAlfHYW7hrxwip2x3m9rG+ByuhxmR0aDtUEZYfxKs eUg3qYKaNwVopFR6jRD7MlrI9yvGCAJJGMGe41bDImhQc26uIZGEtsd1LvG9jGsMEbj+ vj+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=F2USACIsfU+NCjCMORgW+J6bjn3MOCpSPIQQb1ykvFo=; b=f1ql0oeacAddoweiAUs9rc7wdy86p9SXjUt5B432mxZ4s3VGzfqFZi4hG48+NLVTve 7xsQ+YonjUCHf9Xj2odxIjopyYm+VJSADpSo0cWuaABqefvGlkJKo2yk1EG50c1c1GMc uZCFB2nXv+Su+rFev2WpkcQtkd+vqK1LbuArpiAO5SbJw5mQrxO2SuBcCay3LfrSaiMd tQACzCvsb8ESHuruTIbjH7ynt8Aog+2zzABym9UUMwl/mLAwvI5oLuS+wNxTjpraUUdi QdbLS21A1vISqvW5c3jZKtx8Hx2sV42jXXPUZUlxH0E/oZ15Ha1PQbkMf20YDDs+1Mei uL3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wtoXhrUE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ho8-20020a1709070e8800b007800b1f8d98si3325756ejc.452.2022.09.25.04.26.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 04:26:36 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wtoXhrUE; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B720D3854172 for ; Sun, 25 Sep 2022 11:26:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B720D3854172 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664105195; bh=F2USACIsfU+NCjCMORgW+J6bjn3MOCpSPIQQb1ykvFo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=wtoXhrUEoprdUBOVCbq+O/hxwEgl67wwPC/MReYHN4Khv1M9jTEJJCLWXVhweNps7 U6yHVFnVhKRux+a+bBE6oINd16h/NdheenqdNeDtzErQiELSxw93kb0MwsD7R9ojHb W6akHFiPgJZw3F0CgeYpWmnvXAZM/Bokhk2skIWI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 74C363857B9D for ; Sun, 25 Sep 2022 11:25:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74C363857B9D Received: from xry111-x57s1.. (unknown [IPv6:240e:358:1175:c300:dc73:854d:832e:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 31C4D6683D; Sun, 25 Sep 2022 07:25:46 -0400 (EDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] LoongArch: Add prefetch instruction Date: Sun, 25 Sep 2022 19:25:37 +0800 Message-Id: <20220925112537.2209847-1-xry111@xry111.site> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP, GIT_PATCH_0, LIKELY_SPAM_FROM, SPF_HELO_PASS, SPF_PASS, TXREP, T_PDS_OTHER_BAD_TLD 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xi Ruoyao via Gcc-patches From: Xi Ruoyao Reply-To: Xi Ruoyao Cc: Chenghua Xu , Lulu Cheng , Wang Xuerui Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744940770908823920?= X-GMAIL-MSGID: =?utf-8?q?1744940770908823920?= The test pr106397.c fails on LoongArch because we don't have defined prefetch instruction. We can silence the test for LoongArch, but it's not too difficult to add the prefetch instruction so add it now. -- >8 -- gcc/ChangeLog: * config/loongarch/constraints.md (ZD): New address constraint. * config/loongarch/loongarch.md (prefetch): New insn. --- gcc/config/loongarch/constraints.md | 6 ++++++ gcc/config/loongarch/loongarch.md | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gcc/config/loongarch/constraints.md b/gcc/config/loongarch/constraints.md index 43cb7b5f0f5..93da5970958 100644 --- a/gcc/config/loongarch/constraints.md +++ b/gcc/config/loongarch/constraints.md @@ -190,3 +190,9 @@ (define_memory_constraint "ZB" The offset is zero" (and (match_code "mem") (match_test "REG_P (XEXP (op, 0))"))) + +(define_address_constraint "ZD" + "An address operand whose address is formed by a base register and offset + that is suitable for use in instructions with the same addressing mode + as @code{preld}." + (match_test "loongarch_12bit_offset_address_p (op, mode)")) diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index 214b14bddd3..84c1bd1c0d6 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -2137,6 +2137,20 @@ (define_insn "loongarch_dbar" "" "dbar\t%0") +(define_insn "prefetch" + [(prefetch (match_operand 0 "address_operand" "ZD") + (match_operand 1 "const_uimm5_operand" "i") + (match_operand 2 "const_int_operand" "n"))] + "" +{ + switch (INTVAL (operands[1])) + { + case 0: return "preld\t0,%a0"; + case 1: return "preld\t8,%a0"; + default: gcc_unreachable (); + } +}) + ;; Privileged state instruction