This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, C++] Add C++ FE support for #pragma ivdep


On Fri, Oct 25, 2013 at 08:22:22AM +0200, Tobias Burnus wrote:
> Jason Merrill wrote:
> >On 10/10/2013 04:46 AM, Tobias Burnus wrote:
> >>I considered to add the annotation also to C++11's range-based loops,
> >>but as those are unlikely to vectorize, I didn't do so.
> >
> >I would think that a range-based loop over an array should vectorize
> >nicely:
> >
> >int ar[8];
> >for (int i: ar) { ... }
> 
> They do - but during my experiments they either also did without
> "#pragma GCC ivdep" â typically with static arrays like yours â or
> they didn't with vector<>.
> 
> However, I came now up with an example where "#pragma GCC ivdep"
> should have an effect:
> 
> int ar[100];
> 
> void foo(int *a) {
>   for (auto &i : ar) {
>     i *= *a;
>   }
> }
> 
> Therefore, I will send a follow up patch.

What about
#pragma GCC ivdep
while (cond) { ... }
and
#pragma GCC ivdep
do { ... } while (cond);
(for both C and C++)?

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]