[riot-notifications] [RIOT-OS/RIOT] sys/atomic_utils: Functions for atomic access (#14331)
notifications at github.com
Tue Nov 3 14:23:36 CET 2020
> Looking at the assembly, it doesn't look like any atomic operation is called.
For the atomic utils this is expected: Currently only the loads and stores up to the word size are provided by the platform specific implementation - and those should be regular loads and stores followed by (depending on platform) a data sync instruction. All other implementations rely on disabling IRQs during the read-modify-write sequence. (So there is still potential to optimize those operations for more capable MCUs, but that could be better done as follow up.)
The data sync might already be the explanation for why the time doesn't really increase as expected with bit size - I wouldn't be surprised if that is the major contributor to the time spent and the difference between the e.g. 32 bit and 64 bit is almost noise compared to that.
> Should it be optimized out in this case?
That would be a bug. The problem is that the compiler has absolutely no idea about concurrency, and thus has no chance to correctly detect when the atomically of atomic operations is not really needed. As a result, the compiler must not optimize the atomic accesses at all, otherwise it would also do so when this would actually be needed.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications