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/49244] __sync or __atomic builtins will not emit 'lock bts/btr/btc'


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49244

--- Comment #18 from dhowells at redhat dot com <dhowells at redhat dot com> ---
(In reply to Paolo Bonzini from comment #16)
> > This also suggests there's an error in the current x86_64 kernel implementation 
> > as the kernel bitops are supposed to operate on machine word-size locations, so 
> > it should be using BTSQ not BTSL
> 
> Why?  Since bts adjust the memory address according to the bit number, btsl
> and btsq are entirely the same instruction.

Actually, no.  BTSL takes a 32-bit bit number, whereas BTSQ takes a 64-bit bit
number if I read the manual correctly.

So, since test_and_set_bit() in the kernel takes a long bit number, BTSQ is the
right thing to use.

In practice, I don't imagine this is likely to be a real problem.  I don't
envision it as being likely that we will ever have a contiguous bitmap with
>=2^31 bits in it.

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