OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [alpha/] [sync.md] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
;; GCC machine description for Alpha synchronization instructions.
2
;; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
3
;;
4
;; This file is part of GCC.
5
;;
6
;; GCC is free software; you can redistribute it and/or modify
7
;; it under the terms of the GNU General Public License as published by
8
;; the Free Software Foundation; either version 3, or (at your option)
9
;; any later version.
10
;;
11
;; GCC is distributed in the hope that it will be useful,
12
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;; GNU General Public License for more details.
15
;;
16
;; You should have received a copy of the GNU General Public License
17
;; along with GCC; see the file COPYING3.  If not see
18
;; .
19
 
20
(define_mode_macro I12MODE [QI HI])
21
(define_mode_macro I48MODE [SI DI])
22
(define_mode_attr modesuffix [(SI "l") (DI "q")])
23
 
24
(define_code_macro FETCHOP [plus minus ior xor and])
25
(define_code_attr fetchop_name
26
  [(plus "add") (minus "sub") (ior "ior") (xor "xor") (and "and")])
27
(define_code_attr fetchop_pred
28
  [(plus "add_operand") (minus "reg_or_8bit_operand")
29
   (ior "or_operand") (xor "or_operand") (and "and_operand")])
30
(define_code_attr fetchop_constr
31
  [(plus "rKL") (minus "rI") (ior "rIN") (xor "rIN") (and "riNHM")])
32
 
33
 
34
(define_expand "memory_barrier"
35
  [(set (mem:BLK (match_dup 0))
36
        (unspec:BLK [(mem:BLK (match_dup 0))] UNSPEC_MB))]
37
  ""
38
{
39
  operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
40
  MEM_VOLATILE_P (operands[0]) = 1;
41
})
42
 
43
(define_insn "*mb_internal"
44
  [(set (match_operand:BLK 0 "" "")
45
        (unspec:BLK [(match_operand:BLK 1 "" "")] UNSPEC_MB))]
46
  ""
47
  "mb"
48
  [(set_attr "type" "mb")])
49
 
50
(define_insn "load_locked_"
51
  [(set (match_operand:I48MODE 0 "register_operand" "=r")
52
        (unspec_volatile:I48MODE
53
          [(match_operand:I48MODE 1 "memory_operand" "m")]
54
          UNSPECV_LL))]
55
  ""
56
  "ld_l %0,%1"
57
  [(set_attr "type" "ld_l")])
58
 
59
(define_insn "store_conditional_"
60
  [(set (match_operand:DI 0 "register_operand" "=r")
61
        (unspec_volatile:DI [(const_int 0)] UNSPECV_SC))
62
   (set (match_operand:I48MODE 1 "memory_operand" "=m")
63
        (match_operand:I48MODE 2 "reg_or_0_operand" "0"))]
64
  ""
65
  "st_c %0,%1"
66
  [(set_attr "type" "st_c")])
67
 
68
;; The Alpha Architecture Handbook says that it is UNPREDICTABLE whether
69
;; the lock is cleared by a TAKEN branch.  If we were to honor that, it
70
;; would mean that we could not expand a ll/sc sequence until after the
71
;; final basic-block reordering pass.  Fortunately, it appears that no
72
;; Alpha implementation ever built actually clears the lock on branches,
73
;; taken or not.
74
 
75
(define_insn_and_split "sync_"
76
  [(set (match_operand:I48MODE 0 "memory_operand" "+m")
77
        (unspec:I48MODE
78
          [(FETCHOP:I48MODE (match_dup 0)
79
             (match_operand:I48MODE 1 "" ""))]
80
          UNSPEC_ATOMIC))
81
   (clobber (match_scratch:I48MODE 2 "=&r"))]
82
  ""
83
  "#"
84
  "reload_completed"
85
  [(const_int 0)]
86
{
87
  alpha_split_atomic_op (, operands[0], operands[1],
88
                         NULL, NULL, operands[2]);
89
  DONE;
90
}
91
  [(set_attr "type" "multi")])
92
 
93
(define_insn_and_split "sync_nand"
94
  [(set (match_operand:I48MODE 0 "memory_operand" "+m")
95
        (unspec:I48MODE
96
          [(and:I48MODE (not:I48MODE (match_dup 0))
97
             (match_operand:I48MODE 1 "register_operand" "r"))]
98
          UNSPEC_ATOMIC))
99
   (clobber (match_scratch:I48MODE 2 "=&r"))]
100
  ""
101
  "#"
102
  "reload_completed"
103
  [(const_int 0)]
104
{
105
  alpha_split_atomic_op (NOT, operands[0], operands[1],
106
                         NULL, NULL, operands[2]);
107
  DONE;
108
}
109
  [(set_attr "type" "multi")])
