@@ -35,6 +35,11 @@ def AMDGPU_Dialect : Dialect {
3535 let useDefaultAttributePrinterParser = 1;
3636}
3737
38+ def AnyIntegerOrFloat : AnyTypeOf<[AnySignlessInteger, AnyFloat], "Integer or Float">;
39+
40+ def AnyIntegerOrFloatOr1DVector :
41+ AnyTypeOf<[AnyIntegerOrFloat, VectorOfRankAndType<[1], [AnyIntegerOrFloat]>]>;
42+
3843//===----------------------------------------------------------------------===//
3944// AMDGPU general attribute definitions
4045//===----------------------------------------------------------------------===//
@@ -533,14 +538,15 @@ def AMDGPU_DPPPerm : I32EnumAttr<"DPPPerm",
533538def AMDGPU_DPPPermAttr : EnumAttr<AMDGPU_Dialect, AMDGPU_DPPPerm,
534539 "dpp_perm">;
535540
536- def AMDGPU_DPPOp : AMDGPU_Op<"dpp", [SameTypeOperands, AllTypesMatch<["result", "old", "src"]>]>,
541+ def AMDGPU_DPPOp : AMDGPU_Op<"dpp",
542+ [Pure, SameTypeOperands, AllTypesMatch<["result", "old", "src"]>]>,
537543 Arguments<(ins AnyType:$old,
538- AnyType:$src,
539- AMDGPU_DPPPermAttr:$kind,
540- OptionalAttr<AnyAttrOf<[I32Attr, ArrayAttr, UnitAttr]>>:$permArgument,
541- DefaultValuedAttr<I32Attr, "0xf">:$row_mask,
542- DefaultValuedAttr<I32Attr, "0xf">:$bank_mask,
543- DefaultValuedAttr<BoolAttr, "false">:$bound_ctrl)> {
544+ AnyType:$src,
545+ AMDGPU_DPPPermAttr:$kind,
546+ OptionalAttr<AnyAttrOf<[I32Attr, ArrayAttr, UnitAttr]>>:$permArgument,
547+ DefaultValuedAttr<I32Attr, "0xf">:$row_mask,
548+ DefaultValuedAttr<I32Attr, "0xf">:$bank_mask,
549+ DefaultValuedAttr<BoolAttr, "false">:$bound_ctrl)> {
544550 let summary = "AMDGPU DPP operation";
545551 let description = [{
546552 This operation represents DPP functionality in a GPU program.
@@ -565,6 +571,27 @@ def AMDGPU_DPPOp : AMDGPU_Op<"dpp", [SameTypeOperands, AllTypesMatch<["result",
565571 let hasVerifier = 1;
566572}
567573
574+ def AMDGPU_SwizzleBitModeOp : AMDGPU_Op<"swizzle_bitmode",
575+ [Pure, AllTypesMatch<["result", "src"]>]>,
576+ Arguments<(ins AnyIntegerOrFloatOr1DVector:$src,
577+ I32Attr:$and_mask,
578+ I32Attr:$or_mask,
579+ I32Attr:$xor_mask
580+ )> {
581+ let summary = "AMDGPU ds_swizzle op, bitmode variant";
582+ let description = [{
583+ High-level wrapper on bitmode `rocdl.ds_swizzle` op, masks are represented
584+ as separate fields so user won't need to do manual bitpacking.
585+
586+ Supports arbitrary int/float/vector types, which will be repacked to i32 and
587+ one or more `rocdl.ds_swizzle` ops during lowering.
588+ }];
589+ let results = (outs AnyIntegerOrFloatOr1DVector:$result);
590+ let assemblyFormat = [{
591+ $src $and_mask $or_mask $xor_mask attr-dict `:` type($result)
592+ }];
593+ }
594+
568595def AMDGPU_LDSBarrierOp : AMDGPU_Op<"lds_barrier"> {
569596 let summary = "Barrier that includes a wait for LDS memory operations.";
570597 let description = [{
@@ -794,7 +821,7 @@ def AMDGPU_GatherToLDSOp :
794821
795822 The `$dst`, along with its indices, points to the memory location the subgroup of this thread
796823 will write to.
797-
824+
798825 Note: only enabled for gfx942 and later.
799826 }];
800827 let assemblyFormat = [{
0 commit comments