This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/50705] Wrong assembly generated for bitwise AND for ppc 476
- From: "santoshkumar.a at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 14 Oct 2011 16:26:38 +0000
- Subject: [Bug target/50705] Wrong assembly generated for bitwise AND for ppc 476
- Auto-submitted: auto-generated
- References: <bug-50705-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50705
--- Comment #9 from SK <santoshkumar.a at gmail dot com> 2011-10-14 16:26:38 UTC ---
Below is another scenario::
test_bit called with args
PG_slab = 7;
page->flags = 0xc0;
test_bit(PG_slab, &page->flags) returns value 0. This is used by PageSlab in
linux kernel.
/**
* test_bit - Determine whether a bit is set
* @nr: bit number to test
* @addr: Address to start counting from
*/
static inline int test_bit(int nr, const volatile unsigned long *addr)
{
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
}
but if i modify the return as
return (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
the results are as expected, which i dont understand.
Also in all the scenarios that i reported earlier the bitwise AND is in between
a variable and a constants.