110
 
111
(define_insn_and_split "sync_old_"
112
  [(set (match_operand:I48MODE 0 "register_operand" "=&r")
113
        (match_operand:I48MODE 1 "memory_operand" "+m"))
114
   (set (match_dup 1)
115
        (unspec:I48MODE
116
          [(FETCHOP:I48MODE (match_dup 1)
117
             (match_operand:I48MODE 2 "" ""))]
118
          UNSPEC_ATOMIC))
119
   (clobber (match_scratch:I48MODE 3 "=&r"))]
120
  ""
121
  "#"
122
  "reload_completed"
123
  [(const_int 0)]
124
{
125
  alpha_split_atomic_op (, operands[1], operands[2],
126
                         operands[0], NULL, operands[3]);
127
  DONE;
128
}
129
  [(set_attr "type" "multi")])
130
 
131
(define_insn_and_split "sync_old_nand"
132
  [(set (match_operand:I48MODE 0 "register_operand" "=&r")
133
        (match_operand:I48MODE 1 "memory_operand" "+m"))
134
   (set (match_dup 1)
135
        (unspec:I48MODE
136
          [(and:I48MODE (not:I48MODE (match_dup 1))
137
             (match_operand:I48MODE 2 "register_operand" "r"))]
138
          UNSPEC_ATOMIC))
139
   (clobber (match_scratch:I48MODE 3 "=&r"))]
140
  ""
141
  "#"
142
  "reload_completed"
143
  [(const_int 0)]
144
{
145
  alpha_split_atomic_op (NOT, operands[1], operands[2],
146
                         operands[0], NULL, operands[3]);
147
  DONE;
148
}
149
  [(set_attr "type" "multi")])
150
 
151
(define_insn_and_split "sync_new_"
152
  [(set (match_operand:I48MODE 0 "register_operand" "=&r")
153
        (FETCHOP:I48MODE
154
          (match_operand:I48MODE 1 "memory_operand" "+m")
155
          (match_operand:I48MODE 2 "" "")))
156
   (set (match_dup 1)
157
        (unspec:I48MODE
158
          [(FETCHOP:I48MODE (match_dup 1) (match_dup 2))]
159
          UNSPEC_ATOMIC))
160
   (clobber (match_scratch:I48MODE 3 "=&r"))]
161
  ""
162
  "#"
163
  "reload_completed"
164
  [(const_int 0)]
165
{
166
  alpha_split_atomic_op (, operands[1], operands[2],
167
                         NULL, operands[0], operands[3]);
168
  DONE;
169
}
170
  [(set_attr "type" "multi")])
171
 
172
(define_insn_and_split "sync_new_nand"
173
  [(set (match_operand:I48MODE 0 "register_operand" "=&r")
174
        (and:I48MODE
175
          (not:I48MODE (match_operand:I48MODE 1 "memory_operand" "+m"))
176
          (match_operand:I48MODE 2 "register_operand" "r")))
177
   (set (match_dup 1)
178
        (unspec:I48MODE
179
          [(and:I48MODE (not:I48MODE (match_dup 1)) (match_dup 2))]
180
          UNSPEC_ATOMIC))
181
   (clobber (match_scratch:I48MODE 3 "=&r"))]
182
  ""
183
  "#"
184
  "reload_completed"
185
  [(const_int 0)]
186
{
187
  alpha_split_atomic_op (NOT, operands[1], operands[2],
188
                         NULL, operands[0], operands[3]);
189
  DONE;
190
}
191
  [(set_attr "type" "multi")])
192
 
193
(define_expand "sync_compare_and_swap"
194
  [(match_operand:I12MODE 0 "register_operand" "")
195
   (match_operand:I12MODE 1 "memory_operand" "")
196
   (match_operand:I12MODE 2 "register_operand" "")
197
   (match_operand:I12MODE 3 "add_operand" "")]
198
  ""
199
{
200
  alpha_expand_compare_and_swap_12 (operands[0], operands[1],
201
                                    operands[2], operands[3]);
202
  DONE;
203
})
204
 
