Don wrote:
The bad news: The DMD back-end is a state-of-the-art backend from the
late 90's. Despite its age, its treatment of integer operations is, in
general, still quite respectable.
Modern compilers don't do much better. The point of diminishing returns
was clearly reached.
However, it _never_ generates SSE
instructions. Ever. However, array operations _are_ detected, and they
become to calls to library functions which use SSE if available. That's
not bad for moderately large arrays -- 200 elements or so -- but of
course it's completely non-optimal for short arrays.
The good news: Now that static arrays are passed by value, introducing
inline SSE support for short arrays suddenly makes a lot of sense --
there can be a big performance benefit for a small backend change; it
could be done without introducing SSE anywhere else. Most importantly,
it doesn't require any auto-vectorisation support.
What the library functions also do is have a runtime switch based on the
capabilities of the processor, switching to operations tailored to that
processor. To generate the code directly, assuming the existence of SSE,
is to mean the code will only run on modern chips. Whether or not this
is a problem depends on your application.