diff options
Diffstat (limited to '')
-rwxr-xr-x | scripts/atomic/fallbacks/inc | 3 | ||||
-rwxr-xr-x | scripts/atomic/fallbacks/inc_and_test | 3 | ||||
-rwxr-xr-x | scripts/atomic/fallbacks/inc_not_zero | 3 | ||||
-rwxr-xr-x | scripts/atomic/fallbacks/inc_unless_negative | 10 |
4 files changed, 19 insertions, 0 deletions
diff --git a/scripts/atomic/fallbacks/inc b/scripts/atomic/fallbacks/inc new file mode 100755 index 0000000000..56c770f591 --- /dev/null +++ b/scripts/atomic/fallbacks/inc @@ -0,0 +1,3 @@ +cat <<EOF + ${retstmt}raw_${atomic}_${pfx}add${sfx}${order}(1, v); +EOF diff --git a/scripts/atomic/fallbacks/inc_and_test b/scripts/atomic/fallbacks/inc_and_test new file mode 100755 index 0000000000..7d16a10f22 --- /dev/null +++ b/scripts/atomic/fallbacks/inc_and_test @@ -0,0 +1,3 @@ +cat <<EOF + return raw_${atomic}_inc_return(v) == 0; +EOF diff --git a/scripts/atomic/fallbacks/inc_not_zero b/scripts/atomic/fallbacks/inc_not_zero new file mode 100755 index 0000000000..1fcef1e55b --- /dev/null +++ b/scripts/atomic/fallbacks/inc_not_zero @@ -0,0 +1,3 @@ +cat <<EOF + return raw_${atomic}_add_unless(v, 1, 0); +EOF diff --git a/scripts/atomic/fallbacks/inc_unless_negative b/scripts/atomic/fallbacks/inc_unless_negative new file mode 100755 index 0000000000..7b4b098688 --- /dev/null +++ b/scripts/atomic/fallbacks/inc_unless_negative @@ -0,0 +1,10 @@ +cat <<EOF + ${int} c = raw_${atomic}_read(v); + + do { + if (unlikely(c < 0)) + return false; + } while (!raw_${atomic}_try_cmpxchg(v, &c, c + 1)); + + return true; +EOF |