[PATCH] D74111: [LegalizeDAG][X86][AMDGPU] Use ANY_EXTEND instead of ZERO_EXTEND when promoting ISD::CTTZ/CTTZ_ZERO_UNDEF.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 00:12:20 PST 2020


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, efriedma, arsenm.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.

For CTTZ we place a set bit just past where the non-promoted type
stopped so the extended bits won't be used for the count. For
CTTZ_ZERO_UNDEF we don't care what happens if no bits are set in
the original type and we end up counting into the extended bits.
So we can just use ANY_EXTEND for both cases.

This matches what is done in type legalization for these operations.
We make no effort to force the upper bits to zero.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74111

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  llvm/test/CodeGen/AMDGPU/cttz_zero_undef.ll
  llvm/test/CodeGen/X86/clz.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74111.242815.patch
Type: text/x-patch
Size: 4458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200206/8b8eb274/attachment-0001.bin>


More information about the llvm-commits mailing list