Hello, It is indeed because I could get the compiler to use SIMD instructions with the loop written this way.
On Wed, Jan 13, 2021 at 11:29 AM LuXugang <xugan...@icloud.com.invalid> wrote: > Hi Adrien, > > I have some confusion about the method collapse8(long[ ] arr) in* ForUtil* > class > > > > > On line 85, the loop times are 16, because there are 128 elements in arr, > and eight elements were processed at a time. > > My question is why not choose the elements in order , like in the first > loop, arr[0] ~ arr[7] were chosen, in the second loop, arr[8] ~ arr[15] > were chosen … > > Is it cause the compiler cann’t generate SIMD instructions or just > something else? > > Could you help me find the answer here? > -- Adrien