Skip to content

Commit

Permalink
[DPWBS-1375] Adding legality rule for G_CTPOP and the corresponding t…
Browse files Browse the repository at this point in the history
…est cases.
  • Loading branch information
Zoltan Toth committed Mar 5, 2020
1 parent 9510df6 commit 639b464
Show file tree
Hide file tree
Showing 2 changed files with 474 additions and 0 deletions.
10 changes: 10 additions & 0 deletions llvm/lib/Target/TriCore/TriCoreLegalizerInfo.cpp
Expand Up @@ -194,6 +194,16 @@ TriCoreLegalizerInfo::TriCoreLegalizerInfo(const TriCoreSubtarget &ST) {
// G_CTLZ_ZERO_UNDEF produces a defined result, lower it to G_CTLZ
getActionDefinitionsBuilder(G_CTLZ_ZERO_UNDEF).lower();

// G_CTPOP needs to be lowered for TC161 and is legal for TC162 and up
auto &CTPOPActions = getActionDefinitionsBuilder(G_CTPOP)
.clampScalar(0, s32, s32)
.clampScalar(1, s32, s32);

if (ST.hasTC162Ops())
CTPOPActions.legalFor({{s32, s32}});
else
CTPOPActions.lowerFor({{s32, s32}});

// Shifts

// G_SHL, G_LSHR and G_ASHR always produce the same type as their src type
Expand Down

0 comments on commit 639b464

Please sign in to comment.