Hello!

> The GNU assembler now (just as of today) accepts 'rep bsf ...' or 'rep bsr 
> ...'
> syntax.  It's always better to put a prefix on the instruction itself
> rather than to write 'rep; ...'.  This changes 'rep; bsf ...' to 'rep bsf ...'
> when the assembler accepts the latter.

> 2012-06-22  Roland McGrath  <mcgra...@google.com>
>
>       * configure.ac (HAVE_AS_IX86_REP_BSFBSR): New test.
>       * configure: Regenerate.
>       * config.in: Regenerate.
>       * config/i386/i386.h (REP_BEFORE_BSF): New macro.
>       * config/i386/i386.md (ctz<mode>2): Use it.

Please do not introduce new macro, just use #ifdef
HAVE_AS_IX86_REP_BSFBSR directly in i386.md.

  else if (TARGET_GENERIC)
    /* tzcnt expands to rep;bsf and we can use it even if !TARGET_BMI.  */
#ifdef HAVE_AS_IX86_REP_BSFBSR
    return "rep bsf{<imodesuffix>}\t{%1, %0|%0, %1}";
#else
    return "rep; bsf{<imodesuffix>}\t{%1, %0|%0, %1}";
#endif

OK for mainline SVN with this change.

On a related note, gcc is also emitting "rep; ret". Do we need the
same treatment here too?

Thanks,
Uros.

Reply via email to