[flang-commits] [flang] [flang] Implement !DIR$ VECTOR ALWAYS (PR #93830)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Mon Jun 10 02:56:35 PDT 2024
================
@@ -1926,8 +1926,23 @@ class FirConverter : public Fortran::lower::AbstractConverter {
return builder->createIntegerConstant(loc, controlType, 1); // step
}
+ void addLoopAnnotationAttr(IncrementLoopInfo &info) {
+ mlir::BoolAttr f = mlir::BoolAttr::get(builder->getContext(), false);
+ mlir::LLVM::LoopVectorizeAttr va = mlir::LLVM::LoopVectorizeAttr::get(
+ builder->getContext(), /*disable=*/f, {}, {}, {}, {}, {}, {});
+ // Create distinct access group
+ mlir::LLVM::AccessGroupAttr ag =
+ mlir::LLVM::AccessGroupAttr::get(builder->getContext());
----------------
kiranchandramohan wrote:
Could you point me to the Clang example?
The following example did not generate access groups and it vectorized with the pragma and did not vectorize without it.
```
void add(int* __restrict x, int* __restrict y,int offset, int n) {
int i;
#pragma clang loop vectorize(enable)
for(i=0;i<n; i++) {
x[i] = x[i] / y[i] + 1;
}
}
```
https://github.com/llvm/llvm-project/pull/93830
More information about the flang-commits
mailing list