From 90b43856fdff7d96d93d22970eca8a86c56e0ddc Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 3 Aug 2020 22:55:28 +0200 Subject: aarch64: Fix up __aarch64_cas16_acq_rel fallback As mentioned in the PR, the fallback path when LSE is unavailable writes incorrect registers to the memory if the previous content compares equal to x0, x1 - it writes copy of x0, x1 from the start of function, but it should write x2, x3. 2020-08-03 Jakub Jelinek PR target/96402 * config/aarch64/lse.S (__aarch64_cas16_acq_rel): Use x2, x3 instead of x(tmp0), x(tmp1) in STXP arguments. * gcc.target/aarch64/pr96402.c: New test. --- gcc/testsuite/gcc.target/aarch64/pr96402.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96402.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/aarch64/pr96402.c b/gcc/testsuite/gcc.target/aarch64/pr96402.c new file mode 100644 index 0000000..fa2dddf --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr96402.c @@ -0,0 +1,16 @@ +/* PR target/96402 */ +/* { dg-do run { target int128 } } */ +/* { dg-options "-moutline-atomics" } */ + +int +main () +{ + __int128 a = 0; + __sync_val_compare_and_swap (&a, (__int128) 0, (__int128) 1); + if (a != 1) + __builtin_abort (); + __sync_val_compare_and_swap (&a, (__int128) 1, (((__int128) 0xdeadbeeffeedbac1ULL) << 64) | 0xabadcafe00c0ffeeULL); + if (a != ((((__int128) 0xdeadbeeffeedbac1ULL) << 64) | 0xabadcafe00c0ffeeULL)) + __builtin_abort (); + return 0; +} -- cgit v1.1