[RISCV] Fix canonical ordering of s* vs z* extensions in RISCVISAInfo
authorAlex Bradbury <asb@igalia.com>
Wed, 19 Apr 2023 06:03:57 +0000 (07:03 +0100)
committerAlex Bradbury <asb@igalia.com>
Wed, 19 Apr 2023 06:04:48 +0000 (07:04 +0100)
commitc8318b973ad0414a068f4b5025a896d912554a11
treef594f094485336966f01b4d75d39558cce2fdf7c
parenta91f44271b46e6580fa7263d13a39baf9e20aa0e
[RISCV] Fix canonical ordering of s* vs z* extensions in RISCVISAInfo

As noted in https://reviews.llvm.org/D148315, the ordering logic for
OrderedExtensionMap currently puts s* before z* extensions, but per the
ISA manual the correct order should be z* and then s* (with the
exception of zxm*, which are ordered after s*).

This patch fixes the ordering and adds a TODO for zxm*. The changes are
visible in the test case added in
a35e67fc5be654a7efdfa6125343b90f8960a487 which also demonstrates an
issue with the ordering of single letter extensions (which isn't
addressed in this patch).

This ordering matches the one used by GCC/binutils as well.

Differential Revision: https://reviews.llvm.org/D148615
llvm/lib/Support/RISCVISAInfo.cpp
llvm/unittests/Support/RISCVISAInfoTest.cpp