Hacker News new | ask | show | jobs
by drp4929 4862 days ago
Now a days, compiler writers sees zero reason to write inline assembly.

First of all, it throws a wrench in high level optimizer's analysis. Plus, compilers and processors are getting smarter day by day while inline assembly in shipping code becomes more and more untouchable everyday.

1 comments

You have never written embedded code, or code to deal with low level hardware in drivers?

I haven't either, but I imagine ASM would be required here.

I've written code for GameBoy Advance which has no OS, just magic memory addresses, and didn't need any assembly. Even hblank interrupts could be implemented in C.
A typical reason to use assembly these days is for instructions the compiler doesn't output (for instance specialized instructions which are only useful for a kernel).

GCC's extended assembly at least (which clang/LLVM also support), allows one to specify constraints for asm() statements that let the compiler respect dependencies etc.