[llvm-dev] New atomic functions on Sparc
James Y Knight via llvm-dev
llvm-dev at lists.llvm.org
Fri Apr 1 09:47:59 PDT 2016
I assume you're compiling for sparcv9? Atomics of sizes != 4 or 8 bytes are
just completely busted at the moment. This is on my list of things to fix
in the near future.
On Fri, Apr 1, 2016 at 12:41 PM, Chris.Dewhurst via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> I'm not quite sure I understand what's happening here, but the following
> test (which derives from GCC tests) isn't working for Sparc. Could anyone
> explain what's happening and, if possible where the fix might lie in the
> new atomics code for Sparc? I'm not too sure what to do with this right
> now. I'll open a bug if this turns out to be a genuine bug, but right now,
> I'm not sure it is.
>
> The code aborts on the test, which is a failure.
>
> #include <stdio.h>
> extern void abort(void);
>
> char v = 0;
> char expected = 0;
> char max = ~0;
>
> #define STRONG 0
>
> int main ()
> {
> __atomic_compare_exchange_n (&v, &expected, max, STRONG ,
> __ATOMIC_RELAXED, __ATOMIC_RELAXED);
> __atomic_compare_exchange_n (&v, &expected, 0, STRONG ,
> __ATOMIC_ACQUIRE, __ATOMIC_RELAXED);
> if (!__atomic_compare_exchange_n (&v, &expected, 0, STRONG ,
> __ATOMIC_RELEASE, __ATOMIC_ACQUIRE))
> {
> printf ("Error: Values for v=%d, expected=%d\n", (int) v, (int)
> expected);
> abort ();
> }
>
> return 0;
> }
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160401/ee4f29fa/attachment.html>
More information about the llvm-dev
mailing list