[all-commits] [llvm/llvm-project] 2b66d3: [MIPS GlobalISel] Select count leading zeros

petar-avramovic via All-commits all-commits at lists.llvm.org
Mon Jan 27 00:44:53 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b66d32f3f4c4ef144e0835029e3ddd071b6ed5a
      https://github.com/llvm/llvm-project/commit/2b66d32f3f4c4ef144e0835029e3ddd071b6ed5a
  Author: Petar Avramovic <Petar.Avramovic at rt-rk.com>
  Date:   2020-01-27 (Mon, 27 Jan 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
    M llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
    M llvm/lib/Target/Mips/MipsLegalizerInfo.cpp
    M llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp
    A llvm/test/CodeGen/Mips/GlobalISel/instruction-select/ctlz.mir
    A llvm/test/CodeGen/Mips/GlobalISel/legalizer/ctlz.mir
    A llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/ctlz.ll
    A llvm/test/CodeGen/Mips/GlobalISel/regbankselect/ctlz.mir

  Log Message:
  -----------
  [MIPS GlobalISel] Select count leading zeros

llvm.ctlz.<type> intrinsic has additional i1 argument is_zero_undef,
it tells whether zero as the first argument produces a defined result.
MIPS clz instruction returns 32 for zero input.
G_CTLZ is generated from llvm.ctlz.<type> (<type> <src>, i1 false)
intrinsics, clang generates these intrinsics from __builtin_clz and
__builtin_clzll.
G_CTLZ_ZERO_UNDEF can also be generated from llvm.ctlz with true as
second argument. It is also traditionally part of and many algorithms
that are now predicated on avoiding zero-value inputs.

Add narrow scalar for G_CTLZ (algorithm uses G_CTLZ_ZERO_UNDEF).
Lower G_CTLZ_ZERO_UNDEF and select G_CTLZ for MIPS32.

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




More information about the All-commits mailing list