[all-commits] [llvm/llvm-project] 2af164: [LegalizeDAG][X86][AMDGPU] Use ANY_EXTEND instead ...

topperc via All-commits all-commits at lists.llvm.org
Fri Feb 7 22:26:48 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2af1640f9aa4ebe5d447586bbdad6514312bb814
      https://github.com/llvm/llvm-project/commit/2af1640f9aa4ebe5d447586bbdad6514312bb814
  Author: Craig Topper <craig.topper at gmail.com>
  Date:   2020-02-07 (Fri, 07 Feb 2020)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    M llvm/test/CodeGen/AMDGPU/cttz_zero_undef.ll
    M llvm/test/CodeGen/X86/clz.ll

  Log Message:
  -----------
  [LegalizeDAG][X86][AMDGPU] Use ANY_EXTEND instead of ZERO_EXTEND when promoting ISD::CTTZ/CTTZ_ZERO_UNDEF.

Summary:
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.

Differential Revision: https://reviews.llvm.org/D74111




More information about the All-commits mailing list