public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson@rivosinc.com>
To: Xiao Zeng <zengxiao@eswincomputing.com>
Cc: palmer <palmer@dabbelt.com>, binutils <binutils@sourceware.org>
Subject: Re: Re: [PING^2][PATCH v2] RISC-V: Imply 'Zicntr' and 'Zihpm' implicitly depended on 'Zicsr'
Date: Fri, 15 Dec 2023 11:06:58 +0800	[thread overview]
Message-ID: <CAPpQWtC92nkatOCh7prj7Q9ED-=34_RSrYpTBAukp199qAYGiQ@mail.gmail.com> (raw)
In-Reply-To: <2023121510234364687812@eswincomputing.com>

[-- Attachment #1: Type: text/plain, Size: 6034 bytes --]

"Depend on" means "imply", this should be clarified in,
https://github.com/riscv/riscv-v-spec/pull/845.  So your understanding is
correct, if the rule doesn't change.

Nelson

On Fri, Dec 15, 2023 at 10:23 AM Xiao Zeng <zengxiao@eswincomputing.com>
wrote:

> 2023-12-15 10:02  Palmer Dabbelt <palmer@dabbelt.com> wrote:
> >
>
> >On Thu, 14 Dec 2023 17:57:09 PST (-0800), zengxiao@eswincomputing.com
> wrote:
> >> This commit adds support for ratified extensions:
> >> 'Zicntr' and 'Zihpm', Which are all implicitly depend on 'Zicsr'.
> >>
> >> This is based on:
> >> <
> https://github.com/riscv/riscv-isa-manual/releases/download/riscv-isa-release-056b6ff-2023-10-02/unpriv-isa-asciidoc.pdf
> >
> >
> >As far as I can tell the ISA doesn't actually provide that dependency,
> Perhaps it was my mistake, but I clearly saw the following statement in
> the spec:
> <
> https://github.com/riscv/riscv-isa-manual/blob/86b685a624110cf717f75cfaf5afb412b69f7f4e/src/counters.adoc#L15
> >
> "The Zicntr extension depends on the Zicsr ext" and "The Zihpm extension
> depends on the Zicsr extension. "
>
> >but Zicntr and Zihpm are pretty much useless without the CSRs.
> After reading the above spec, I understand that Zicntr and Zihpm
> respectively focus on a certain type of csr register in Zicsr. More
> specifically, the former focuses on "Base Counters and Timers ",
> while the latter focuses on "hardware performance counters ".
>
> >So I think this is fine to just assume, there's way bigger messes with the
> >whole counter/CSR retrofit.
> Of course, what I have said above is my own understanding and there
> may be errors.
>
> >
> >So
> >
> >Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
> >
> >Thanks!
> >
> >>
> >> bfd/ChangeLog:
> >>
> >> * elfxx-riscv.c:  Add 'Zicntr' and 'Zihpm' -> 'Zicsr'.
> >>         (riscv_supported_std_z_ext) Add 'Zicntr' and 'Zihpm' to the
> list.
> >>
> >> gas/ChangeLog:
> >>
> >> * testsuite/gas/riscv/attribute-15.d: New test.
> >> * testsuite/gas/riscv/attribute-15.s: New test.
> >> * testsuite/gas/riscv/attribute-16.d: New test.
> >> * testsuite/gas/riscv/attribute-16.s: New test.
> >> ---
> >>  bfd/elfxx-riscv.c                      | 4 ++++
> >>  gas/testsuite/gas/riscv/attribute-15.d | 6 ++++++
> >>  gas/testsuite/gas/riscv/attribute-15.s | 1 +
> >>  gas/testsuite/gas/riscv/attribute-16.d | 6 ++++++
> >>  gas/testsuite/gas/riscv/attribute-16.s | 1 +
> >>  5 files changed, 18 insertions(+)
> >>  create mode 100644 gas/testsuite/gas/riscv/attribute-15.d
> >>  create mode 100644 gas/testsuite/gas/riscv/attribute-15.s
> >>  create mode 100644 gas/testsuite/gas/riscv/attribute-16.d
> >>  create mode 100644 gas/testsuite/gas/riscv/attribute-16.s
> >>
> >> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> >> index 567631e7d96..4c91081acd1 100644
> >> --- a/bfd/elfxx-riscv.c
> >> +++ b/bfd/elfxx-riscv.c
> >> @@ -1144,6 +1144,8 @@ static struct riscv_implicit_subset
> riscv_implicit_subsets[] =
> >>    {"zvl256b", "zvl128b",    check_implicit_always},
> >>    {"zvl128b", "zvl64b",     check_implicit_always},
> >>    {"zvl64b", "zvl32b",      check_implicit_always},
> >> +  {"zicntr", "zicsr",       check_implicit_always},
> >> +  {"zihpm", "zicsr",        check_implicit_always},
> >>    {"zcd", "d",      check_implicit_always},
> >>    {"zcf", "f",      check_implicit_always},
> >>    {"zfa", "f",      check_implicit_always},
> >> @@ -1260,12 +1262,14 @@ static struct riscv_supported_ext
> riscv_supported_std_z_ext[] =
> >>    {"zicbop",        ISA_SPEC_CLASS_DRAFT,   1, 0,  0 },
> >>    {"zicboz",        ISA_SPEC_CLASS_DRAFT,   1, 0,  0 },
> >>    {"zicond",        ISA_SPEC_CLASS_DRAFT,   1, 0,  0 },
> >> +  {"zicntr",        ISA_SPEC_CLASS_DRAFT,   2, 0,  0 },
> >>    {"zicsr", ISA_SPEC_CLASS_20191213,        2, 0,  0 },
> >>    {"zicsr", ISA_SPEC_CLASS_20190608,        2, 0,  0 },
> >>    {"zifencei",      ISA_SPEC_CLASS_20191213,        2, 0,  0 },
> >>    {"zifencei",      ISA_SPEC_CLASS_20190608,        2, 0,  0 },
> >>    {"zihintntl",     ISA_SPEC_CLASS_DRAFT,   1, 0,  0 },
> >>    {"zihintpause",   ISA_SPEC_CLASS_DRAFT,   2, 0,  0 },
> >> +  {"zihpm", ISA_SPEC_CLASS_DRAFT,   2, 0,  0 },
> >>    {"zmmul", ISA_SPEC_CLASS_DRAFT,   1, 0,  0 },
> >>    {"zawrs", ISA_SPEC_CLASS_DRAFT,   1, 0,  0 },
> >>    {"zfa",   ISA_SPEC_CLASS_DRAFT,   1, 0,  0 },
> >> diff --git a/gas/testsuite/gas/riscv/attribute-15.d
> b/gas/testsuite/gas/riscv/attribute-15.d
> >> new file mode 100644
> >> index 00000000000..a17e82c8508
> >> --- /dev/null
> >> +++ b/gas/testsuite/gas/riscv/attribute-15.d
> >> @@ -0,0 +1,6 @@
> >> +#as: -march-attr -misa-spec=20191213
> >> +#readelf: -A
> >> +#source: attribute-15.s
> >> +Attribute Section: riscv
> >> +File Attributes
> >> +  Tag_RISCV_arch: "rv32i2p1_zicntr2p0_zicsr2p0_zihpm2p0"
> >> diff --git a/gas/testsuite/gas/riscv/attribute-15.s
> b/gas/testsuite/gas/riscv/attribute-15.s
> >> new file mode 100644
> >> index 00000000000..ecb10a298fd
> >> --- /dev/null
> >> +++ b/gas/testsuite/gas/riscv/attribute-15.s
> >> @@ -0,0 +1 @@
> >> +    .attribute arch,"rv32i_zicntr_zihpm"
> >> diff --git a/gas/testsuite/gas/riscv/attribute-16.d
> b/gas/testsuite/gas/riscv/attribute-16.d
> >> new file mode 100644
> >> index 00000000000..6ca3b5351f8
> >> --- /dev/null
> >> +++ b/gas/testsuite/gas/riscv/attribute-16.d
> >> @@ -0,0 +1,6 @@
> >> +#as: -march-attr -misa-spec=20191213
> >> +#readelf: -A
> >> +#source: attribute-16.s
> >> +Attribute Section: riscv
> >> +File Attributes
> >> +  Tag_RISCV_arch: "rv64i2p1_zicntr2p0_zicsr2p0_zihpm2p0"
> >> diff --git a/gas/testsuite/gas/riscv/attribute-16.s
> b/gas/testsuite/gas/riscv/attribute-16.s
> >> new file mode 100644
> >> index 00000000000..8757bb5181b
> >> --- /dev/null
> >> +++ b/gas/testsuite/gas/riscv/attribute-16.s
> >> @@ -0,0 +1 @@
> >> +    .attribute arch,"rv64i_zicntr_zihpm"
>
> Thanks
> Xiao Zeng
>
>

  reply	other threads:[~2023-12-15  3:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  1:57 Xiao Zeng
2023-12-15  2:02 ` Palmer Dabbelt
2023-12-15  2:14   ` Nelson Chu
2023-12-15  2:34     ` Xiao Zeng
2023-12-15  2:23   ` Xiao Zeng
2023-12-15  3:06     ` Nelson Chu [this message]
2023-12-15  4:26       ` Xiao Zeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPpQWtC92nkatOCh7prj7Q9ED-=34_RSrYpTBAukp199qAYGiQ@mail.gmail.com' \
    --to=nelson@rivosinc.com \
    --cc=binutils@sourceware.org \
    --cc=palmer@dabbelt.com \
    --cc=zengxiao@eswincomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).