annotate gcc/config/ia64/sync.md @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents b7f97abdc517
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 ;; GCC machine description for IA-64 synchronization instructions.
111
kono
parents: 63
diff changeset
2 ;; Copyright (C) 2005-2017 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 ;; This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 ;; GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 ;; it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 ;; the Free Software Foundation; either version 3, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ;; any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 ;; GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 ;; GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 ;; You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 ;; along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 ;; <http://www.gnu.org/licenses/>.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
111
kono
parents: 63
diff changeset
20 ;; Conversion to C++11 memory model based on
kono
parents: 63
diff changeset
21 ;; http://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html
kono
parents: 63
diff changeset
22
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 (define_mode_iterator IMODE [QI HI SI DI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 (define_mode_iterator I124MODE [QI HI SI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 (define_mode_iterator I48MODE [SI DI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 (define_mode_attr modesuffix [(QI "1") (HI "2") (SI "4") (DI "8")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 (define_code_iterator FETCHOP [plus minus ior xor and])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 (define_code_attr fetchop_name
111
kono
parents: 63
diff changeset
30 [(plus "add") (minus "sub") (ior "or") (xor "xor") (and "and")])
kono
parents: 63
diff changeset
31
kono
parents: 63
diff changeset
32 (define_expand "mem_thread_fence"
kono
parents: 63
diff changeset
33 [(match_operand:SI 0 "const_int_operand" "")] ;; model
kono
parents: 63
diff changeset
34 ""
kono
parents: 63
diff changeset
35 {
kono
parents: 63
diff changeset
36 if (is_mm_seq_cst (memmodel_from_int (INTVAL (operands[0]))))
kono
parents: 63
diff changeset
37 emit_insn (gen_memory_barrier ());
kono
parents: 63
diff changeset
38 DONE;
kono
parents: 63
diff changeset
39 })
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 (define_expand "memory_barrier"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 [(set (match_dup 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 (unspec:BLK [(match_dup 0)] UNSPEC_MF))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 MEM_VOLATILE_P (operands[0]) = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 (define_insn "*memory_barrier"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 [(set (match_operand:BLK 0 "" "")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 (unspec:BLK [(match_dup 0)] UNSPEC_MF))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 "mf"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 [(set_attr "itanium_class" "syst_m")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
111
kono
parents: 63
diff changeset
57 (define_expand "atomic_load<mode>"
kono
parents: 63
diff changeset
58 [(match_operand:IMODE 0 "gr_register_operand" "") ;; output
kono
parents: 63
diff changeset
59 (match_operand:IMODE 1 "memory_operand" "") ;; memory
kono
parents: 63
diff changeset
60 (match_operand:SI 2 "const_int_operand" "")] ;; model
kono
parents: 63
diff changeset
61 ""
kono
parents: 63
diff changeset
62 {
kono
parents: 63
diff changeset
63 enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
kono
parents: 63
diff changeset
64
kono
parents: 63
diff changeset
65 /* Unless the memory model is relaxed, we want to emit ld.acq, which
kono
parents: 63
diff changeset
66 will happen automatically for volatile memories. */
kono
parents: 63
diff changeset
67 gcc_assert (is_mm_relaxed (model) || MEM_VOLATILE_P (operands[1]));
kono
parents: 63
diff changeset
68 emit_move_insn (operands[0], operands[1]);
kono
parents: 63
diff changeset
69 DONE;
kono
parents: 63
diff changeset
70 })
kono
parents: 63
diff changeset
71
kono
parents: 63
diff changeset
72 (define_expand "atomic_store<mode>"
kono
parents: 63
diff changeset
73 [(match_operand:IMODE 0 "memory_operand" "") ;; memory
kono
parents: 63
diff changeset
74 (match_operand:IMODE 1 "gr_reg_or_0_operand" "") ;; input
kono
parents: 63
diff changeset
75 (match_operand:SI 2 "const_int_operand" "")] ;; model
kono
parents: 63
diff changeset
76 ""
kono
parents: 63
diff changeset
77 {
kono
parents: 63
diff changeset
78 enum memmodel model = memmodel_from_int (INTVAL (operands[2]));
kono
parents: 63
diff changeset
79
kono
parents: 63
diff changeset
80 /* Unless the memory model is relaxed, we want to emit st.rel, which
kono
parents: 63
diff changeset
81 will happen automatically for volatile memories. */
kono
parents: 63
diff changeset
82 gcc_assert (is_mm_relaxed (model) || MEM_VOLATILE_P (operands[0]));
kono
parents: 63
diff changeset
83 emit_move_insn (operands[0], operands[1]);
kono
parents: 63
diff changeset
84
kono
parents: 63
diff changeset
85 /* Sequentially consistent stores need a subsequent MF. See
kono
parents: 63
diff changeset
86 http://www.decadent.org.uk/pipermail/cpp-threads/2008-December/001952.html
kono
parents: 63
diff changeset
87 for a discussion of why a MF is needed here, but not for atomic_load. */
kono
parents: 63
diff changeset
88 if (is_mm_seq_cst (model))
kono
parents: 63
diff changeset
89 emit_insn (gen_memory_barrier ());
kono
parents: 63
diff changeset
90 DONE;
kono
parents: 63
diff changeset
91 })
kono
parents: 63
diff changeset
92
kono
parents: 63
diff changeset
93 (define_expand "atomic_compare_and_swap<mode>"
kono
parents: 63
diff changeset
94 [(match_operand:DI 0 "gr_register_operand" "") ;; bool out
kono
parents: 63
diff changeset
95 (match_operand:IMODE 1 "gr_register_operand" "") ;; val out
kono
parents: 63
diff changeset
96 (match_operand:IMODE 2 "not_postinc_memory_operand" "") ;; memory
kono
parents: 63
diff changeset
97 (match_operand:IMODE 3 "gr_register_operand" "") ;; expected
kono
parents: 63
diff changeset
98 (match_operand:IMODE 4 "gr_reg_or_0_operand" "") ;; desired
kono
parents: 63
diff changeset
99 (match_operand:SI 5 "const_int_operand" "") ;; is_weak
kono
parents: 63
diff changeset
100 (match_operand:SI 6 "const_int_operand" "") ;; succ model
kono
parents: 63
diff changeset
101 (match_operand:SI 7 "const_int_operand" "")] ;; fail model
kono
parents: 63
diff changeset
102 ""
kono
parents: 63
diff changeset
103 {
kono
parents: 63
diff changeset
104 /* No need to distinquish __sync from __atomic, so get base value. */
kono
parents: 63
diff changeset
105 enum memmodel model = memmodel_base (INTVAL (operands[6]));
kono
parents: 63
diff changeset
106 rtx ccv = gen_rtx_REG (DImode, AR_CCV_REGNUM);
kono
parents: 63
diff changeset
107 rtx dval, eval;
kono
parents: 63
diff changeset
108
kono
parents: 63
diff changeset
109 eval = gen_reg_rtx (DImode);
kono
parents: 63
diff changeset
110 convert_move (eval, operands[3], 1);
kono
parents: 63
diff changeset
111 emit_move_insn (ccv, eval);
kono
parents: 63
diff changeset
112
kono
parents: 63
diff changeset
113 if (<MODE>mode == DImode)
kono
parents: 63
diff changeset
114 dval = operands[1];
kono
parents: 63
diff changeset
115 else
kono
parents: 63
diff changeset
116 dval = gen_reg_rtx (DImode);
kono
parents: 63
diff changeset
117
kono
parents: 63
diff changeset
118 switch (model)
kono
parents: 63
diff changeset
119 {
kono
parents: 63
diff changeset
120 case MEMMODEL_RELAXED:
kono
parents: 63
diff changeset
121 case MEMMODEL_ACQUIRE:
kono
parents: 63
diff changeset
122 case MEMMODEL_CONSUME:
kono
parents: 63
diff changeset
123 emit_insn (gen_cmpxchg_acq_<mode> (dval, operands[2], ccv, operands[4]));
kono
parents: 63
diff changeset
124 break;
kono
parents: 63
diff changeset
125 case MEMMODEL_RELEASE:
kono
parents: 63
diff changeset
126 emit_insn (gen_cmpxchg_rel_<mode> (dval, operands[2], ccv, operands[4]));
kono
parents: 63
diff changeset
127 break;
kono
parents: 63
diff changeset
128 case MEMMODEL_ACQ_REL:
kono
parents: 63
diff changeset
129 case MEMMODEL_SEQ_CST:
kono
parents: 63
diff changeset
130 emit_insn (gen_cmpxchg_rel_<mode> (dval, operands[2], ccv, operands[4]));
kono
parents: 63
diff changeset
131 emit_insn (gen_memory_barrier ());
kono
parents: 63
diff changeset
132 break;
kono
parents: 63
diff changeset
133 default:
kono
parents: 63
diff changeset
134 gcc_unreachable ();
kono
parents: 63
diff changeset
135 }
kono
parents: 63
diff changeset
136
kono
parents: 63
diff changeset
137 if (<MODE>mode != DImode)
kono
parents: 63
diff changeset
138 emit_move_insn (operands[1], gen_lowpart (<MODE>mode, dval));
kono
parents: 63
diff changeset
139
kono
parents: 63
diff changeset
140 emit_insn (gen_cstoredi4 (operands[0], gen_rtx_EQ (DImode, dval, eval),
kono
parents: 63
diff changeset
141 dval, eval));
kono
parents: 63
diff changeset
142 DONE;
kono
parents: 63
diff changeset
143 })
kono
parents: 63
diff changeset
144
kono
parents: 63
diff changeset
145 (define_insn "cmpxchg_acq_<mode>"
kono
parents: 63
diff changeset
146 [(set (match_operand:DI 0 "gr_register_operand" "=r")
kono
parents: 63
diff changeset
147 (zero_extend:DI
kono
parents: 63
diff changeset
148 (match_operand:I124MODE 1 "not_postinc_memory_operand" "+S")))
kono
parents: 63
diff changeset
149 (set (match_dup 1)
kono
parents: 63
diff changeset
150 (unspec:I124MODE
kono
parents: 63
diff changeset
151 [(match_dup 1)
kono
parents: 63
diff changeset
152 (match_operand:DI 2 "ar_ccv_reg_operand" "")
kono
parents: 63
diff changeset
153 (match_operand:I124MODE 3 "gr_reg_or_0_operand" "rO")]
kono
parents: 63
diff changeset
154 UNSPEC_CMPXCHG_ACQ))]
kono
parents: 63
diff changeset
155 ""
kono
parents: 63
diff changeset
156 "cmpxchg<modesuffix>.acq %0 = %1, %r3, %2"
kono
parents: 63
diff changeset
157 [(set_attr "itanium_class" "sem")])
kono
parents: 63
diff changeset
158
kono
parents: 63
diff changeset
159 (define_insn "cmpxchg_rel_<mode>"
kono
parents: 63
diff changeset
160 [(set (match_operand:DI 0 "gr_register_operand" "=r")
kono
parents: 63
diff changeset
161 (zero_extend:DI
kono
parents: 63
diff changeset
162 (match_operand:I124MODE 1 "not_postinc_memory_operand" "+S")))
kono
parents: 63
diff changeset
163 (set (match_dup 1)
kono
parents: 63
diff changeset
164 (unspec:I124MODE
kono
parents: 63
diff changeset
165 [(match_dup 1)
kono
parents: 63
diff changeset
166 (match_operand:DI 2 "ar_ccv_reg_operand" "")
kono
parents: 63
diff changeset
167 (match_operand:I124MODE 3 "gr_reg_or_0_operand" "rO")]
kono
parents: 63
diff changeset
168 UNSPEC_CMPXCHG_REL))]
kono
parents: 63
diff changeset
169 ""
kono
parents: 63
diff changeset
170 "cmpxchg<modesuffix>.rel %0 = %1, %r3, %2"
kono
parents: 63
diff changeset
171 [(set_attr "itanium_class" "sem")])
kono
parents: 63
diff changeset
172
kono
parents: 63
diff changeset
173 (define_insn "cmpxchg_acq_di"
kono
parents: 63
diff changeset
174 [(set (match_operand:DI 0 "gr_register_operand" "=r")
kono
parents: 63
diff changeset
175 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
kono
parents: 63
diff changeset
176 (set (match_dup 1)
kono
parents: 63
diff changeset
177 (unspec:DI [(match_dup 1)
kono
parents: 63
diff changeset
178 (match_operand:DI 2 "ar_ccv_reg_operand" "")
kono
parents: 63
diff changeset
179 (match_operand:DI 3 "gr_reg_or_0_operand" "rO")]
kono
parents: 63
diff changeset
180 UNSPEC_CMPXCHG_ACQ))]
kono
parents: 63
diff changeset
181 ""
kono
parents: 63
diff changeset
182 "cmpxchg8.acq %0 = %1, %r3, %2"
kono
parents: 63
diff changeset
183 [(set_attr "itanium_class" "sem")])
kono
parents: 63
diff changeset
184
kono
parents: 63
diff changeset
185 (define_insn "cmpxchg_rel_di"
kono
parents: 63
diff changeset
186 [(set (match_operand:DI 0 "gr_register_operand" "=r")
kono
parents: 63
diff changeset
187 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
kono
parents: 63
diff changeset
188 (set (match_dup 1)
kono
parents: 63
diff changeset
189 (unspec:DI [(match_dup 1)
kono
parents: 63
diff changeset
190 (match_operand:DI 2 "ar_ccv_reg_operand" "")
kono
parents: 63
diff changeset
191 (match_operand:DI 3 "gr_reg_or_0_operand" "rO")]
kono
parents: 63
diff changeset
192 UNSPEC_CMPXCHG_REL))]
kono
parents: 63
diff changeset
193 ""
kono
parents: 63
diff changeset
194 "cmpxchg8.rel %0 = %1, %r3, %2"
kono
parents: 63
diff changeset
195 [(set_attr "itanium_class" "sem")])
kono
parents: 63
diff changeset
196
kono
parents: 63
diff changeset
197 (define_expand "atomic_exchange<mode>"
kono
parents: 63
diff changeset
198 [(match_operand:IMODE 0 "gr_register_operand" "") ;; output
kono
parents: 63
diff changeset
199 (match_operand:IMODE 1 "not_postinc_memory_operand" "") ;; memory
kono
parents: 63
diff changeset
200 (match_operand:IMODE 2 "gr_reg_or_0_operand" "") ;; input
kono
parents: 63
diff changeset
201 (match_operand:SI 3 "const_int_operand" "")] ;; succ model
kono
parents: 63
diff changeset
202 ""
kono
parents: 63
diff changeset
203 {
kono
parents: 63
diff changeset
204 /* No need to distinquish __sync from __atomic, so get base value. */
kono
parents: 63
diff changeset
205 enum memmodel model = memmodel_base (INTVAL (operands[3]));
kono
parents: 63
diff changeset
206
kono
parents: 63
diff changeset
207 switch (model)
kono
parents: 63
diff changeset
208 {
kono
parents: 63
diff changeset
209 case MEMMODEL_RELAXED:
kono
parents: 63
diff changeset
210 case MEMMODEL_ACQUIRE:
kono
parents: 63
diff changeset
211 case MEMMODEL_CONSUME:
kono
parents: 63
diff changeset
212 break;
kono
parents: 63
diff changeset
213 case MEMMODEL_RELEASE:
kono
parents: 63
diff changeset
214 case MEMMODEL_ACQ_REL:
kono
parents: 63
diff changeset
215 case MEMMODEL_SEQ_CST:
kono
parents: 63
diff changeset
216 emit_insn (gen_memory_barrier ());
kono
parents: 63
diff changeset
217 break;
kono
parents: 63
diff changeset
218 default:
kono
parents: 63
diff changeset
219 gcc_unreachable ();
kono
parents: 63
diff changeset
220 }
kono
parents: 63
diff changeset
221 emit_insn (gen_xchg_acq_<mode> (operands[0], operands[1], operands[2]));
kono
parents: 63
diff changeset
222 DONE;
kono
parents: 63
diff changeset
223 })
kono
parents: 63
diff changeset
224
kono
parents: 63
diff changeset
225 ;; Note that XCHG is always memory model acquire.
kono
parents: 63
diff changeset
226 (define_insn "xchg_acq_<mode>"
kono
parents: 63
diff changeset
227 [(set (match_operand:IMODE 0 "gr_register_operand" "=r")
kono
parents: 63
diff changeset
228 (match_operand:IMODE 1 "not_postinc_memory_operand" "+S"))
kono
parents: 63
diff changeset
229 (set (match_dup 1)
kono
parents: 63
diff changeset
230 (match_operand:IMODE 2 "gr_reg_or_0_operand" "rO"))]
kono
parents: 63
diff changeset
231 ""
kono
parents: 63
diff changeset
232 "xchg<modesuffix> %0 = %1, %r2"
kono
parents: 63
diff changeset
233 [(set_attr "itanium_class" "sem")])
kono
parents: 63
diff changeset
234
kono
parents: 63
diff changeset
235 (define_expand "atomic_<fetchop_name><mode>"
kono
parents: 63
diff changeset
236 [(set (match_operand:IMODE 0 "memory_operand" "")
kono
parents: 63
diff changeset
237 (FETCHOP:IMODE (match_dup 0)
kono
parents: 63
diff changeset
238 (match_operand:IMODE 1 "nonmemory_operand" "")))
kono
parents: 63
diff changeset
239 (use (match_operand:SI 2 "const_int_operand" ""))]
kono
parents: 63
diff changeset
240 ""
kono
parents: 63
diff changeset
241 {
kono
parents: 63
diff changeset
242 ia64_expand_atomic_op (<CODE>, operands[0], operands[1], NULL, NULL,
kono
parents: 63
diff changeset
243 (enum memmodel) INTVAL (operands[2]));
kono
parents: 63
diff changeset
244 DONE;
kono
parents: 63
diff changeset
245 })
kono
parents: 63
diff changeset
246
kono
parents: 63
diff changeset
247 (define_expand "atomic_nand<mode>"
kono
parents: 63
diff changeset
248 [(set (match_operand:IMODE 0 "memory_operand" "")
kono
parents: 63
diff changeset
249 (not:IMODE
kono
parents: 63
diff changeset
250 (and:IMODE (match_dup 0)
kono
parents: 63
diff changeset
251 (match_operand:IMODE 1 "nonmemory_operand" ""))))
kono
parents: 63
diff changeset
252 (use (match_operand:SI 2 "const_int_operand" ""))]
kono
parents: 63
diff changeset
253 ""
kono
parents: 63
diff changeset
254 {
kono
parents: 63
diff changeset
255 ia64_expand_atomic_op (NOT, operands[0], operands[1], NULL, NULL,
kono
parents: 63
diff changeset
256 (enum memmodel) INTVAL (operands[2]));
kono
parents: 63
diff changeset
257 DONE;
kono
parents: 63
diff changeset
258 })
kono
parents: 63
diff changeset
259
kono
parents: 63
diff changeset
260 (define_expand "atomic_fetch_<fetchop_name><mode>"
kono
parents: 63
diff changeset
261 [(set (match_operand:IMODE 0 "gr_register_operand" "")
kono
parents: 63
diff changeset
262 (FETCHOP:IMODE
kono
parents: 63
diff changeset
263 (match_operand:IMODE 1 "memory_operand" "")
kono
parents: 63
diff changeset
264 (match_operand:IMODE 2 "nonmemory_operand" "")))
kono
parents: 63
diff changeset
265 (use (match_operand:SI 3 "const_int_operand" ""))]
kono
parents: 63
diff changeset
266 ""
kono
parents: 63
diff changeset
267 {
kono
parents: 63
diff changeset
268 ia64_expand_atomic_op (<CODE>, operands[1], operands[2], operands[0], NULL,
kono
parents: 63
diff changeset
269 (enum memmodel) INTVAL (operands[3]));
kono
parents: 63
diff changeset
270 DONE;
kono
parents: 63
diff changeset
271 })
kono
parents: 63
diff changeset
272
kono
parents: 63
diff changeset
273 (define_expand "atomic_fetch_nand<mode>"
kono
parents: 63
diff changeset
274 [(set (match_operand:IMODE 0 "gr_register_operand" "")
kono
parents: 63
diff changeset
275 (not:IMODE
kono
parents: 63
diff changeset
276 (and:IMODE (match_operand:IMODE 1 "memory_operand" "")
kono
parents: 63
diff changeset
277 (match_operand:IMODE 2 "nonmemory_operand" ""))))
kono
parents: 63
diff changeset
278 (use (match_operand:SI 3 "const_int_operand" ""))]
kono
parents: 63
diff changeset
279 ""
kono
parents: 63
diff changeset
280 {
kono
parents: 63
diff changeset
281 ia64_expand_atomic_op (NOT, operands[1], operands[2], operands[0], NULL,
kono
parents: 63
diff changeset
282 (enum memmodel) INTVAL (operands[3]));
kono
parents: 63
diff changeset
283 DONE;
kono
parents: 63
diff changeset
284 })
kono
parents: 63
diff changeset
285
kono
parents: 63
diff changeset
286 (define_expand "atomic_<fetchop_name>_fetch<mode>"
kono
parents: 63
diff changeset
287 [(set (match_operand:IMODE 0 "gr_register_operand" "")
kono
parents: 63
diff changeset
288 (FETCHOP:IMODE
kono
parents: 63
diff changeset
289 (match_operand:IMODE 1 "memory_operand" "")
kono
parents: 63
diff changeset
290 (match_operand:IMODE 2 "nonmemory_operand" "")))
kono
parents: 63
diff changeset
291 (use (match_operand:SI 3 "const_int_operand" ""))]
kono
parents: 63
diff changeset
292 ""
kono
parents: 63
diff changeset
293 {
kono
parents: 63
diff changeset
294 ia64_expand_atomic_op (<CODE>, operands[1], operands[2], NULL, operands[0],
kono
parents: 63
diff changeset
295 (enum memmodel) INTVAL (operands[3]));
kono
parents: 63
diff changeset
296 DONE;
kono
parents: 63
diff changeset
297 })
kono
parents: 63
diff changeset
298
kono
parents: 63
diff changeset
299 (define_expand "atomic_nand_fetch<mode>"
kono
parents: 63
diff changeset
300 [(set (match_operand:IMODE 0 "gr_register_operand" "")
kono
parents: 63
diff changeset
301 (not:IMODE
kono
parents: 63
diff changeset
302 (and:IMODE (match_operand:IMODE 1 "memory_operand" "")
kono
parents: 63
diff changeset
303 (match_operand:IMODE 2 "nonmemory_operand" ""))))
kono
parents: 63
diff changeset
304 (use (match_operand:SI 3 "const_int_operand" ""))]
kono
parents: 63
diff changeset
305 ""
kono
parents: 63
diff changeset
306 {
kono
parents: 63
diff changeset
307 ia64_expand_atomic_op (NOT, operands[1], operands[2], NULL, operands[0],
kono
parents: 63
diff changeset
308 (enum memmodel) INTVAL (operands[3]));
kono
parents: 63
diff changeset
309 DONE;
kono
parents: 63
diff changeset
310 })
kono
parents: 63
diff changeset
311
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 (define_insn "fetchadd_acq_<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 [(set (match_operand:I48MODE 0 "gr_register_operand" "=r")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 (match_operand:I48MODE 1 "not_postinc_memory_operand" "+S"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 (unspec:I48MODE [(match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 (match_operand:I48MODE 2 "fetchadd_operand" "n")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 UNSPEC_FETCHADD_ACQ))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 ""
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 "fetchadd<modesuffix>.acq %0 = %1, %2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 [(set_attr "itanium_class" "sem")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322
111
kono
parents: 63
diff changeset
323 (define_insn "fetchadd_rel_<mode>"
kono
parents: 63
diff changeset
324 [(set (match_operand:I48MODE 0 "gr_register_operand" "=r")
kono
parents: 63
diff changeset
325 (match_operand:I48MODE 1 "not_postinc_memory_operand" "+S"))
kono
parents: 63
diff changeset
326 (set (match_dup 1)
kono
parents: 63
diff changeset
327 (unspec:I48MODE [(match_dup 1)
kono
parents: 63
diff changeset
328 (match_operand:I48MODE 2 "fetchadd_operand" "n")]
kono
parents: 63
diff changeset
329 UNSPEC_FETCHADD_REL))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 ""
111
kono
parents: 63
diff changeset
331 "fetchadd<modesuffix>.rel %0 = %1, %2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 [(set_attr "itanium_class" "sem")])