[Mlir-commits] [mlir] [mlir][vector] Add alignment attribute to `maskedload` and `maskedstore` (PR #151690)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Aug 4 02:06:54 PDT 2025
================
@@ -1679,6 +1679,20 @@ func.func @load_0d(%memref : memref<200x100xf32>, %i : index, %j : index) -> vec
// -----
+func.func @load_alignment(%memref : memref<200x100xf32>, %i : index, %j : index) -> vector<8xf32> {
+ %0 = vector.load %memref[%i, %j] { alignment = 8 } : memref<200x100xf32>, vector<8xf32>
+ return %0 : vector<8xf32>
+}
+
+// CHECK-LABEL: func @load_alignment
+// CHECK: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// CHECK: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]] : i64
+// CHECK: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}} : i64
+// CHECK: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
+// CHECK: llvm.load %[[GEP]] {alignment = 8 : i64} : !llvm.ptr -> vector<8xf32>
----------------
banach-space wrote:
@krzysz00, @kuhar , I think that it should be sufficient to only check this line, i.e.:
```mlir
// CHECK: llvm.load %{{.}} {alignment = 8 : i64} : !llvm.ptr -> vector<8xf32>
```
Ultimately, the point of this test is to verify that the alignment has been correctly propagated.
https://github.com/llvm/llvm-project/pull/151690
More information about the Mlir-commits
mailing list