Skip to content

Commit ab72182

Browse files
committed
[AArch64][SME] NFC: Extend tile_slice ComplexPattern to match default case.
A tile slice offset of '0' is the default and by moving this into SelectSMETileSlice we can remove some redundant patterns. Reviewed By: kmclaughlin Differential Revision: https://reviews.llvm.org/D128506
1 parent 96ab083 commit ab72182

File tree

2 files changed

+16
-36
lines changed

2 files changed

+16
-36
lines changed

llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5256,9 +5256,12 @@ bool AArch64DAGToDAGISel::SelectAllActivePredicate(SDValue N) {
52565256
}
52575257

52585258
bool AArch64DAGToDAGISel::SelectSMETileSlice(SDValue N, unsigned Scale,
5259-
SDValue &Vector, SDValue &Offset) {
5260-
if (N.getOpcode() != ISD::ADD)
5261-
return false;
5259+
SDValue &Base, SDValue &Offset) {
5260+
if (N.getOpcode() != ISD::ADD) {
5261+
Base = N;
5262+
Offset = CurDAG->getTargetConstant(0, SDLoc(N), MVT::i64);
5263+
return true;
5264+
}
52625265

52635266
// Process an ADD node.
52645267
const SDValue LHS = N.getOperand(0);
@@ -5271,7 +5274,7 @@ bool AArch64DAGToDAGISel::SelectSMETileSlice(SDValue N, unsigned Scale,
52715274
if (ImmOff < 0 || ImmOff > MaxSize)
52725275
return false;
52735276

5274-
Vector = LHS;
5277+
Base = LHS;
52755278
Offset = CurDAG->getTargetConstant(ImmOff, SDLoc(N), MVT::i64);
52765279
return true;
52775280
}

llvm/lib/Target/AArch64/SMEInstrFormats.td

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,13 @@ multiclass sme_mem_ld_ss_patterns<Instruction Inst, SDPatternOperator Load,
251251
Operand tile_ty, Operand offset_ty,
252252
ComplexPattern addr,
253253
ComplexPattern tileslice> {
254-
// base
254+
// base, tileslice
255255
def : Pat<(Load PPR3bAny:$pg, GPR64sp:$base, tile_ty:$tile,
256-
MatrixIndexGPR32Op12_15:$idx),
257-
(Inst tile_ty:$tile, $idx, 0, $pg, $base, XZR)>;
258-
// reg + reg
259-
let AddedComplexity = 1 in {
260-
def : Pat<(Load PPR3bAny:$pg, (addr GPR64sp:$base, GPR64:$offset),
261-
tile_ty:$tile, MatrixIndexGPR32Op12_15:$idx),
262-
(Inst tile_ty:$tile, $idx, 0, $pg, $base, $offset)>;
263-
}
256+
(i32 (tileslice MatrixIndexGPR32Op12_15:$idx, offset_ty:$imm))),
257+
(Inst tile_ty:$tile, $idx, $imm, $pg, $base, XZR)>;
264258

265-
// base, tileslice
266-
let AddedComplexity = 1 in {
267-
def : Pat<(Load PPR3bAny:$pg, GPR64sp:$base, tile_ty:$tile,
268-
(i32 (tileslice MatrixIndexGPR32Op12_15:$idx, offset_ty:$imm))),
269-
(Inst tile_ty:$tile, $idx, $imm, $pg, $base, XZR)>;
270-
}
271259
// reg + reg, tileslice
272-
let AddedComplexity = 2 in {
260+
let AddedComplexity = 1 in {
273261
def : Pat<(Load PPR3bAny:$pg, (addr GPR64sp:$base, GPR64:$offset),
274262
tile_ty:$tile, (i32 (tileslice MatrixIndexGPR32Op12_15:$idx,
275263
offset_ty:$imm))),
@@ -410,24 +398,13 @@ multiclass sme_mem_st_ss_patterns<Instruction Inst, SDPatternOperator Store,
410398
ComplexPattern imm2tile,
411399
ComplexPattern addr,
412400
ComplexPattern tileslice> {
413-
// base
414-
def : Pat<(Store PPR3bAny:$pg, GPR64sp:$base, (imm2tile untyped:$tile),
415-
MatrixIndexGPR32Op12_15:$idx),
416-
(Inst $tile, $idx, 0, $pg, $base, XZR)>;
417-
// reg + reg
418-
let AddedComplexity = 1 in {
419-
def : Pat<(Store PPR3bAny:$pg, (addr GPR64sp:$base, GPR64:$offset),
420-
(imm2tile untyped:$tile), MatrixIndexGPR32Op12_15:$idx),
421-
(Inst $tile, $idx, 0, $pg, $base, $offset)>;
422-
}
423401
// base, tileslice
424-
let AddedComplexity = 1 in {
425-
def : Pat<(Store PPR3bAny:$pg, GPR64sp:$base, (imm2tile untyped:$tile),
426-
(i32 (tileslice MatrixIndexGPR32Op12_15:$idx, offset_ty:$imm))),
427-
(Inst $tile, $idx, $imm, $pg, $base, XZR)>;
428-
}
402+
def : Pat<(Store PPR3bAny:$pg, GPR64sp:$base, (imm2tile untyped:$tile),
403+
(i32 (tileslice MatrixIndexGPR32Op12_15:$idx, offset_ty:$imm))),
404+
(Inst $tile, $idx, $imm, $pg, $base, XZR)>;
405+
429406
// reg + reg, tileslice
430-
let AddedComplexity = 2 in {
407+
let AddedComplexity = 1 in {
431408
def : Pat<(Store PPR3bAny:$pg, (addr GPR64sp:$base, GPR64:$offset),
432409
(imm2tile untyped:$tile),
433410
(i32 (tileslice MatrixIndexGPR32Op12_15:$idx, offset_ty:$imm))),

0 commit comments

Comments
 (0)