This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/29776] result of ffs/clz/ctz/popcount/parity are already sign-extended
- From: "dean at arctic dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 04 Jul 2013 18:03:47 +0000
- Subject: [Bug target/29776] result of ffs/clz/ctz/popcount/parity are already sign-extended
- Auto-submitted: auto-generated
- References: <bug-29776-4 at http dot gcc dot gnu dot org/bugzilla/>
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