| ▲ | AlotOfReading 4 hours ago | |||||||
C is a programming language. It makes for a very shitty high level assembler. Here's a trivial example clang will often implement differently on different systems, producing two different results. Clang x64 will generally mul+add, while clang arm64 is aggressive about fma.
But that's just the broad strategy. Depending on the actual compiler flags, the assembly generated might include anything up to multiple function calls under the hood (sanitizers, soft floats, function profiling, etc). | ||||||||
| ▲ | torstenvl 4 hours ago | parent [-] | |||||||
I don't think clang is being "aggressive" on ARM, it's just that all aarch64 targets support fma. You'll get similar results with vfmadd213ss on x86-64 with -march=haswell (13 years old at this point, probably a safe bet).
Clang armv8 21.1.0:
Clang x86-64 21.1.0: | ||||||||
| ||||||||