> /usr/local/linare-gcc-5.2/bin/gcc -S -O3 -march=armv8-a+lse test.c
>
> add_int:
>         ldaddal w0, w0, [x1]
>         add     w2, w0, w0
>         mov     w0, w2
>         ret

Am I going mad, or does this just return the contents of the memory
location * 2.

ldaddal w0, w0, [x1]

Returns the original contents of [x1] in w0.

add w2, w0, w0

doubles it.

mov w0, w2

returns it.

I think __sync_add_and_fetch should return the updated contents.

Here is the test C code again.

int add_int(int add_value, int *dest)
{
  return __sync_add_and_fetch(dest, add_value);
}

Regards,
Ed.
_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to