This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add CodeGen support and MC testcase of RISCV Zca Extension
ClosedPublic

Authored by VincentWu on Jul 25 2022, 6:54 AM.

Details

Summary

This patch add the support of RISCV Zca ext

Zca is a subset of C extension instructions that are compatible with the Zc extension.

So this patch implements Zca code generation with reference to the C extension and sets the 2-byte alignment for the Zca extension, just like C extension does.

Diff Detail

Event Timeline

VincentWu created this revision.Jul 25 2022, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2022, 6:54 AM
VincentWu requested review of this revision.Jul 25 2022, 6:54 AM
craig.topper added inline comments.Aug 1 2022, 8:57 AM
llvm/lib/Object/ELFObjectFile.cpp
343 ↗(On Diff #447310)

Why do we need this? Should we make C + Zca be an error in RISCVISAInfo.cpp?

There's a check for FeatureStdExtC in RISCVMatInt.cpp does that need to be updated?

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp
24

Did this come from clang-format?

llvm/lib/Target/RISCV/RISCVSubtarget.h
172

||

llvm/test/MC/RISCV/rv32zca-aliases-valid.s
1 ↗(On Diff #447310)

Can we add these command lines to rv32c-aliases-valid instead?

VincentWu updated this revision to Diff 454809.Aug 23 2022, 6:01 AM
VincentWu marked 4 inline comments as done.

address comments

VincentWu updated this revision to Diff 454812.Aug 23 2022, 6:05 AM

delete changes

VincentWu updated this revision to Diff 454814.Aug 23 2022, 6:10 AM

merge testcase

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp
24

yep

craig.topper added inline comments.Sep 21 2022, 6:07 PM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
356–357

bool UseCompressedNop = STI->getFeatureBits()[RISCV::FeatureStdExtC] || STI->getFeatureBits()[RISCV::FeatureExtZca]

Don't repeat the || in two places.

356–357

Is there a test for this?

598–599

Same comment as above.

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCObjectFileInfo.cpp
21

Is there a test for this?

llvm/test/MC/RISCV/rv32c-aliases-valid.s
1

If you're changing an MC layer test, then your title is incorrect. This isn't just CodeGen support.

VincentWu updated this revision to Diff 463159.Sep 27 2022, 2:44 AM
VincentWu marked 5 inline comments as done.
VincentWu retitled this revision from [RISCV] Add CodeGen support of RISCV Zca Extension to [RISCV] Add CodeGen support and MC testcase of RISCV Zca Extension.

address comments

VincentWu updated this revision to Diff 463192.Sep 27 2022, 5:09 AM

fix testcase

This revision is now accepted and ready to land.Nov 16 2022, 4:01 PM
VincentWu updated this revision to Diff 476789.Nov 20 2022, 7:24 PM

rebase & ready to be landed

This revision was landed with ongoing or failed builds.Nov 22 2022, 1:22 AM
This revision was automatically updated to reflect the committed changes.