~MIPS64 are not 100% MIPS64-ISA compliant.
The Loongson MIPS implementation is a superset of MIPS64 if I remember correctly. I doubt that anyone would ever notice the difference except if you're writing MIPS assembly and even then probably not very much.
The history of the
Loongson is very controversial.
Loongson's CPUs relied on various types of the company's LoongISA architecture { v1, v2, v3, ... } as - time by time - custom subset of the MIPS64 architecture. Such a tactic - somehow - enabled the company to preserve compatibility with programs designed for MIPS64 while bringing in its own extensions to improve performance in contemporary applications.
The problem is that "somehow" ...
Who? What?
![Shocked :o](https://www.eevblog.com/forum/Smileys/default/xshocked.gif.pagespeed.ic.CrwtrNUjLO.png)
I have a terrible habit of collecting prototypes and weird computers when people get bored and parking them on eBay, or when they threaten to crush them in a hydraulic press.
I took the plane and flew to Sweden to collect in person a brand-new HPPA C3750 Workstation, left in a company's warehouse. The new owners weren't willing to pack it because it's heavy (30Kg) and the original HP parcel is very big (the packaging includes approximately 40 cm of polystyrene all around a full tower chassis), so they put up an advert, not very descriptive because they didn't have the faintest idea what that computer was, but they put up photos of the box, still closed with the HP seals!
Likewise I recovered an IDT prototype of one of the very first evaluation boards (therefore with profiling and debugger heads) of a MIPS R2K! Note that all commercial applications (including the SONY Playstation1) used R3K!
Worse yet, I have a 2006 "
Godson" Eval SBC(2). A card with very little stuff on it. CPU, RAM, Ethernet, and a lon that lacks those special unaligned load/store instructions that almost never serve any purpose, except when you have a misaligned address.
It's not MIPS64 but rather MIPSIII/64bit , and wasn't even supposed to come out of China, and actually remained in China until 2010, when about the same thing happened as what happened with the HP workstation (what money can do ... and I offered only 200 euro for that thing), and so, somehow it landed on my table .
It's an early implementation, and lacks the unaligned load-store instructions patented by MIPS Technologies.
It's not a problem, something like this, for different reasons, I encountered it on the MIPS4 used by SGI on Indigo2 systems, and the
solution workaround is very simple: the missing instructions can be emulated by other instructions, just ... either you patch the machine layer of Gcc, or ...
mips-gcc -c -S hAllo.c -o hAllo.s1
mips-fix hAllo.s1 hAllo.s # intercept the assembly it generates, and replace those missing instructions
mips-as hAllo.s -o hAllo.o
Ugly, but it somehow works for those bloody
MIPS-like chips
![Shocked :o](https://www.eevblog.com/forum/Smileys/default/xshocked.gif.pagespeed.ic.CrwtrNUjLO.png)
- 2001-2007: MIPS-like, compatible with { MIPSII, MIPSIII } but misses unaligned load-store instructions
- 2007-2020: LoongISA, MIPS64 compatibile, the ISA comes with extra custom instructions, very useful to speed up Qemu/{x86, arm}
- 2021-2024: LoongArch -> wtf?!? breakup with MIPS, in-house LoongArch architecture, no more compatible(1) and it needs a dedicated toolchain
Then, after 2007 Loongson was fully
MIPS64-based instead of
MIPS-like, but then, I don't know why, the technical documentation (the small one in English) started mentioning "LoongISA" and "LoongArch" as if they were different ISA, and this is also what we saw in the various gcc patches, and for a few years it was synonymous with "enriched MIPS32 superset", then with the 2021 "
Loongson3-5000 series" it really became something else, completely incompatible.
In Gentoo, ARCH=loong, instead of mips64, and the target tuple is "loongarch64-unknown-linux-gnu", instead of "mips64-unknown-linux-gnu".
LoongArch (>=2021 (3)) is not binary compatible with either MIPS or RISC-V, although the ISA and ABI show heavy influence of the two.
There are six ABIs defined for LoongArch, much like those of RISC-V. But for Gentoo, the profile focuses on LP64D only first, multilib support will come later.
(1) - "
Loongson Architecture LoongArch has nothing to do with MIPS and other architectures designed outside of China" - say Chinese dev-guys
![Confused :-//](https://www.eevblog.com/forum/Smileys/default/confused0024.gif.pagespeed.ce.5xOqKkq0Co.gif)
LoongArch is divided into two versions { LA32-bit, LA64-bit }.
LA64 applications are application-level backward binary compatibility with LA32 applications, and that *is supposed to* mean LA32 applications can run directly on the machine compatible with LA64, but the behavior of system softwares { firmware, kernel, userland } on the machine compatible with LA32 is
not guaranteed to be the same as on the machine compatible with LA64.
(2) all LoongArch systems are little-endian, while my dev board is big-endian, and can be set little-endian with a jumper.
(3) []={ 2K0500, 2K1000LA, 3A5000, 3A5000L, 3A5000HV, 3B5000, 3C5000, 3C5000L, 3C5000L, ... }
it can be hard to tell whether a particular Loongson chip is implementing "LoongArch" or "MIPS", especially for casual users
![Face Palm :palm:](https://www.eevblog.com/forum/Smileys/default/xfacepalm.gif.pagespeed.ic.EBDwh1hCfo.png)