summaryrefslogtreecommitdiffstats
path: root/src/backend/port/tas/sunstudio_x86.s
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:46:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:46:48 +0000
commit311bcfc6b3acdd6fd152798c7f287ddf74fa2a98 (patch)
tree0ec307299b1dada3701e42f4ca6eda57d708261e /src/backend/port/tas/sunstudio_x86.s
parentInitial commit. (diff)
downloadpostgresql-15-upstream.tar.xz
postgresql-15-upstream.zip
Adding upstream version 15.4.upstream/15.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/backend/port/tas/sunstudio_x86.s')
-rw-r--r--src/backend/port/tas/sunstudio_x86.s43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/backend/port/tas/sunstudio_x86.s b/src/backend/port/tas/sunstudio_x86.s
new file mode 100644
index 0000000..808b207
--- /dev/null
+++ b/src/backend/port/tas/sunstudio_x86.s
@@ -0,0 +1,43 @@
+/-------------------------------------------------------------------------
+/
+/ sunstudio_x86.s
+/ compare and swap for Sun Studio on x86
+/
+/ Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
+/ Portions Copyright (c) 1994, Regents of the University of California
+/
+/ IDENTIFICATION
+/ src/backend/port/tas/sunstudio_x86.s
+/
+/-------------------------------------------------------------------------
+
+/ Fortunately the Sun compiler can process cpp conditionals with -P
+
+/ '/' is the comment for x86, while '!' is the comment for Sparc
+
+ .file "tas.s"
+
+#if defined(__amd64)
+ .code64
+#endif
+
+ .globl pg_atomic_cas
+ .type pg_atomic_cas, @function
+
+ .section .text, "ax"
+ .align 16
+
+pg_atomic_cas:
+#if defined(__amd64)
+ movl %edx,%eax
+ lock
+ cmpxchgl %esi,(%rdi)
+#else
+ movl 4(%esp), %edx
+ movl 8(%esp), %ecx
+ movl 12(%esp), %eax
+ lock
+ cmpxchgl %ecx, (%edx)
+#endif
+ ret
+ .size pg_atomic_cas, . - pg_atomic_cas