[RISCV] Implement conditional Zca implies C extension rule (#172860)
This change implements the conditional "Zca implies C" rule to match
GCC's behavior (PR119122) and the RISC-V specification for MISA.C.
The rule is:
- For RV32:
- No F and no D: Zca alone implies C
- F but no D: Zca + Zcf implies C
- F and D: Zca + Zcf + Zcd implies C
- For RV64:
- No D: Zca alone implies C
- D: Zca + Zcd implies C
This fixes multilib matching issues where LLVM-generated march strings
didn't include the C extension when GCC's multilib configurations
expected it.
Reference:
- GCC PR119122: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119122
- RISC-V Zc spec:
https://github.com/riscv/riscv-isa-manual/blob/main/src/zc.adoc
Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>