[PATCH] x86: use 'rep bsf' syntax when assembler supports it

Roland McGrath mcgrathr@google.com
Fri Jun 22 20:47:00 GMT 2012


On Fri, Jun 22, 2012 at 11:57 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Please do not introduce new macro, just use #ifdef
> HAVE_AS_IX86_REP_BSFBSR directly in i386.md.

Would you want the same #ifdef in two places if I extend this to handle
'rep ret' too, or would a macro then be preferable?

To me, the macro is nicer because it avoids the temptation to repeat
nontrivial bits on both sides of an #ifdef, as your example does.

> OK for mainline SVN with this change.

I'm not a GCC committer.

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

I noticed that but ignored it because the variant target I'm working on
avoids that case anyway (for unrelated reasons).  I haven't extended the
assembler to handle 'rep ret', but it would be trivial to do so and I think
it would make sense to do that and then make GCC emit 'rep ret' when
supported too, just on general principles.  I'll see if I can make the
assembler change today and follow up with a new version of this patch
that handles the 'ret' case too.


Thanks,
Roland



More information about the Gcc-patches mailing list