Skip to content

Commit 8b8eee5

Browse files
committed
AMDGPU/GlobalISel: Make s16 G_ICMP legal
llvm-svn: 365486
1 parent e509af3 commit 8b8eee5

File tree

2 files changed

+482
-153
lines changed

2 files changed

+482
-153
lines changed

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,16 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
337337

338338
setAction({G_BLOCK_ADDR, CodePtr}, Legal);
339339

340-
getActionDefinitionsBuilder(G_ICMP)
340+
auto &CmpBuilder =
341+
getActionDefinitionsBuilder(G_ICMP)
341342
.legalForCartesianProduct(
342343
{S1}, {S32, S64, GlobalPtr, LocalPtr, ConstantPtr, PrivatePtr, FlatPtr})
343-
.legalFor({{S1, S32}, {S1, S64}})
344+
.legalFor({{S1, S32}, {S1, S64}});
345+
if (ST.has16BitInsts()) {
346+
CmpBuilder.legalFor({{S1, S16}});
347+
}
348+
349+
CmpBuilder
344350
.widenScalarToNextPow2(1)
345351
.clampScalar(1, S32, S64)
346352
.scalarize(0)

0 commit comments

Comments
 (0)