Query in SQL function still not schema-safe; add a couple
[PostgreSQL.git] / src / backend / port / tas / sunstudio_sparc.s
blob28c76c3c5b953708791a4b106d551065823e11e9
1 !-------------------------------------------------------------------------
3 ! sunstudio_sparc.s
4 ! compare and swap for Sun Studio on Sparc
6 ! Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 ! Portions Copyright (c) 1994, Regents of the University of California
9 ! IDENTIFICATION
10 ! $PostgreSQL$
12 !-------------------------------------------------------------------------
14 ! Fortunately the Sun compiler can process cpp conditionals with -P
16 ! '/' is the comment for x86, while '!' is the comment for Sparc
18 #if defined(__sparcv9) || defined(__sparc)
20 .section ".text"
21 .align 8
22 .skip 24
23 .align 4
25 .global pg_atomic_cas
26 pg_atomic_cas:
28 ! "cas" only works on sparcv9 and sparcv8plus chips, and
29 ! requies a compiler targeting these CPUs. It will fail
30 ! on a compiler targeting sparcv8, and of course will not
31 ! be understood by a sparcv8 CPU. gcc continues to use
32 ! "ldstub" because it targets sparcv7.
34 ! There is actually a trick for embedding "cas" in a
35 ! sparcv8-targeted compiler, but it can only be run
36 ! on a sparcv8plus/v9 cpus:
38 ! http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libc/sparc/threads/sparc.il
41 #if defined(__sparcv9) || defined(__sparcv8plus)
42 cas [%o0],%o2,%o1
43 #else
44 ldstub [%o0],%o1
45 #endif
46 mov %o1,%o0
47 retl
48 nop
49 .type pg_atomic_cas,2
50 .size pg_atomic_cas,(.-pg_atomic_cas)
51 #endif