Page MenuHomePhabricator

[RISCV] Add CodeGen support of RISCV Zca Extension
Needs ReviewPublic

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
Herald added a project: Restricted Project. · View Herald TranscriptJul 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
174

||

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.Wed, Sep 21, 6:07 PM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
357

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

Don't repeat the || in two places.

357

Is there a test for this?

591

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.