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 actually removes all ordering restrictions so you can freely mix x/s/z extensions. Arguably this is more freedom than we want to allow, on the other hand it might be less hassle for build systems assembling their arch strings.
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.