On Wednesday, 15 July 2015 at 22:42:05 UTC, Steven wrote:
I was trying to show someone how awesome Dlang was earlier, and
how the vector operations are expected to take advantage of the
CPU vector instructions, and was dumbstruck when dmd and gdc
both failed to auto-vectorize a simple case. I've stripped it
down to the bare minimum and loaded the example on the
interactive compiler:
http://asm.dlang.org/#%7B%22version%22%3A3%2C%22filterAsm%22%3A%7B%7D%2C%22compilers%22%3A%5B%7B%22sourcez%22%3A%22JYWwDg9gTgLgBAY2gUwHQGdQBMDcAoPAMwBsIBDGAbQCYBWANgF05kAPM8Y5AQQAoTyVOkzhkANHAEUaDZgCMAlHgDeeOJNLThzBPnUB6fXCjJ0AV2Ix0cYADs45uenRrElZgF5R7uAFo4cu56xsgwZlD2ungAvgRSQrIs7JzIAEL8mgki4hqCMiKKKq7xAByUAMzUjABuZHBeCGToMBmCZZWMCmTBpRVV1XL1iE0tvR0Kcj2Z7f1R6q6GIeaW1nYOZnJgLurVCD5etT7%2BA0EE6iZhEcPNrVqyCrv40UAAA%3D%22%2C%22compiler%22%3A%22dmd2067%22%2C%22options%22%3A%22-O%20-release%20-inline%20-boundscheck%3Doff%22%7D%5D%7D
[...]
Not sure why DMD isn't using SIMD on the first one, haven't
looked at that code in a while. Anyway, gdc vectorises both:
http://goo.gl/CzD15s and that's with gcc4.9 backend, it can
probably do better build against something more recent.