RISC-V: Handle combine extension in canonical ordering.
authorLiaoShihua <shihua@iscas.ac.cn>
Tue, 8 Mar 2022 03:30:51 +0000 (11:30 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Wed, 16 Mar 2022 13:11:45 +0000 (21:11 +0800)
commiteb4f83d1f100cae0cb66c6e6b4d67f5e53d3da51
tree5936fe82da0af0570083ab0c90550f5fd486f13d
parentf6fb661ea8ac7e17c6924719de6219f002c4efef
RISC-V: Handle combine extension in canonical ordering.

The crypto extension have several shorthand extensions that don't consist of any extra instructions.
Take zk for example, while the extension would imply zkn, zkr, zkt.
The 3 extensions should also combine back into zk to maintain the canonical order in isa strings.
This patch addresses the above.
And if the other extension has the same situation, you can add them in riscv_combine_info[]

gcc/ChangeLog:

* common/config/riscv/riscv-common.cc
(riscv_combine_info): New.
(riscv_subset_list::handle_combine_ext): Combine back into zk to
maintain the canonical order in isa strings.
(riscv_subset_list::parse): Ditto.
* config/riscv/riscv-subset.h (handle_combine_ext): New.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/predef-17.c: New test.
gcc/common/config/riscv/riscv-common.cc
gcc/config/riscv/riscv-subset.h
gcc/testsuite/gcc.target/riscv/predef-17.c [new file with mode: 0644]