Re: Questions about vectorizing a simple loop by inferring the range from array

2023-11-10 Thread Hao Liu OS via Gcc
Subject: Re: Questions about vectorizing a simple loop by inferring the range from array On Thu, Nov 9, 2023 at 10:51 AM Hao Liu OS via Gcc wrote: > > Hi, > > I'm investigating how to vectorize the following simple case: > > int A[1024 * 2]; > int foo1 (unsigned off

Questions about vectorizing a simple loop by inferring the range from array

2023-11-09 Thread Hao Liu OS via Gcc
Hi, I'm investigating how to vectorize the following simple case: int A[1024 * 2]; int foo1 (unsigned offset) { int sum = 0; for (unsigned i = 0; i < 1024; i++) sum += A[i + offset]; return sum; } The loop body and loop vectorizer dumps are: # i_13 = PH