@@ -1899,7 +1899,9 @@ def Vector_MaskedLoadOp :
1899
1899
Arguments<(ins Arg<AnyMemRef, "", [MemRead]>:$base,
1900
1900
Variadic<Index>:$indices,
1901
1901
VectorOfNonZeroRankOf<[I1]>:$mask,
1902
- AnyVectorOfNonZeroRank:$pass_thru)>,
1902
+ AnyVectorOfNonZeroRank:$pass_thru,
1903
+ ConfinedAttr<OptionalAttr<I64Attr>,
1904
+ [AllAttrOf<[IntPositive, IntPowerOf2]>]>:$alignment)>,
1903
1905
Results<(outs AnyVectorOfNonZeroRank:$result)> {
1904
1906
1905
1907
let summary = "loads elements from memory into a vector as defined by a mask vector";
@@ -1920,6 +1922,12 @@ def Vector_MaskedLoadOp :
1920
1922
comes from the pass-through vector regardless of the index, and the index is
1921
1923
allowed to be out-of-bounds.
1922
1924
1925
+ An optional `alignment` attribute allows to specify the byte alignment of the
1926
+ load operation. It must be a positive power of 2. The operation must access
1927
+ memory at an address aligned to this boundary. Violations may lead to
1928
+ architecture-specific faults or performance penalties.
1929
+ A value of 0 indicates no specific alignment requirement.
1930
+
1923
1931
The masked load can be used directly where applicable, or can be used
1924
1932
during progressively lowering to bring other memory operations closer to
1925
1933
hardware ISA support for a masked load. The semantics of the operation
@@ -1936,6 +1944,18 @@ def Vector_MaskedLoadOp :
1936
1944
: memref<?x?xf32>, vector<16xi1>, vector<16xf32> into vector<16xf32>
1937
1945
```
1938
1946
}];
1947
+ let builders = [
1948
+ OpBuilder<(ins "Type":$resultType,
1949
+ "Value":$base,
1950
+ "ValueRange":$indices,
1951
+ "Value":$mask,
1952
+ "Value":$pass_thru,
1953
+ CArg<"uint64_t", "0">:$alignment), [{
1954
+ return build($_builder, $_state, resultType, base, indices, mask, pass_thru,
1955
+ alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
1956
+ nullptr);
1957
+ }]>
1958
+ ];
1939
1959
let extraClassDeclaration = [{
1940
1960
MemRefType getMemRefType() {
1941
1961
return ::llvm::cast<MemRefType>(getBase().getType());
@@ -1962,7 +1982,9 @@ def Vector_MaskedStoreOp :
1962
1982
Arguments<(ins Arg<AnyMemRef, "", [MemWrite]>:$base,
1963
1983
Variadic<Index>:$indices,
1964
1984
VectorOfNonZeroRankOf<[I1]>:$mask,
1965
- AnyVectorOfNonZeroRank:$valueToStore)> {
1985
+ AnyVectorOfNonZeroRank:$valueToStore,
1986
+ ConfinedAttr<OptionalAttr<I64Attr>,
1987
+ [AllAttrOf<[IntPositive, IntPowerOf2]>]>:$alignment)> {
1966
1988
1967
1989
let summary = "stores elements from a vector into memory as defined by a mask vector";
1968
1990
@@ -1982,6 +2004,12 @@ def Vector_MaskedStoreOp :
1982
2004
is stored regardless of the index, and the index is allowed to be
1983
2005
out-of-bounds.
1984
2006
2007
+ An optional `alignment` attribute allows to specify the byte alignment of the
2008
+ store operation. It must be a positive power of 2. The operation must access
2009
+ memory at an address aligned to this boundary. Violations may lead to
2010
+ architecture-specific faults or performance penalties.
2011
+ A value of 0 indicates no specific alignment requirement.
2012
+
1985
2013
The masked store can be used directly where applicable, or can be used
1986
2014
during progressively lowering to bring other memory operations closer to
1987
2015
hardware ISA support for a masked store. The semantics of the operation
@@ -1998,6 +2026,27 @@ def Vector_MaskedStoreOp :
1998
2026
: memref<?x?xf32>, vector<16xi1>, vector<16xf32>
1999
2027
```
2000
2028
}];
2029
+ let builders = [
2030
+ OpBuilder<(ins "TypeRange":$resultTypes,
2031
+ "Value":$base,
2032
+ "ValueRange":$indices,
2033
+ "Value":$mask,
2034
+ "Value":$valueToStore,
2035
+ CArg<"uint64_t", "0">:$alignment), [{
2036
+ return build($_builder, $_state, resultTypes, base, indices, mask, valueToStore,
2037
+ alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
2038
+ nullptr);
2039
+ }]>,
2040
+ OpBuilder<(ins "Value":$base,
2041
+ "ValueRange":$indices,
2042
+ "Value":$mask,
2043
+ "Value":$valueToStore,
2044
+ CArg<"uint64_t", "0">:$alignment), [{
2045
+ return build($_builder, $_state, base, indices, mask, valueToStore,
2046
+ alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
2047
+ nullptr);
2048
+ }]>
2049
+ ];
2001
2050
let extraClassDeclaration = [{
2002
2051
MemRefType getMemRefType() {
2003
2052
return ::llvm::cast<MemRefType>(getBase().getType());
0 commit comments