Code Size Reduction Deep Dive: Zc Extensions and Dictionary Compression Custom Instruction
summary
Zc splits the original C extension into subsets (zca, zcd, zcf) and adds compact encodings for prolog/epilog register saves and table-based jumps, implemented in Codasip’s processor description and LLVM toolchain. Push/pop cm.push/cm.pop compress 14 or 16 32-bit stores/loads down to 2 bytes, with memory semantics that reexecute the whole instruction on exception. Reused encodings yield small decoder changes (≈11–12 lines) and 0.5–2% savings; measured results show ~16% average and some >25% reductions, plus an extra ~3–15% from the instruction table (example: ~400 KB saved on a 3 MB binary).
AI-written summary · about
chapters (7)
- 0:00Introduction to ZC
- 0:56Overview of extensions
- 4:35Push, pop, and jump logic
- 8:32Performance results
- 11:10Dictionary compression
- 13:47Toolchain implementation
- 16:23Q&A session
related talks
23mCode Density Improvements Beyond The C Standard Extension
20mAnalysis for Code Size Opportunities in RISC V
34mCode Size Compiler Optimizations and Techniques for Embedded Systems
19mLoad/Store Pair for RV32 (Zilsd & Zclsd)
19mGCC Compiler Code Size Density
23mDeduBB: Binary Code Size Reduction via Post-Link Basic Block Deduplication
01h 25mRISC V Bit Manipulation ISA Extension Spec, Hardware, Software
38mOptimized String Processing in RISC-V: How Toolchain Improvements Can Boost Performance
