[Bug target/95529] Failure to reuse flags generated by TZCNT for cmovcc on BMI-capable targets

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 4 11:54:50 GMT 2020


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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-06-04
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(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?

(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.)


More information about the Gcc-bugs mailing list