Hi all,

Some community members have shown interest in a patch I made a while back but 
didn't submit. 

I'm not looking to commit this at the moment, just to make it available (hence 
why I haven't sent it to gcc-patches)>   

This patch was based on master at the following commit and doesn't currently 
apply to the head of master:
90f7636bf8df50940e0f749af60a6b374a8f09b4 libstdc++: Make C++17 ignore 
--disable-libstdcxx-filesystem-ts [PR 94681]

This patch adds support to vectorize the following snippet to find the max and 
corresponding index from an array:

void foo (int *data, int n) {
  int best_i=0, best = 0;

  for (int i = 0; i < n; i++) {
    if (data[i] > best) {
      best = data[i];
      best_i = i;
    }
  }
  data[best_i] = data[0];
  data[0] = best;
}

Attachment: minmax.patch
Description: minmax.patch

Reply via email to