Hacker News new | ask | show | jobs
by Rochus 42 days ago
> it's like one Claude prompt to add MIPS support to this

Can you provide the code somewhere? Is it complete? Does it really work? I have a hard time to believe that an LLM really can generate a complete and working backend for a target architecture with "one prompt". From my experience with such tools, by the end of the day it takes longer until it covers all edge cases and actually works than when writing it myself.

2 comments

The backend is only ~1300 lines. QBE is a super simple project which is why adding a backend to it worked so well. I just pointed Claude at the existing RISC-V backend for reference and it whipped up the MIPS one. It really does work, though there might be bugs I didn't run into. I compiled an Amiga MOD player, written in my language, to the N64 and it worked fine, if that gives you an idea of how stress tested it was. IIRC it runs about 5x slower than GCC-generated code.

https://gist.github.com/SuperDisk/1aa50263a773143c82a39d4771...

Interesting, thanks for posting. I had a first look and think that the AI has messed up with the floating-point and casting instructions (i.e. just copied over the RV instructions). I also spotted other places (e.g. TLS) which look like RV. It's also surprising that the code - as you say - is so much slower than (optimized?) GCC, since QBE is assumed to be at 70-80%.
The page says "aims to provide 70%" though, funny how words spread.
There are reports by independend testers (e.g. https://briancallahan.net/blog/20211010.html or https://news.ycombinator.com/item?id=40350384) suggesting that range.
They absolutely can for simpler cases like this, especially recent GPT 5.x models are amazing at such lower-level compiler work.