Hi all,

the following code compiles into a mov instruction
on x86_64.  I wonder why. The struct has alignment 4,
so a mov might not be atomic if the struct is not
alligned to its full size.  For this reason,
I expected a call to libatomic instead 
(LLVM does this).  What am I missing?

The documentation implies that this should work
for all types.


typedef struct { float re; float im; } yy_t;

yy_t bar2(yy_t* x)
{
        yy_t r;
        __atomic_load(x, &r, __ATOMIC_SEQ_CST);
        return r;
}


https://godbolt.org/z/XcDkG_

Best,
Martin

Reply via email to