LLVM Git just picked up compiler targeting for Hygon's C86-4G processors, adding the c86-4g-m4, m6, and m7 targets alongside scheduler models and host CPU detection. It follows the same support landing in GCC 17, and it matters for anyone trying to squeeze tuned binaries out of these Chinese x86 chips that reportedly sit near Raptor Lake.
Compiler support is one of those things you never think about until you're staring at a server that runs your code at generic-x86 speeds because the toolchain has no idea what silicon it's sitting on. That gap just closed a little for Hygon's newest parts. On June 9, LLVM Git merged initial targeting for Hygon's C86-4G x86 CPUs, adding the c86-4g-m4, c86-4g-m6, and c86-4g-m7 targets ahead of the LLVM/Clang 23.1 release expected later this year.
This lands shortly after the same family picked up support in GCC 17, so both major open-source compilers now know how to emit and schedule code specifically for these chips rather than treating them as anonymous x86-64.

Who Hygon is, and why an x86 target shows up at all
Hygon exists because of a 2016 joint venture that licensed AMD's first-generation Zen design for the Chinese market. The early Dhyana parts were close enough to Zen 1 that Linux originally enabled them by reusing large chunks of the AMD code paths. The C86-4G generation is several steps removed from that starting point, and the fact that it now warrants its own dedicated CPU targets, rather than aliasing to an existing znver model, signals the microarchitecture has drifted far enough that the old shortcuts no longer describe it accurately.
That's the practical reason these commits matter. When a compiler aliases one CPU to another, you inherit the donor chip's instruction selection, scheduling assumptions, and cache tuning. If the real hardware has different execution port layouts or latency characteristics, you leave performance on the table and occasionally trip over instructions the chip doesn't actually implement.
What actually landed in the merge
The initial commit is broader than a single -march string. It covers the pieces that have to move together for a target to be genuinely usable:
- CPU target definitions for
c86-4g-m4,c86-4g-m6, andc86-4g-m7in both LLVM and Clang, so you can pass them to-march=and-mtune=. - Host CPU detection, meaning
-march=nativewill correctly identify these parts instead of falling back to a conservative baseline. - compiler-rt CPU model detection, which is what runtime feature dispatch and function multi-versioning rely on to pick the right code path on the running machine.
- Scheduler models for the Hygon architecture, the part that actually informs instruction scheduling and latency estimates during code generation.
- Optimizer test coverage, with Hygon added to the existing test suites so future changes don't silently regress the target.
The scheduler model is the piece worth caring about most. Target definitions get you correct and legal code; the scheduler model is what gets you fast code, because it tells the backend how long operations take and how to interleave them to keep execution units busy.
{{IMAGE:2}}
Performance context
The C86-4G parts have been reported to land roughly in the neighborhood of Intel Raptor Lake in general performance. That's a useful mental anchor: it puts them in modern desktop and entry-server territory rather than anything exotic. The honest caveat is that no first-pass compiler target ships fully tuned. Initial scheduler models tend to be approximations that get refined commit by commit as people profile real workloads, so the gap between a generic build and a -march=c86-4g-m6 build will likely widen in Hygon's favor over the next few release cycles as the model matures.
| Aspect | Before this merge | After this merge |
|---|---|---|
-march=native on C86-4G |
Falls back to a generic baseline | Detects the actual Hygon target |
| Instruction scheduling | Borrowed from a near-enough CPU | Dedicated Hygon scheduler model |
| Runtime feature dispatch | Generic CPU model | compiler-rt recognizes the part |
| Distro default builds | Unchanged | Unchanged until rebuilt with new targets |
Build recommendations
Nothing changes in shipped binaries until they're recompiled, so the upside is only available to people building from source or running a toolchain new enough to expose the targets.
If you have access to one of these machines, the path once Clang 23.1 ships is straightforward: build performance-sensitive code with -march=c86-4g-m6 (or the m4/m7 variant matching your part) and benchmark it against your current generic or znver-targeted binaries. For anything you distribute across mixed hardware, lean on function multi-versioning so the compiler-rt detection that just landed can select a Hygon-tuned path at runtime without breaking other CPUs. Until the official release, the targets are only in LLVM Git, so testing today means building the compiler yourself from the development branch.
For a homelab perspective, the broader takeaway is that x86 outside the AMD/Intel duopoly is slowly becoming a first-class citizen in the open-source toolchain instead of a special case held together by aliases. Whether or not these specific chips ever land on your bench, dedicated targets and scheduler models are exactly the kind of upstream work that turns an obscure CPU into something you can actually tune and measure.

Comments
Please log in or register to join the discussion