[RISCV] Relax rules for ordering s/z/x prefixed extensions in ISA naming strings
authorAlex Bradbury <asb@igalia.com>
Tue, 27 Jun 2023 12:28:28 +0000 (13:28 +0100)
committerAlex Bradbury <asb@igalia.com>
Tue, 27 Jun 2023 12:32:11 +0000 (13:32 +0100)
commit6101d720cb499f5ad19293475b429828fa3dbd75
tree9b638e7bf42873f9c7148d028d719022cada758f
parentf8b8affc4a6a5df346b1c29b4b7bf4c46e70d3a1
[RISCV] Relax rules for ordering s/z/x prefixed extensions in ISA naming strings

This was discussed somewhat in D148315. As it stands, we require in
RISCVISAInfo::parseArchString (used for e.g. -march parsing in Clang)
that extensions are given in the order of z, then s, then x prefixed
extensions (after the standard single-letter extensions). However, we
recently (in D148315) moved to that order from z/x/s as the canonical
ordering was changed in the spec. In addition, recent GCC seems to
require z* extensions before s*.

My recollection of the history here is that we thought keeping -march as
close to the rules for ISA naming strings as possible would simplify
things, as there's an existing spec to point to. My feeling is that now
we've had incompatible changes, and an incompatibility with GCC there's
no real benefit to sticking to this restriction, and it risks making it
much more painful than it needs to be to copy a -march= string between
GCC and Clang.

This patch removes all ordering restrictions so you can freely mix x/s/z
extensions.

To be very explicit, this doesn't change our behaviour when emitting a
canonically ordered extension string (e.g. in build attributes). We of
course sort according to the canonical order (as we understand it) in
that case.

Differential Revision: https://reviews.llvm.org/D149246
clang/docs/ReleaseNotes.rst
clang/test/Driver/riscv-arch.c
llvm/docs/RISCVUsage.rst
llvm/lib/Support/RISCVISAInfo.cpp
llvm/unittests/Support/RISCVISAInfoTest.cpp