Yes, you're on the right track. The ldar (load-acquire) and stlr (store-release) instructions in ARMv8 are special load and store instructions that provide synchronization and ordering guarantees, essentially combining the memory access with a memory fence. These instructions are particularly useful for implementing lock-free data structures and synchronization primitives in concurrent programming.
The ldar instruction ensures that any subsequent memory access in the program order will happen after the load-acquire operation, providing an acquire memory fence. Similarly, the stlr instruction ensures that any preceding memory access in the program order will happen before the store-release operation, providing a release memory fence.
The benefit of the CPU "knowing" which memory address is being load-acquired or store-released is that it can enforce the necessary ordering constraints on memory accesses and provide the required synchronization guarantees. By combining the memory access with a memory fence, these instructions can be more efficient than performing separate memory access and memory fence instructions. The CPU can optimize memory access and cache coherence protocols based on the specific synchronization requirements of the ldar and stlr instructions.
In summary, ldar and stlr in ARMv8 are designed to provide efficient synchronization and ordering guarantees when implementing lock-free and concurrent algorithms. They combine memory access with memory fence functionality, allowing the CPU to optimize memory operations and ensure correct program behavior.