Skip to content

Commit 070c257

Browse files
authored
[AMDGPU] Global ISel for packed fp32 instructions (#65803)
1 parent 33deb28 commit 070c257

File tree

3 files changed

+117
-72
lines changed

3 files changed

+117
-72
lines changed

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,11 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
872872
FDIVActions.customFor({S16});
873873
}
874874

875+
if (ST.hasPackedFP32Ops()) {
876+
FPOpActions.legalFor({V2S32});
877+
FPOpActions.clampMaxNumElementsStrict(0, S32, 2);
878+
}
879+
875880
auto &MinNumMaxNum = getActionDefinitionsBuilder({
876881
G_FMINNUM, G_FMAXNUM, G_FMINNUM_IEEE, G_FMAXNUM_IEEE});
877882

llvm/lib/Target/AMDGPU/SIInstructions.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,6 +2720,13 @@ def : GCNPat<
27202720
(V_MUL_F32_e64 0, (i32 CONST.FP32_NEG_ONE), $src_mods, $src)
27212721
>;
27222722

2723+
let SubtargetPredicate = HasPackedFP32Ops in {
2724+
def : GCNPat<
2725+
(fcanonicalize (v2f32 (VOP3PMods v2f32:$src, i32:$src_mods))),
2726+
(V_PK_MUL_F32 0, CONST.FP32_ONE, $src_mods, $src)
2727+
>;
2728+
}
2729+
27232730
// TODO: Handle fneg like other types.
27242731
def : GCNPat<
27252732
(fcanonicalize (f64 (VOP3Mods f64:$src, i32:$src_mods))),

0 commit comments

Comments
 (0)