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

zxl via llvm-dev
Sun, 14 Nov 2021 14:09:53 -0000

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

#include <stdio.h&gt;

#include <stdint.h&gt;




void test() {

&nbsp; int a[100];

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

&nbsp; &nbsp; a[i] = i / 8;

&nbsp; }

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

}




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

&nbsp; test();

}




```
It worked with this command: clang -S -O3 vector_divide.c&nbsp; 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>