* <atomic.h> and single-byte CAS
@ 2019-07-08 10:54 Florian Weimer
2019-07-08 12:39 ` Andreas Schwab
2019-07-25 15:39 ` Joseph Myers
0 siblings, 2 replies; 6+ messages in thread
From: Florian Weimer @ 2019-07-08 10:54 UTC (permalink / raw)
To: libc-alpha
Our <atomic.h> does not support single-byte CAS. Does anyone know why?
Thanks,
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: <atomic.h> and single-byte CAS
2019-07-08 10:54 <atomic.h> and single-byte CAS Florian Weimer
@ 2019-07-08 12:39 ` Andreas Schwab
2019-07-08 12:42 ` Florian Weimer
2019-07-25 15:39 ` Joseph Myers
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2019-07-08 12:39 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha
On Jul 08 2019, Florian Weimer <fweimer@redhat.com> wrote:
> Our <atomic.h> does not support single-byte CAS. Does anyone know why?
What do you mean with single-byte CAS?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: <atomic.h> and single-byte CAS
2019-07-08 12:39 ` Andreas Schwab
@ 2019-07-08 12:42 ` Florian Weimer
2019-07-08 14:23 ` Andreas Schwab
0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2019-07-08 12:42 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha
* Andreas Schwab:
> On Jul 08 2019, Florian Weimer <fweimer@redhat.com> wrote:
>
>> Our <atomic.h> does not support single-byte CAS. Does anyone know why?
>
> What do you mean with single-byte CAS?
atomic_compare_exchange_weak_relaxed with char * arguments, swapping
individual bytes.
Thanks,
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: <atomic.h> and single-byte CAS
2019-07-08 12:42 ` Florian Weimer
@ 2019-07-08 14:23 ` Andreas Schwab
2019-07-08 14:35 ` Florian Weimer
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2019-07-08 14:23 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha
On Jul 08 2019, Florian Weimer <fweimer@redhat.com> wrote:
> atomic_compare_exchange_weak_relaxed with char * arguments, swapping
> individual bytes.
In which way is it not supported?
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: <atomic.h> and single-byte CAS
2019-07-08 14:23 ` Andreas Schwab
@ 2019-07-08 14:35 ` Florian Weimer
0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2019-07-08 14:35 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha
* Andreas Schwab:
> On Jul 08 2019, Florian Weimer <fweimer@redhat.com> wrote:
>
>> atomic_compare_exchange_weak_relaxed with char * arguments, swapping
>> individual bytes.
>
> In which way is it not supported?
_Bool
test_atomic (char *p, char *q)
{
return atomic_compare_exchange_weak_relaxed (p, q, 1);
}
results in this link-time error on x86-64:
undefined reference to `__atomic_link_error'
This probably comes from this code:
/* We require 32b atomic operations; some archs also support 64b atomic
operations. */
void __atomic_link_error (void);
# if __HAVE_64B_ATOMICS == 1
# define __atomic_check_size(mem) \
if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8)) \
__atomic_link_error ();
# else
# define __atomic_check_size(mem) \
if (sizeof (*mem) != 4) \
__atomic_link_error ();
# endif
Thanks,
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: <atomic.h> and single-byte CAS
2019-07-08 10:54 <atomic.h> and single-byte CAS Florian Weimer
2019-07-08 12:39 ` Andreas Schwab
@ 2019-07-25 15:39 ` Joseph Myers
1 sibling, 0 replies; 6+ messages in thread
From: Joseph Myers @ 2019-07-25 15:39 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha
On Mon, 8 Jul 2019, Florian Weimer wrote:
> Our <atomic.h> does not support single-byte CAS. Does anyone know why?
The obvious reason would be that some architectures don't actually support
it directly, so it has to be implemented there based on word-size CAS, and
the glibc uses of atomics can readily avoid any need for single-byte CAS.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-07-25 15:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 10:54 <atomic.h> and single-byte CAS Florian Weimer
2019-07-08 12:39 ` Andreas Schwab
2019-07-08 12:42 ` Florian Weimer
2019-07-08 14:23 ` Andreas Schwab
2019-07-08 14:35 ` Florian Weimer
2019-07-25 15:39 ` Joseph Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).