https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95529

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #4)
> (In reply to Gabriel Ravier from comment #2)
> > If using `-mbmi`, shouldn't GCC be able to assume the target is, in fact, a
> > BMI-capable CPU ? I understand that this bug report may be invalid for `bsf`
> > (which would mean Clang has invalid behaviour, which seems odd but ok), but
> > should I reopen this report/make a new report for `-mbmi` ?
> 
> We can do a peephole that would convert REP BSF + TEST to BSF. However, on
> BMI capable targets, REP BSF decodes as TZCNT, so the question is if one BSF
> is faster than TZCNT + TEST?

I would expect so, yes.  With -mbmi and TZCNT we could also use the carry
flag to elide the test.

> (Please note that the conversion to CMOVE comes a bit late in the pass
> sequence, so we can't convert TZCNT + TEST + CMOVE to TZCNT + CMOVC.)

Reply via email to