top | item 46214832

(no title)

vnorilo | 2 months ago

And yet modern assembly does not correspond 1:1 to the micro-ops the CPU runs or even necessarily the order in which they run.

Both ISA-level assembly and C are targeting an abstract machine model, even if the former is somewhat further removed from hardware reality.

discuss

order

arghwhat|2 months ago

Java also targets an abstract machine model (JVM) - such statement really doesn't mean much.

Assembly is not about corresponding to exactly which gates open when in the CPU. It's just the human writable form of whatever the CPU ingests, whereas C is an early take on a language reasonable capable of expressing higher level ideas with less low-level noise.

I seriously doubt anyone who has written projects in assembly would make such comparisons...

vnorilo|2 months ago

>I seriously doubt anyone who has written projects in assembly would make such comparisons...

With genuine respect, I believe this type of insinuation is rarely productive.

Someone might still have silly opinions, even if they have been paid to write assembly for 8-24-64 bit cisc, risc, ordered and out of order ISAs, and maybe compilers too. Peace :)

cylemons|2 months ago

Sure but from software POV assembly is the lowest level you can target

torstenvl|2 months ago

Which assembly? Assembly with macros? Assembly with synthetic instructions?

If you use

    mov %i0, %l0
instead of

    or %g0, %i0, %l0
Then that isn't "the lowest level you can target."

jcelerier|2 months ago

Yes and no, you can use c in situations where there's no "assembly", for instance when synthesizing FPGAs. You target flow graphs directly in that case IIRC.

IshKebab|2 months ago

> And yet modern assembly does not correspond 1:1 to the micro-ops the CPU runs or even necessarily the order in which they run.

Nobody claimed that. It corresponds to the instructions the CPU runs and their observable order.

Also it's really only x86 that uses micro-ops (in the way that you mean), and there are still plenty of in-order CPUs.

vnorilo|2 months ago

sure, I was thinking of large OO cores. "Correspondd to the instructions the cpu runs and their observable order" is how I'd characterize C as well, but to each their own.

flohofwoe|2 months ago

> And yet modern assembly does not correspond 1:1 to the micro-ops the CPU runs or even necessarily the order in which they run.

It's still much closer to the input machine code compared to what compiler optimizer passes do to your input C code ;)

vnorilo|2 months ago

I have empathy for this having written compiler passes for 10ish years of my career. But as I've studied register renaming, speculative branch prediction and trace caches I would no longer agree with your last sentence. It's fine though, totally just an opinion.