Skip to content

Commit 05cf492

Browse files
committed
fixup! [AArch64][GlobalISel] Legalize G_VECREDUCE_{MIN/MAX}
1 parent dcc506b commit 05cf492

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ def : GINodeEquiv<G_VECREDUCE_FMAX, vecreduce_fmax>;
173173
def : GINodeEquiv<G_VECREDUCE_FMIN, vecreduce_fmin>;
174174
def : GINodeEquiv<G_VECREDUCE_FMAXIMUM, vecreduce_fmaximum>;
175175
def : GINodeEquiv<G_VECREDUCE_FMINIMUM, vecreduce_fminimum>;
176+
def : GINodeEquiv<G_VECREDUCE_UMIN, vecreduce_umin>;
177+
def : GINodeEquiv<G_VECREDUCE_UMAX, vecreduce_umax>;
178+
def : GINodeEquiv<G_VECREDUCE_SMIN, vecreduce_smin>;
179+
def : GINodeEquiv<G_VECREDUCE_SMAX, vecreduce_smax>;
176180

177181
def : GINodeEquiv<G_STRICT_FADD, strict_fadd>;
178182
def : GINodeEquiv<G_STRICT_FSUB, strict_fsub>;

llvm/lib/Target/AArch64/AArch64InstrGISel.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,6 @@ def : GINodeEquiv<G_EXTRACT_VECTOR_ELT, vector_extract>;
274274

275275
def : GINodeEquiv<G_PREFETCH, AArch64Prefetch>;
276276

277-
def : GINodeEquiv<G_VECREDUCE_UMIN, vecreduce_umin>;
278-
def : GINodeEquiv<G_VECREDUCE_UMAX, vecreduce_umax>;
279-
def : GINodeEquiv<G_VECREDUCE_SMIN, vecreduce_smin>;
280-
def : GINodeEquiv<G_VECREDUCE_SMAX, vecreduce_smax>;
281-
282277
// These are patterns that we only use for GlobalISel via the importer.
283278
def : Pat<(f32 (fadd (vector_extract (v2f32 FPR64:$Rn), (i64 0)),
284279
(vector_extract (v2f32 FPR64:$Rn), (i64 1)))),

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6702,9 +6702,10 @@ defm : SIMDAcrossLanesUnsignedIntrinsic<"UMINV", AArch64uminv>;
67026702
def : Pat<(v2i32 (AArch64uminv (v2i32 V64:$Rn))),
67036703
(UMINPv2i32 V64:$Rn, V64:$Rn)>;
67046704

6705-
// For vecreduce_{opc}
6705+
// For vecreduce_{opc} used by GlobalISel, not SDAG at the moment
6706+
// because GlobalISel allows us to specify the return register to be a FPR
67066707
multiclass SIMDAcrossLanesVecReductionIntrinsic<string baseOpc,
6707-
SDPatternOperator opNode> {
6708+
SDPatternOperator opNode> {
67086709
def : Pat<(i8 (opNode (v8i8 FPR64:$Rn))),
67096710
(!cast<Instruction>(!strconcat(baseOpc, "v8i8v")) FPR64:$Rn)>;
67106711

@@ -6719,9 +6720,9 @@ def : Pat<(i16 (opNode (v8i16 FPR128:$Rn))),
67196720

67206721
def : Pat<(i32 (opNode (v4i32 V128:$Rn))),
67216722
(!cast<Instruction>(!strconcat(baseOpc, "v4i32v")) V128:$Rn)>;
6722-
67236723
}
67246724

6725+
// For v2i32 source type, the pairwise instruction can be used instead
67256726
defm : SIMDAcrossLanesVecReductionIntrinsic<"UMINV", vecreduce_umin>;
67266727
def : Pat<(i32 (vecreduce_umin (v2i32 V64:$Rn))),
67276728
(i32 (EXTRACT_SUBREG (UMINPv2i32 V64:$Rn, V64:$Rn), ssub))>;

0 commit comments

Comments
 (0)