VBROADCAST Implementation Issues

i want to implement gather for v64i32. i wrote following code.

def GATHER_256B : I<0x68, MRMSrcMem, (outs VR_2048:$dst), (ins i2048mem:$src),
“GATHER_256B\t{$src, $dst|$dst, $src}”,
[(set VR_2048:$dst, (v64i32 (masked_gather addr:$src)))],
IIC_MOV_MEM>, TA;
def: Pat<(v64f32 (masked_gather addr:$src)), (GATHER_256B addr:$src)>;

Also i wrote this line in isellowering.h

setOperationAction(ISD::MGATHER, MVT::v64i32, Legal);

But I am getting following error:

llvm-tblgen: /utils/TableGen/CodeGenDAGPatterns.cpp:2134: llvm::TreePatternNode *llvm::TreePattern::ParseTreePattern(llvm::Init *, llvm::StringRef): Assertion `New->getNumTypes() == 1 && “FIXME: Unhandled”’ failed.

What is my mistake?

Please help me.

masked_gather returns two results. The data and the modified mask. Note the $dst and the $mask_wb in the pattern below.

multiclass avx512_gather<bits<8> opc, string OpcodeStr, X86VectorVTInfo _,
X86MemOperand memop, PatFrag GatherNode> {
let Constraints = “@earlyclobber $dst, $src1 = $dst, $mask = $mask_wb”,
ExeDomain = _.ExeDomain in
def rm : AVX5128I<opc, MRMSrcMem, (outs _.RC:$dst, _.KRCWM:$mask_wb),
(ins _.RC:$src1, .KRCWM:$mask, memop:$src2),
!strconcat(OpcodeStr#
.Suffix,
“\t{$src2, ${dst} {${mask}}|${dst} {${mask}}, $src2}”),
[(set _.RC:$dst, .KRCWM:$mask_wb,
(GatherNode (
.VT _.RC:$src1), .KRCWM:$mask,
vectoraddr:$src2))]>, EVEX, EVEX_K,
EVEX_CD8<
.EltSize, CD8VT1>;
}

Hello,
I did as you said,

Please tell me whether the following correct now??

def GATHER_256B : I<0x68, MRMSrcMem, (outs VR_2048:$dst, _.KRCWM:$mask_wb), (VR_2048:$src1, _.KRCWM:$mask, ins i2048mem:$src2),
“GATHER_256B\t{$src2, {$dst}{${mask}}|${dst} {${mask}}, $src2}”),
[(set VR_2048:$dst, _.KRCWM:$mask_wb, (v64i32 (GatherNode (VR_2048:$src1), _.KRCWM:$mask,
VR_2048:$src2))],
IIC_MOV_MEM>, TA;
def: Pat<(v64f32 (GatherNode addr:$src2)), (GATHER_256B addr:$src2)>;

Thank You

i am getting this error

error: Variable not defined: ‘_’

for _.KRCWM
what to do?

Changed it to;

def GATHER_256B : I<0x68, MRMSrcMem, (outs VR_2048:$dst, VK64:$mask), (ins i2048mem:$src),
“GATHER_256B\t{$src, {$dst}{${mask}}|${dst} {${mask}}, $src}”,
[(set VR_2048:$dst, VK64:$mask, (v64i32 (masked_gather addr:$src)))],
IIC_MOV_MEM>, TA;
def: Pat<(v64f32 (masked_gather addr:$src)), (GATHER_256B addr:$src)>;

Now getting following error:

Unhandled memory encoding VK64
Unhandled memory encoding
UNREACHABLE executed at /utils/TableGen/X86RecognizableInstr.cpp:1347!

What to do?

masked_gather takes 3 inputs. not just an address. See the AVX512 pattern is pasted earlier