https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78037
--- Comment #15 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Jakub Jelinek from comment #14) > (In reply to Uroš Bizjak from comment #9) > > Created attachment 39845 [details] > > Patch that introduces new builtins with UNSPEC_LZCNT and UNSPEC_TZCNT RTX > > patterns > > Instead of UNSPEC, wouldn't it be better to model exactly what it does in > RTL, i.e. op ? C[TL]Z (op) : <const> ? That way RTL optimizers could fold > it. > Of course folding it in gimple_fold target hook would be useful too. The problem is that we have no way to macroize (const_int {16,32,64}) in the pattern, and it would cause pattern explosion by writing out all define_insn RTXes. So, I'd rather stay with UNSPEC and do constant folding in ix86_fold_builtin.