author | jcm |
Mon, 06 Nov 2017 21:28:03 -0800 | |
changeset 47799 | 1772ebf07d1f |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
42579
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
1 |
dnl Copyright (c) 2016, Red Hat Inc. All rights reserved. |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
2 |
dnl DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
3 |
dnl |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
4 |
dnl This code is free software; you can redistribute it and/or modify it |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
5 |
dnl under the terms of the GNU General Public License version 2 only, as |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
6 |
dnl published by the Free Software Foundation. |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
7 |
dnl |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
8 |
dnl This code is distributed in the hope that it will be useful, but WITHOUT |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
9 |
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
10 |
dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
11 |
dnl version 2 for more details (a copy is included in the LICENSE file that |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
12 |
dnl accompanied this code). |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
13 |
dnl |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
14 |
dnl You should have received a copy of the GNU General Public License version |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
15 |
dnl 2 along with this work; if not, write to the Free Software Foundation, |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
16 |
dnl Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
17 |
dnl |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
18 |
dnl Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
19 |
dnl or visit www.oracle.com if you need additional information or have any |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
20 |
dnl questions. |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
21 |
dnl |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
22 |
dnl |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
23 |
dnl Process this file with m4 cas.m4 to generate the CAE and wCAS |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
24 |
dnl instructions used in aarch64.ad. |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
25 |
dnl |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
26 |
|
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
27 |
// BEGIN This section of the file is automatically generated. Do not edit -------------- |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
28 |
|
40049 | 29 |
// Sundry CAS operations. Note that release is always true, |
30 |
// regardless of the memory ordering of the CAS. This is because we |
|
31 |
// need the volatile case to be sequentially consistent but there is |
|
32 |
// no trailing StoreLoad barrier emitted by C2. Unfortunately we |
|
33 |
// can't check the type of memory ordering here, so we always emit a |
|
34 |
// STLXR. |
|
35 |
||
42579
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
36 |
// This section is generated from aarch64_ad_cas.m4 |
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
37 |
|
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
38 |
|
40049 | 39 |
define(`CAS_INSN', |
40 |
` |
|
42579
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
41 |
instruct compareAndExchange$1$5(iReg$2NoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{ |
40049 | 42 |
match(Set res (CompareAndExchange$1 mem (Binary oldval newval))); |
43 |
ifelse($5,Acq,' predicate(needs_acquiring_load_exclusive(n)); |
|
44 |
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) |
|
42579
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
45 |
effect(TEMP_DEF res, KILL cr); |
40049 | 46 |
format %{ |
47 |
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" |
|
48 |
%} |
|
49 |
ins_encode %{ |
|
50 |
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, |
|
51 |
Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true, |
|
52 |
/*weak*/ false, $res$$Register); |
|
53 |
%} |
|
54 |
ins_pipe(pipe_slow); |
|
55 |
%}')dnl |
|
56 |
define(`CAS_INSN4', |
|
57 |
` |
|
42579
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
58 |
instruct compareAndExchange$1$7(iReg$2NoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{ |
40049 | 59 |
match(Set res (CompareAndExchange$1 mem (Binary oldval newval))); |
60 |
ifelse($7,Acq,' predicate(needs_acquiring_load_exclusive(n)); |
|
61 |
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) |
|
42579
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
62 |
effect(TEMP_DEF res, KILL cr); |
40049 | 63 |
format %{ |
64 |
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" |
|
65 |
%} |
|
66 |
ins_encode %{ |
|
67 |
__ $5(rscratch2, $oldval$$Register); |
|
68 |
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register, |
|
69 |
Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true, |
|
70 |
/*weak*/ false, $res$$Register); |
|
71 |
__ $6($res$$Register, $res$$Register); |
|
72 |
%} |
|
73 |
ins_pipe(pipe_slow); |
|
74 |
%}')dnl |
|
75 |
CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw) |
|
76 |
CAS_INSN4(S,I,short,halfword,uxthw,sxthw) |
|
77 |
CAS_INSN(I,I,int,word) |
|
78 |
CAS_INSN(L,L,long,xword) |
|
79 |
CAS_INSN(N,N,narrow oop,word) |
|
80 |
CAS_INSN(P,P,ptr,xword) |
|
81 |
dnl |
|
82 |
dnl CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw,Acq) |
|
83 |
dnl CAS_INSN4(S,I,short,halfword,uxthw,sxthw,Acq) |
|
84 |
dnl CAS_INSN(I,I,int,word,Acq) |
|
85 |
dnl CAS_INSN(L,L,long,xword,Acq) |
|
86 |
dnl CAS_INSN(N,N,narrow oop,word,Acq) |
|
87 |
dnl CAS_INSN(P,P,ptr,xword,Acq) |
|
88 |
dnl |
|
89 |
define(`CAS_INSN2', |
|
90 |
` |
|
91 |
instruct weakCompareAndSwap$1$6(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{ |
|
92 |
match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval))); |
|
93 |
ifelse($6,Acq,' predicate(needs_acquiring_load_exclusive(n)); |
|
94 |
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) |
|
95 |
effect(KILL cr); |
|
96 |
format %{ |
|
97 |
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" |
|
98 |
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" |
|
99 |
%} |
|
100 |
ins_encode %{ |
|
101 |
__ uxt$5(rscratch2, $oldval$$Register); |
|
102 |
__ cmpxchg($mem$$Register, rscratch2, $newval$$Register, |
|
103 |
Assembler::$4, /*acquire*/ ifelse($6,Acq,true,false), /*release*/ true, |
|
104 |
/*weak*/ true, noreg); |
|
105 |
__ csetw($res$$Register, Assembler::EQ); |
|
106 |
%} |
|
107 |
ins_pipe(pipe_slow); |
|
108 |
%}')dnl |
|
109 |
define(`CAS_INSN3', |
|
110 |
` |
|
111 |
instruct weakCompareAndSwap$1$5(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{ |
|
112 |
match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval))); |
|
113 |
ifelse($5,Acq,' predicate(needs_acquiring_load_exclusive(n)); |
|
114 |
ins_cost(VOLATILE_REF_COST);`,' ins_cost(2 * VOLATILE_REF_COST);`) |
|
115 |
effect(KILL cr); |
|
116 |
format %{ |
|
117 |
"cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval" |
|
118 |
"csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)" |
|
119 |
%} |
|
120 |
ins_encode %{ |
|
121 |
__ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register, |
|
122 |
Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true, |
|
123 |
/*weak*/ true, noreg); |
|
124 |
__ csetw($res$$Register, Assembler::EQ); |
|
125 |
%} |
|
126 |
ins_pipe(pipe_slow); |
|
127 |
%}')dnl |
|
128 |
CAS_INSN2(B,I,byte,byte,bw) |
|
129 |
CAS_INSN2(S,I,short,halfword,hw) |
|
130 |
CAS_INSN3(I,I,int,word) |
|
131 |
CAS_INSN3(L,L,long,xword) |
|
132 |
CAS_INSN3(N,N,narrow oop,word) |
|
133 |
CAS_INSN3(P,P,ptr,xword) |
|
134 |
dnl CAS_INSN2(B,I,byte,byte,bw,Acq) |
|
135 |
dnl CAS_INSN2(S,I,short,halfword,hw,Acq) |
|
136 |
dnl CAS_INSN3(I,I,int,word,Acq) |
|
137 |
dnl CAS_INSN3(L,L,long,xword,Acq) |
|
138 |
dnl CAS_INSN3(N,N,narrow oop,word,Acq) |
|
139 |
dnl CAS_INSN3(P,P,ptr,xword,Acq) |
|
140 |
dnl |
|
42579
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
141 |
|
c7699b65b434
8169901: AArch64: CompareAndExchange intrinsics clobber address register
rkennke
parents:
40049
diff
changeset
|
142 |
// END This section of the file is automatically generated. Do not edit -------------- |