================ @@ -919,23 +1017,66 @@ bool X86LowerAMXCast::optimizeAMXCastFromPhi( return true; } +static Value *getShapeFromAMXIntrinsic(Value *Inst, unsigned ShapeIdx, + bool IsRow) { + if (!isAMXIntrinsic(Inst)) + return nullptr; + + auto *II = cast<IntrinsicInst>(Inst); + if (IsRow) + return II->getOperand(0); + + assert(ShapeIdx < 2 && "Currently 2 shapes in 1 instruction at most!"); + return II->getOperand(ShapeIdx + 1); +} + // %43 = call <256 x i32> @llvm.x86.cast.tile.to.vector.v256i32(x86_amx %42) // store <256 x i32> %43, <256 x i32>* %p, align 64 // --> // call void @llvm.x86.tilestored64.internal(i16 %row, i16 %col, i8* %p, // i64 64, x86_amx %42) bool X86LowerAMXCast::combineCastStore(IntrinsicInst *Cast, StoreInst *ST) { Value *Tile = Cast->getOperand(0); - // TODO: If it is cast intrinsic or phi node, we can propagate the - // shape information through def-use chain. - if (!isAMXIntrinsic(Tile)) + + assert(Tile->getType()->isX86_AMXTy() && "Not Tile Operand!"); + + // TODO: Specially handle the mult-use case. ---------------- phoebewang wrote:
Done. https://github.com/llvm/llvm-project/pull/113532 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits