Skip to content

Commit dd42b0e

Browse files
committed
[AMDGPU] Avoid pack/unpack for G_FSHR
Scalarize G_FSHR only if the subtarget does not support V2S16 type.
1 parent 4e348bf commit dd42b0e

File tree

3 files changed

+575
-1156
lines changed

3 files changed

+575
-1156
lines changed

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,13 +2082,11 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
20822082
.scalarize(0)
20832083
.lower();
20842084

2085-
// TODO: Only Try to form v2s16 with legal packed instructions.
2086-
getActionDefinitionsBuilder(G_FSHR)
2087-
.legalFor({{S32, S32}})
2088-
.lowerFor({{V2S16, V2S16}})
2089-
.clampMaxNumElementsStrict(0, S16, 2)
2090-
.scalarize(0)
2091-
.lower();
2085+
auto &FSHRActionDefs = getActionDefinitionsBuilder(G_FSHR);
2086+
FSHRActionDefs.legalFor({{S32, S32}}).clampMaxNumElementsStrict(0, S16, 2);
2087+
if (ST.hasVOP3PInsts())
2088+
FSHRActionDefs.lowerFor({{V2S16, V2S16}});
2089+
FSHRActionDefs.scalarize(0).lower();
20922090

20932091
if (ST.hasVOP3PInsts()) {
20942092
getActionDefinitionsBuilder(G_FSHL)

0 commit comments

Comments
 (0)