Skip to content

Commit e1e2d3f

Browse files
committed
Fix: seperated legalIf for G_CTTZ_ZERO_UNDEF and G_ANYEXT
1 parent b9127bf commit e1e2d3f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
267267
getActionDefinitionsBuilder({G_CTTZ_ZERO_UNDEF, G_CTTZ})
268268
.legalIf([=](const LegalityQuery &Query) -> bool {
269269
return (Query.Opcode == G_CTTZ_ZERO_UNDEF || Subtarget.hasBMI()) &&
270-
(typePairInSet(0, 1, {{s16, s16}, {s32, s32}})(Query) ||
271-
(Is64Bit && typePairInSet(0, 1, {{s64, s64}})(Query)));
270+
(typePairInSet(0, 1, {{s16, s16}, {s32, s32}})(Query));
272271
})
272+
.legalFor(Is64Bit, {{s64, s64}})
273273
.widenScalarToNextPow2(1, /*Min=*/16)
274274
.clampScalar(1, s16, sMaxScalar)
275275
.scalarSameSizeAs(0, 1);
@@ -380,10 +380,10 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
380380

381381
// sext, zext, and anyext
382382
getActionDefinitionsBuilder({G_SEXT, G_ZEXT, G_ANYEXT})
383+
.legalFor({s8, s16, s32})
384+
.legalFor(Is64Bit, {s64})
383385
.legalIf([=](const LegalityQuery &Query) {
384-
return typeInSet(0, {s8, s16, s32})(Query) ||
385-
(Query.Opcode == G_ANYEXT && Query.Types[0] == s128) ||
386-
(Is64Bit && Query.Types[0] == s64);
386+
return Query.Opcode == G_ANYEXT && Query.Types[0] == s128;
387387
})
388388
.widenScalarToNextPow2(0, /*Min=*/8)
389389
.clampScalar(0, s8, sMaxScalar)

0 commit comments

Comments
 (0)