1/-------------------------------------------------------------------------
2/
3/ sunstudio_x86.s
4/	  compare and swap for Sun Studio on x86
5/
6/ Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7/ Portions Copyright (c) 1994, Regents of the University of California
8/
9/ IDENTIFICATION
10/	  src/backend/port/tas/sunstudio_x86.s
11/
12/-------------------------------------------------------------------------
13
14/ Fortunately the Sun compiler can process cpp conditionals with -P
15
16/ '/' is the comment for x86, while '!' is the comment for Sparc
17
18	.file   "tas.s"
19
20#if defined(__amd64)
21	.code64
22#endif
23
24	.globl pg_atomic_cas
25	.type pg_atomic_cas, @function
26
27	.section .text, "ax"
28	.align 16
29
30pg_atomic_cas:
31#if defined(__amd64)
32	movl       %edx,%eax
33	lock
34	cmpxchgl   %esi,(%rdi)
35#else
36	movl    4(%esp), %edx
37	movl    8(%esp), %ecx
38	movl    12(%esp), %eax
39	lock
40	cmpxchgl %ecx, (%edx)
41#endif
42	ret
43	.size pg_atomic_cas, . - pg_atomic_cas
44