Hi, I’ve been doing some attempts at Playstation 1 homebrew development with Zig. The PS1’s CPU uses the MIPS-I instruction set, so I target it using -target mipsel-freestanding -mcpu mips1.
I think I found a bug:
With divisions, the compiled output when safety checks are enabled includes the teq (Trap if equal) instruction to check for divide by zero. The MIPS-I instruction set does not have this yet, it was introduced in MIPS-II.
So the bug is that the compiled output includes teq even when the mips1 CPU is targeted. Here’s a godbolt link, the teq is on line 25: Compiler Explorer
I’m unsure who or how to report this. Is it an LLVM bug or a Zig bug? (…or do I have my compiler flags wrong?)
(For now, I’m able to continue by always compiling with OReleaseFast no matter what. It does mean I don’t get proper asserts though
)