[llvm-dev] Auto-vectorization command flag not work in clang-13

zxl via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 14 06:09:53 PST 2021


Hi:   I want to use clang auto-vectorization for this code:
```

#include <stdio.h>

#include <stdint.h>




void test() {

  int a[100];

  for (int64_t i = 0; i < 100; i++) {

    a[i] = i / 8;

  }

  printf("%ld %ld", a[0], a[99]);

}




int main(int argc, char** argv) {

  test();

}




```
It worked with this command: clang -S -O3 vector_divide.c  and it can get successfully vectorized asm.
But i want to use auto-vectorization as below:
clang -S -emit-llvm -mllvm -force-vector-width=8 vector_divide.c -o vec_dev.ll
opt -loop-vectorize -force-vector-width=8 -S vec_dev.ll -o vec_opt_dev.ll
clang -S vec_opt_dev.ll
Then it can't worked, what should i do?
yours, zhengxianli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211114/83894948/attachment.html>


More information about the llvm-dev mailing list