RISC-V: Fix -march option parsing when extension exists.
authorXing GUO <higuoxing@gmail.com>
Thu, 28 Jan 2021 03:22:40 +0000 (11:22 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Thu, 28 Jan 2021 03:25:50 +0000 (11:25 +0800)
commitf76d0d86454baf99ada0748c73a29816854e1b91
tree775eb7c49464a5046fbcf3c71f73c1646835dcfc
parentaa69f0a8203095b5a689fae48d5ca8006ecfca61
RISC-V: Fix -march option parsing when  extension exists.

This patch fixes -march option parsing when `p` extension exists,
e.g., -march=rv64imafdcp should produce

.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_p"

rather than

.attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c_p"

gcc/ChangeLog:

* common/config/riscv/riscv-common.c
(riscv_subset_list::parsing_subset_version): Fix -march option parsing
when `p` extension exists.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/attribute-18.c: New test.
gcc/common/config/riscv/riscv-common.c
gcc/testsuite/gcc.target/riscv/attribute-18.c [new file with mode: 0644]