The GNU project has announced that its GNU Compiler Collection (GCC) version 12.1 now supports Loongson’s proprietary LoongArch microarchitecture. The addition of LoongArch support to a popular set of compilers will enable software developers to better address systems based on the latest processors from Loongson.
“Support for the LoongArch architecture instruction set has been added,” release notes for the new GCC read. “The Loongson CPU codename LA464 and LoongArch 64-bit generic CPU codename loongarch64 are supported through the -march= and -mtune= options (GCC identifiers in parentheses).”
It is unclear whether the new compiler collection supports all ~2,000 new instructions introduced by the LoongArch architecture, but hopefully it supports those that bring the most significant performance improvements.
For many years Loongson’s processors used various kinds of its developer’s LoongISA architecture, which in turn was a custom subset of the MIPS64 architecture, which was designed for various applications, including general PCs as well as high-performance computing. This made a lot of sense for Loongson as it allowed the company to maintain compatibility with programs designed for MIPS64 and introduce its own extensions to improve the performance of specific programs. But no matter how good MIPS64 used to be, it is an older architecture and Loongson needed something new.
Last year Loongson finally introduced its 3A5000 and 3C5000 processors based on its own LoongArch instruction set architecture, which maintains compatibility with MIPS, but has 2,000 proprietary instructions, binary conversion extension instructions (LBT), vector processing extension instructions (LSX), advanced vector processing extension instructions (LASX), and virtualization extension instructions (LVZ). The first attempt to enable the new CPUs in Linux was not an outright success as the chips largely used MIPS code, but now that GCC 12.1 finally gains support for LoongArch, this situation may change.
Competitive processors are crucial for China, which cannot access HPC hardware developed in the U.S. For now, Loongson’s CPUs are aimed primarily at client machines and servers, but once LoongArch gets proper support from software (and this includes popular compilers on the first place), it will certainly make sense to expand the list of applications addressed by these processors.