This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/29776] result of ffs/clz/ctz/popcount/parity are already sign-extended


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29776

--- Comment #10 from dean at arctic dot org ---
On Thu, 4 Jul 2013, jakub at gcc dot gnu.org wrote:

> I'm not 100% sure about CLZ/CTZ in the patch, because it could return any value
> for argument of 0, but as we document it as undefined behavior, perhaps it is
> fine.

this is unfortunate really -- the newer LZCNT/TZCNT instructions on x86 
explicitly return 8*sizeof(type) for input of zero because the undefined 
behaviour of BSF/BSR posed a lot of problems in inner loops.  it might be 
useful to add explicit builtins for this behaviour.

thanks for taking a look at the bug :)

-dean


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]