205
(define_insn_and_split "sync_compare_and_swap_1"
206
  [(set (match_operand:DI 0 "register_operand" "=&r,&r")
207
        (zero_extend:DI
208
          (mem:I12MODE (match_operand:DI 1 "register_operand" "r,r"))))
209
   (set (mem:I12MODE (match_dup 1))
210
        (unspec:I12MODE
211
          [(match_operand:DI 2 "reg_or_8bit_operand" "J,rI")
212
           (match_operand:DI 3 "register_operand" "r,r")
213
           (match_operand:DI 4 "register_operand" "r,r")]
214
          UNSPEC_CMPXCHG))
215
   (clobber (match_scratch:DI 5 "=&r,&r"))
216
   (clobber (match_scratch:DI 6 "=X,&r"))]
217
  ""
218
  "#"
219
  "reload_completed"
220
  [(const_int 0)]
221
{
222
  alpha_split_compare_and_swap_12 (mode, operands[0], operands[1],
223
                                   operands[2], operands[3], operands[4],
224
                                   operands[5], operands[6]);
225
  DONE;
226
}
227
  [(set_attr "type" "multi")])
228
 
229
(define_expand "sync_compare_and_swap"
230
  [(parallel
231
     [(set (match_operand:I48MODE 0 "register_operand" "")
232
           (match_operand:I48MODE 1 "memory_operand" ""))
233
      (set (match_dup 1)
234
           (unspec:I48MODE
235
             [(match_operand:I48MODE 2 "reg_or_8bit_operand" "")
236
              (match_operand:I48MODE 3 "add_operand" "rKL")]
237
             UNSPEC_CMPXCHG))
238
      (clobber (match_scratch:I48MODE 4 "=&r"))])]
239
  ""
240
{
241
  if (mode == SImode)
242
    operands[2] = convert_modes (DImode, SImode, operands[2], 0);
243
})
244
 
245
(define_insn_and_split "*sync_compare_and_swap"
246
  [(set (match_operand:I48MODE 0 "register_operand" "=&r")
247
        (match_operand:I48MODE 1 "memory_operand" "+m"))
248
   (set (match_dup 1)
249
        (unspec:I48MODE
250
          [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
251
           (match_operand:I48MODE 3 "add_operand" "rKL")]
252
          UNSPEC_CMPXCHG))
253
   (clobber (match_scratch:I48MODE 4 "=&r"))]
254
  ""
255
  "#"
256
  "reload_completed"
257
  [(const_int 0)]
258
{
259
  alpha_split_compare_and_swap (operands[0], operands[1], operands[2],
260
                                operands[3], operands[4]);
261
  DONE;
262
}
263
  [(set_attr "type" "multi")])
264
 
265
(define_expand "sync_lock_test_and_set"
266
  [(match_operand:I12MODE 0 "register_operand" "")
267
   (match_operand:I12MODE 1 "memory_operand" "")
268
   (match_operand:I12MODE 2 "register_operand" "")]
269
  ""
270
{
271
  alpha_expand_lock_test_and_set_12 (operands[0], operands[1], operands[2]);
272
  DONE;
273
})
274
 
275
(define_insn_and_split "sync_lock_test_and_set_1"
276
  [(set (match_operand:DI 0 "register_operand" "=&r")
277
        (zero_extend:DI
278
          (mem:I12MODE (match_operand:DI 1 "register_operand" "r"))))
279
   (set (mem:I12MODE (match_dup 1))
280
        (unspec:I12MODE
281
          [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
282
           (match_operand:DI 3 "register_operand" "r")]
283
          UNSPEC_XCHG))
284
   (clobber (match_scratch:DI 4 "=&r"))]
285
  ""
286
  "#"
287
  "reload_completed"
288
  [(const_int 0)]
289
{
290
  alpha_split_lock_test_and_set_12 (mode, operands[0], operands[1],
291
                                    operands[2], operands[3], operands[4]);
292
  DONE;
293
}
294
  [(set_attr "type" "multi")])
295
 
296
(define_insn_and_split "sync_lock_test_and_set"
297
  [(set (match_operand:I48MODE 0 "register_operand" "=&r")
298
        (match_operand:I48MODE 1 "memory_operand" "+m"))
299
   (set (match_dup 1)
300
        (unspec:I48MODE
301
          [(match_operand:I48MODE 2 "add_operand" "rKL")]
302
          UNSPEC_XCHG))
303
   (clobber (match_scratch:I48MODE 3 "=&r"))]
304
  ""
305
  "#"
306
  "reload_completed"
307
  [(const_int 0)]
308
{
309
  alpha_split_lock_test_and_set (operands[0], operands[1],
310
                                 operands[2], operands[3]);
311
  DONE;
312
}
313
  [(set_attr "type" "multi")])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.