I tried your solution with g ++ version 4.5.2 (both Ubuntu and Windows) and it did not vectorize the loop.
If the alignment attribute is removed, it vectorizes the loop using unplaced loads.
If the function is built-in so that the array can be accessed directly with the pointer removed, then it is vectorized with load balancing.
In both cases, the alignment attribute prevents vectorization. This is ironic: "aligned_double * x" should have allowed vectorization, but it does the opposite.
What was the compiler that told you vectorized loops? I suspect this is not a gcc compiler?
A Fog Aug 09 2018-11-11T00: 00Z
source share