OSDN Git Service

Support for Sun Studio compiler on Linux
[pg-rex/syncrep.git] / src / backend / port / tas / sunstudio_x86.s
1 /-------------------------------------------------------------------------
2 /
3 / sunstudio_x86.s
4 /         compare and swap for Sun Studio on x86
5 /
6 / Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
7 / Portions Copyright (c) 1994, Regents of the University of California
8 /
9 / IDENTIFICATION
10 /         $PostgreSQL: pgsql/src/backend/port/tas/sunstudio_x86.s,v 1.1 2008/10/29 16:06:47 petere Exp $
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
30 pg_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