================ @@ -56,6 +96,58 @@ def Ptr_FromPtrOp : Pointer_Op<"from_ptr", [ let hasVerifier = 1; } +//===----------------------------------------------------------------------===// +// GatherOp +//===----------------------------------------------------------------------===// + +def Ptr_GatherOp : Pointer_Op<"gather", [ + DeclareOpInterfaceMethods<MemoryEffectsOpInterface>, + TypesMatchWith<"result and mask must be compatible", "result", "mask", [{ + ::llvm::cast<ShapedType>($_self).clone( + IntegerType::get($_self.getContext(), 1)) + }]>, + AllTypesMatch<["result", "passthrough"]>, + // Check the shapes are compatible and both use the same shaped container + // type. + AllShapesMatch<["result", "ptrs"]>, AllTypeIDsMatch<["result", "ptrs"]> + ]> { + let summary = "Gather operation"; + let description = [{ + The `gather` operation performs conditional loads from multiple memory + locations specified by `ptrs` based on a mask `mask`. Elements of the + result corresponding to masked-off lanes are taken from the passthrough + operand. + + The mask operand is a shaped type of `i1` elements that must have the same + shape as the result type. + + Examples: + ```mlir + // Gather values from multiple memory locations + %result = ptr.gather %ptrs, %mask, %passthrough : + vector<4x!ptr.ptr<#ptr.generic_space>> -> vector<4xf32> + + // Gather with alignment + %result = ptr.gather %ptrs, %mask, %passthrough alignment = 8 : + vector<4x!ptr.ptr<#ptr.generic_space>> -> vector<4xf32> + ``` + }]; + let arguments = (ins Ptr_Ptr1DType:$ptrs, + Ptr_Mask1DType:$mask, + Ptr_Any1DType:$passthrough, + AlignmentProp:$alignment); + let results = (outs Ptr_Any1DType:$result); + let assemblyFormat = [{ + $ptrs `,` $mask `,` $passthrough (`alignment` `=` $alignment^)? + attr-dict `:` qualified(type($ptrs)) `->` type($result) ---------------- joker-eph wrote:
What is the `qualified` trying to address here? https://github.com/llvm/llvm-project/pull/156368 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits