HomePhabricator

[MIPS GlobalISel] Select count trailing zeros

Authored by Petar.Avramovic on Jan 27 2020, 12:51 AM.

Description

[MIPS GlobalISel] Select count trailing zeros

llvm.cttz.<type> intrinsic has additional i1 argument is_zero_undef,
it tells whether zero as the first argument produces a defined result.
G_CTTZ is generated from llvm.cttz.<type> (<type> <src>, i1 false)
intrinsics, clang generates these intrinsics from builtin_ctz and
builtin_ctzll.
G_CTTZ_ZERO_UNDEF comes from llvm.cttz.<type> (<type> <src>, i1 true).
Clang generates such intrinsics as parts of expansion of builtin_ffs
and builtin_ffsll. It is also traditionally part of and many
algorithms that are now predicated on avoiding zero-value inputs.

Add narrow scalar (algorithm uses G_CTTZ_ZERO_UNDEF) for G_CTTZ.
Lower G_CTTZ and G_CTTZ_ZERO_UNDEF for MIPS32.

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

Details

Committed
Petar.AvramovicJan 27 2020, 12:51 AM
Differential Revision
D73215: [MIPS GlobalISel] Select count trailing zeros
Parents
rG2b66d32f3f4c: [MIPS GlobalISel] Select count leading zeros
Branches
Unknown
Tags
Unknown