Merge pull request #10705 from kjbracey-arm/atomic_thumb1

Atomics: GCC fix for M23 (ARMv8-M baseline)
pull/10776/head
Martin Kojtal 2019-06-09 18:08:50 +01:00 committed by GitHub
commit 1e61f53544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,3 @@
/* /*
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
@ -109,6 +108,7 @@ extern "C" {
#elif defined __clang__ || defined __GNUC__ #elif defined __clang__ || defined __GNUC__
#define DO_MBED_LOCKFREE_EXCHG_ASM(M) \ #define DO_MBED_LOCKFREE_EXCHG_ASM(M) \
__asm volatile ( \ __asm volatile ( \
".syntax unified\n\t" \
"LDREX"#M "\t%[oldValue], %[value]\n\t" \ "LDREX"#M "\t%[oldValue], %[value]\n\t" \
"STREX"#M "\t%[fail], %[newValue], %[value]\n\t" \ "STREX"#M "\t%[fail], %[newValue], %[value]\n\t" \
: [oldValue] "=&r" (oldValue), \ : [oldValue] "=&r" (oldValue), \
@ -141,6 +141,7 @@ extern "C" {
#elif defined __clang__ || defined __GNUC__ #elif defined __clang__ || defined __GNUC__
#define DO_MBED_LOCKFREE_3OP_ASM(OP, Constants, M) \ #define DO_MBED_LOCKFREE_3OP_ASM(OP, Constants, M) \
__asm volatile ( \ __asm volatile ( \
".syntax unified\n\t" \
"LDREX"#M "\t%[oldValue], %[value]\n\t" \ "LDREX"#M "\t%[oldValue], %[value]\n\t" \
#OP "\t%[newValue], %[oldValue], %[arg]\n\t" \ #OP "\t%[newValue], %[oldValue], %[arg]\n\t" \
"STREX"#M "\t%[fail], %[newValue], %[value]\n\t" \ "STREX"#M "\t%[fail], %[newValue], %[value]\n\t" \
@ -181,6 +182,7 @@ extern "C" {
#elif defined __clang__ || defined __GNUC__ #elif defined __clang__ || defined __GNUC__
#define DO_MBED_LOCKFREE_2OP_ASM(OP, Constants, M) \ #define DO_MBED_LOCKFREE_2OP_ASM(OP, Constants, M) \
__asm volatile ( \ __asm volatile ( \
".syntax unified\n\t" \
"LDREX"#M "\t%[oldValue], %[value]\n\t" \ "LDREX"#M "\t%[oldValue], %[value]\n\t" \
"MOV" "\t%[newValue], %[oldValue]\n\t" \ "MOV" "\t%[newValue], %[oldValue]\n\t" \
#OP "\t%[newValue], %[arg]\n\t" \ #OP "\t%[newValue], %[arg]\n\t" \
@ -224,6 +226,7 @@ extern "C" {
#elif defined __clang__ || defined __GNUC__ #elif defined __clang__ || defined __GNUC__
#define DO_MBED_LOCKFREE_CAS_WEAK_ASM(M) \ #define DO_MBED_LOCKFREE_CAS_WEAK_ASM(M) \
__asm volatile ( \ __asm volatile ( \
".syntax unified\n\t" \
"LDREX"#M "\t%[oldValue], %[value]\n\t" \ "LDREX"#M "\t%[oldValue], %[value]\n\t" \
"SUBS" "\t%[fail], %[oldValue], %[expectedValue]\n\t"\ "SUBS" "\t%[fail], %[oldValue], %[expectedValue]\n\t"\
"STREX"#M"EQ\t%[fail], %[desiredValue], %[value]\n\t" \ "STREX"#M"EQ\t%[fail], %[desiredValue], %[value]\n\t" \
@ -261,6 +264,7 @@ done: \
#elif defined __clang__ || defined __GNUC__ #elif defined __clang__ || defined __GNUC__
#define DO_MBED_LOCKFREE_CAS_WEAK_ASM(M) \ #define DO_MBED_LOCKFREE_CAS_WEAK_ASM(M) \
__asm volatile ( \ __asm volatile ( \
".syntax unified\n\t" \
"LDREX"#M "\t%[oldValue], %[value]\n\t" \ "LDREX"#M "\t%[oldValue], %[value]\n\t" \
"SUBS" "\t%[fail], %[oldValue], %[expectedValue]\n\t"\ "SUBS" "\t%[fail], %[oldValue], %[expectedValue]\n\t"\
"BNE" "\t%=f\n\t" \ "BNE" "\t%=f\n\t" \
@ -311,6 +315,7 @@ done: \
#elif defined __clang__ || defined __GNUC__ #elif defined __clang__ || defined __GNUC__
#define DO_MBED_LOCKFREE_CAS_STRONG_ASM(M) \ #define DO_MBED_LOCKFREE_CAS_STRONG_ASM(M) \
__asm volatile ( \ __asm volatile ( \
".syntax unified\n\t" \
"\n%=:\n\t" \ "\n%=:\n\t" \
"LDREX"#M "\t%[oldValue], %[value]\n\t" \ "LDREX"#M "\t%[oldValue], %[value]\n\t" \
"SUBS" "\t%[fail], %[oldValue], %[expectedValue]\n\t"\ "SUBS" "\t%[fail], %[oldValue], %[expectedValue]\n\t"\