summaryrefslogtreecommitdiffstats
path: root/vendor/portable-atomic/src/imp/msp430.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/portable-atomic/src/imp/msp430.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/portable-atomic/src/imp/msp430.rs')
-rw-r--r--vendor/portable-atomic/src/imp/msp430.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/vendor/portable-atomic/src/imp/msp430.rs b/vendor/portable-atomic/src/imp/msp430.rs
index 4928549ab..f6990ddee 100644
--- a/vendor/portable-atomic/src/imp/msp430.rs
+++ b/vendor/portable-atomic/src/imp/msp430.rs
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: Apache-2.0 OR MIT
+
// Atomic load/store implementation on MSP430.
//
// Adapted from https://github.com/pftbest/msp430-atomic.
@@ -8,6 +10,8 @@
// See also src/imp/interrupt/msp430.rs.
//
// Note: Ordering is always SeqCst.
+//
+// Refs: https://www.ti.com/lit/ug/slau208q/slau208q.pdf
#[cfg(not(portable_atomic_no_asm))]
use core::arch::asm;
@@ -165,6 +169,7 @@ macro_rules! atomic {
concat!("add", $asm_suffix, " {val}, 0({dst})"),
dst = in(reg) dst,
val = in(reg) val,
+ // Do not use `preserves_flags` because ADD modifies the V, N, Z, and C bits of the status register.
options(nostack),
);
#[cfg(portable_atomic_no_asm)]
@@ -186,6 +191,7 @@ macro_rules! atomic {
concat!("sub", $asm_suffix, " {val}, 0({dst})"),
dst = in(reg) dst,
val = in(reg) val,
+ // Do not use `preserves_flags` because SUB modifies the V, N, Z, and C bits of the status register.
options(nostack),
);
#[cfg(portable_atomic_no_asm)]
@@ -207,6 +213,7 @@ macro_rules! atomic {
concat!("and", $asm_suffix, " {val}, 0({dst})"),
dst = in(reg) dst,
val = in(reg) val,
+ // Do not use `preserves_flags` because AND modifies the V, N, Z, and C bits of the status register.
options(nostack),
);
#[cfg(portable_atomic_no_asm)]
@@ -228,7 +235,7 @@ macro_rules! atomic {
concat!("bis", $asm_suffix, " {val}, 0({dst})"),
dst = in(reg) dst,
val = in(reg) val,
- options(nostack),
+ options(nostack, preserves_flags),
);
#[cfg(portable_atomic_no_asm)]
llvm_asm!(
@@ -249,6 +256,7 @@ macro_rules! atomic {
concat!("xor", $asm_suffix, " {val}, 0({dst})"),
dst = in(reg) dst,
val = in(reg) val,
+ // Do not use `preserves_flags` because XOR modifies the V, N, Z, and C bits of the status register.
options(nostack),
);
#[cfg(portable_atomic_no_asm)]
@@ -269,6 +277,7 @@ macro_rules! atomic {
asm!(
concat!("inv", $asm_suffix, " 0({dst})"),
dst = in(reg) dst,
+ // Do not use `preserves_flags` because INV modifies the V, N, Z, and C bits of the status register.
options(nostack),
);
#[cfg(portable_atomic_no_asm)]