This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add definitions for Xiangshan processors.
Needs ReviewPublic

Authored by SForeKeeper on Mar 27 2022, 11:56 PM.

Details

Summary

XiangShan is an open-source high-performance RISC-V processor project.

For more info, please consult:
Github Repo
Nanhu Architecture document (in Chinese, translation needed for now)

Diff Detail

Event Timeline

SForeKeeper created this revision.Mar 27 2022, 11:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2022, 11:56 PM
SForeKeeper requested review of this revision.Mar 27 2022, 11:56 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 27 2022, 11:56 PM
SForeKeeper edited the summary of this revision. (Show Details)Mar 27 2022, 11:59 PM
MaskRay added inline comments.Mar 28 2022, 12:29 AM
clang/test/CodeGen/RISCV/riscv-metadata.c
18

RUN lines in this file are unnecessary. mcpu=sifive-u74 is an arbitrary choice and provides the needed coverage. Don't add more CPUs here.

MaskRay added inline comments.Mar 28 2022, 12:30 AM
clang/test/Driver/riscv-cpus.c
146

So that any extra/missing target feature can be detected.

jrtc27 added inline comments.Mar 28 2022, 6:16 AM
llvm/include/llvm/Support/RISCVTargetParser.def
34

Formatting

35

Why imafd rather than g?

llvm/lib/Target/RISCV/RISCV.td
546

Isn't this still under development?

StephenFan added inline comments.Mar 29 2022, 5:53 AM
llvm/lib/Target/RISCV/RISCV.td
547

The document says that xiangshan-nanhu cpu support RV64IMAFDC_zba_zbb_zbc_zbs_zbkb_zbkc_zbkx_zknd_zkne_zknh_zksed_zksh_svinval . And it seems that svinval extension is not supported by llvm.

SForeKeeper added inline comments.Mar 29 2022, 11:13 PM
llvm/include/llvm/Support/RISCVTargetParser.def
35

The official document defines the default march as "RV64IMAFDC_zba_zbb_zbc_zbs_zbkb_zbkc_zbkx_zknd_zkne_zknh_zksed_zksh_svinval".

Using g is more sensible though.

llvm/lib/Target/RISCV/RISCV.td
546

Yes, though not taped out, the RTL design is "basically" frozen according to their developers.

547

The document says that xiangshan-nanhu cpu support RV64IMAFDC_zba_zbb_zbc_zbs_zbkb_zbkc_zbkx_zknd_zkne_zknh_zksed_zksh_svinval . And it seems that svinval extension is not supported by llvm.

547

Specifying Svinval here and in the RISCVTargetParser.def will require to implement it. (at least declaration is needed)
Since Svinval is still at a very early stage, I suppose it shouldn't be declared here now.