From patchwork Fri Oct 21 05:01:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Monk Chiang X-Patchwork-Id: 6510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp489263wrr; Thu, 20 Oct 2022 22:02:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qFp7nhW7fuLJnRXLAcZM0OTe1gm1o0t6VcPKQ2wJTpiiQDaTulIDl36mqTjfOQ47viauy X-Received: by 2002:a17:906:fe45:b0:788:15a5:7495 with SMTP id wz5-20020a170906fe4500b0078815a57495mr14070752ejb.633.1666328568168; Thu, 20 Oct 2022 22:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666328568; cv=none; d=google.com; s=arc-20160816; b=vHBCjYGKZnyE+Lhk6JnlCwgXZCLp9NKmrvjv8cQPDnBUfSC2/EKiuS3lhkf6k1xv2u cM93RRo9he1DqWLIyM/Pr0PbkR+j/VluXb5iPdyohIVKKoOhiWc8z5gX4xKA/Gz+2EHk 0BWPXtVdWqa30UY8+t9R3TmAvKsx6cl5hsAqPRhUua57drxG+cDjAVdPxl4FODhb4T7k frmFnF/6wMJj0Q9FctYzQ5MlFmqwGPTI/a5w/xbk5HnnvGHKVM+AYAj/cNJCjDhU7LKe trdvjsaYknvCbW5XtOyOdw+3yVLmkxDpU/hHQUo4RC6MXi8zYFAetUr62lft9jaf2YBe A2LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :dmarc-filter:delivered-to; bh=varQbqtx3nI8wJMKPLlejRRPlKDAheYD8gOku0XkeT8=; b=FQFMu7HDbi30KOZ+k88FIul68y4yuO5iA7ME30qzaZD7owlXOnIp5VWg77RiobZ3zz sYnwG7WFOORe6fSdFXkSwwDeCM1Jq5IBCzFp84lFviwHdGzQwzEREs9eGzYmEgXe3WvQ udv70C7paI/eemk8qPM5+R256d0Ehljjqau2xj/1izuOJueApy5kcDU8MbKmNuXyMX4m lhkFy1sSBYJnzMUPrwKpqt138IHUxsPh3H4Z/wmEUMQPkmn8IDnMfeT5LdWbaiI3J66p CF/xJ7GCkq0hyRX1PrQ/wG+93taAhUU24ZE0kvrsFeyhvy3uImv8PGf9Vv4QL6KSuttQ cHcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=ZcynbgL7; 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" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id eb10-20020a0564020d0a00b0044ecd80f257si21028291edb.603.2022.10.20.22.02.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 22:02:48 -0700 (PDT) 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=@sifive.com header.s=google header.b=ZcynbgL7; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C3DFA385AE4F for ; Fri, 21 Oct 2022 05:02:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 5BF5A3858D39 for ; Fri, 21 Oct 2022 05:02:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5BF5A3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-x636.google.com with SMTP id f9so1296780plb.13 for ; Thu, 20 Oct 2022 22:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=varQbqtx3nI8wJMKPLlejRRPlKDAheYD8gOku0XkeT8=; b=ZcynbgL7fWeJVxXi+QDg9JbXHGq1a0g3PHygnWPg7oADyuHdvjHwGNR575HQJrypEU +p8WBvb1Uw/Aw4So/ZFYNQNZ8qu0iuinSFJ3jhPIkpwRrfRKesSV9Y00PmhOrGahn34L UdCCtJFm+/BiDdDcEEq+BgbJhvrEGnZOgnfmUJtE0QLVYgyIMD229gY9tX9sKDjOTA2H W76UYEwDElsCIuzqrznhXfE0WicaetedqGoggsmrhUEOEGewVutnnZK4wfVMhD0Qts4S D6hiUpT1TrAsu53P5oEgowIZrq4PWSaobZyM+3n5rtg+Q2cJtPRL34UQuhV98SpNXcOx +zHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=varQbqtx3nI8wJMKPLlejRRPlKDAheYD8gOku0XkeT8=; b=xTWsiyfvZTjxXYJB+GrBpgITCS83DAHeqdPz3StrTkXre7wPLeJmYiFvrjwX0uzGXJ n1rEWNjgnjQuyMHhgTUPkFLWF0n2hyOW546FaDERU7WqAK5HvscghroNPtop+NOP/xW/ M9bFqoZDa1IQtJU11lMotA9z0u/xQ2Ep+iV2fb/ovwlMI3vgnJNMmAzd85eh5i96f7BM f1pevyZhqYDeMJRrM3+kZ0yD1w/nH6yZbhFB6djeSeSaTtQCKfBe6vHOdtmFsLLtqRLR zvbNOk8WJr0B5adUuQActLlk77S3qMxyoCKEScro8n4u62QCTNSZaRykSHOMwjHIRpS5 KVjQ== X-Gm-Message-State: ACrzQf1TxVXVwavhBwXHEfZN1dkSxxTqTHG/4ZOMXke2rt/41B5/M6ZT xl1dO+CCmNZ3Y6qHclEziPBtq1kt8cDLp01N8AvEL/uDqCtOQtrjY539JF/5GpbSpnv3XzuGegz 6xIO58dhzfvXqD1huNVJM5XD7oftTv7/Nd9OYDWSdcjwKQPW7BimY3PsypxA0L4NSqcX974qX57 Q= X-Received: by 2002:a17:902:d506:b0:184:987e:3cf2 with SMTP id b6-20020a170902d50600b00184987e3cf2mr17141471plg.67.1666328536030; Thu, 20 Oct 2022 22:02:16 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id a24-20020aa795b8000000b005627b3788b8sm14129833pfk.181.2022.10.20.22.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 22:02:15 -0700 (PDT) From: Monk Chiang To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com Subject: [PATCH] RISC-V: Add type attribute for atomic instructions. Date: Fri, 21 Oct 2022 13:01:59 +0800 Message-Id: <20221021050159.121335-1-monk.chiang@sifive.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: , Cc: Monk Chiang 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?1747272144512276454?= X-GMAIL-MSGID: =?utf-8?q?1747272144512276454?= gcc/ChangeLog: * config/riscv/riscv.md: Add atomic type attribute. * config/riscv/sync.md: Add atomic type for atomic instructions. --- gcc/config/riscv/riscv.md | 2 +- gcc/config/riscv/sync.md | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index b3654915fde..9384ced0447 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -317,7 +317,7 @@ "unknown,branch,jump,call,load,fpload,store,fpstore, mtc,mfc,const,arith,logical,shift,slt,imul,idiv,move,fmove,fadd,fmul, fmadd,fdiv,fcmp,fcvt,fsqrt,multi,auipc,sfb_alu,nop,ghost,bitmanip,rotate, - rdvlenb,rdvl,vsetvl,vlde,vste,vldm,vstm,vlds,vsts, + atomic,rdvlenb,rdvl,vsetvl,vlde,vste,vldm,vstm,vlds,vsts, vldux,vldox,vstux,vstox,vldff,vldr,vstr, vialu,viwalu,vext,vicalu,vshift,vnshift,vicmp, vimul,vidiv,viwmul,vimuladd,viwmuladd,vimerge,vimov, diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index 7deb290d9dc..449f275e6a2 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -62,7 +62,8 @@ UNSPEC_ATOMIC_STORE))] "TARGET_ATOMIC" "%F2amoswap.%A2 zero,%z1,%0" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "atomic") + (set (attr "length") (const_int 8))]) (define_insn "atomic_" [(set (match_operand:GPR 0 "memory_operand" "+A") @@ -73,7 +74,8 @@ UNSPEC_SYNC_OLD_OP))] "TARGET_ATOMIC" "%F2amo.%A2 zero,%z1,%0" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "atomic") + (set (attr "length") (const_int 8))]) (define_insn "atomic_fetch_" [(set (match_operand:GPR 0 "register_operand" "=&r") @@ -86,7 +88,8 @@ UNSPEC_SYNC_OLD_OP))] "TARGET_ATOMIC" "%F3amo.%A3 %0,%z2,%1" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "atomic") + (set (attr "length") (const_int 8))]) (define_insn "atomic_exchange" [(set (match_operand:GPR 0 "register_operand" "=&r") @@ -98,7 +101,8 @@ (match_operand:GPR 2 "register_operand" "0"))] "TARGET_ATOMIC" "%F3amoswap.%A3 %0,%z2,%1" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "atomic") + (set (attr "length") (const_int 8))]) (define_insn "atomic_cas_value_strong" [(set (match_operand:GPR 0 "register_operand" "=&r") @@ -112,7 +116,8 @@ (clobber (match_scratch:GPR 6 "=&r"))] "TARGET_ATOMIC" "%F5 1: lr.%A5 %0,%1; bne %0,%z2,1f; sc.%A4 %6,%z3,%1; bnez %6,1b; 1:" - [(set (attr "length") (const_int 20))]) + [(set_attr "type" "atomic") + (set (attr "length") (const_int 20))]) (define_expand "atomic_compare_and_swap" [(match_operand:SI 0 "register_operand" "") ;; bool output