annotate gcc/config/mips/sync.md @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
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 ;; Machine Description for MIPS based processor synchronization
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 ;; instructions.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 ;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 ;; This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 ;; 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
8 ;; 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
9 ;; 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
10 ;; any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 ;; 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
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 ;; GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 ;; 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
18 ;; along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 ;; <http://www.gnu.org/licenses/>.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
21 (define_c_enum "unspec" [
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
22 UNSPEC_COMPARE_AND_SWAP
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
23 UNSPEC_COMPARE_AND_SWAP_12
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
24 UNSPEC_SYNC_OLD_OP
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
25 UNSPEC_SYNC_NEW_OP
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
26 UNSPEC_SYNC_NEW_OP_12
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
27 UNSPEC_SYNC_OLD_OP_12
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
28 UNSPEC_SYNC_EXCHANGE
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
29 UNSPEC_SYNC_EXCHANGE_12
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
30 UNSPEC_MEMORY_BARRIER
111
kono
parents: 67
diff changeset
31 UNSPEC_ATOMIC_COMPARE_AND_SWAP
kono
parents: 67
diff changeset
32 UNSPEC_ATOMIC_EXCHANGE
kono
parents: 67
diff changeset
33 UNSPEC_ATOMIC_FETCH_OP
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
34 ])
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
35
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 ;; Atomic fetch bitwise operations.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 (define_code_iterator fetchop_bit [ior xor and])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 ;; Atomic HI and QI operations
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 (define_code_iterator atomic_hiqi_op [plus minus ior xor and])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 ;; Atomic memory operations.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 (define_expand "memory_barrier"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 [(set (match_dup 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 "GENERATE_SYNC"
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 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 MEM_VOLATILE_P (operands[0]) = 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 (define_insn "*memory_barrier"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 [(set (match_operand:BLK 0 "" "")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 "GENERATE_SYNC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
57 { return mips_output_sync (); })
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
111
kono
parents: 67
diff changeset
59 ;; Can be removed in favor of atomic_compare_and_swap below.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 (define_insn "sync_compare_and_swap<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
62 (match_operand:GPR 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 (unspec_volatile:GPR [(match_operand:GPR 2 "reg_or_0_operand" "dJ,dJ")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 (match_operand:GPR 3 "arith_operand" "I,d")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 UNSPEC_COMPARE_AND_SWAP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
68 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
69 [(set_attr "sync_insn1" "li,move")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
70 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
71 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
72 (set_attr "sync_required_oldval" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
73 (set_attr "sync_insn1_op2" "3")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 (define_expand "sync_compare_and_swap<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 [(match_operand:SHORT 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 (match_operand:SHORT 1 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 (match_operand:SHORT 2 "general_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 (match_operand:SHORT 3 "general_operand")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 generator.fn_6 = gen_compare_and_swap_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 operands[0], operands[1], operands[2], operands[3]);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 ;; Helper insn for mips_expand_atomic_qihi.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 (define_insn "compare_and_swap_12"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 [(set (match_operand:SI 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
92 (match_operand:SI 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 (unspec_volatile:SI [(match_operand:SI 2 "register_operand" "d,d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 (match_operand:SI 3 "register_operand" "d,d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 (match_operand:SI 4 "reg_or_0_operand" "dJ,dJ")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 (match_operand:SI 5 "reg_or_0_operand" "d,J")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 UNSPEC_COMPARE_AND_SWAP_12))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
100 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
101 [(set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
102 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
103 (set_attr "sync_inclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
104 (set_attr "sync_exclusive_mask" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
105 (set_attr "sync_required_oldval" "4")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
106 (set_attr "sync_insn1_op2" "5")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 (define_insn "sync_add<mode>"
111
kono
parents: 67
diff changeset
109 [(set (match_operand:GPR 0 "memory_operand" "+ZC,ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 [(plus:GPR (match_dup 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 (match_operand:GPR 1 "arith_operand" "I,d"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
115 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
116 [(set_attr "sync_insn1" "addiu,addu")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
117 (set_attr "sync_mem" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
118 (set_attr "sync_insn1_op2" "1")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 (define_expand "sync_<optab><mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 [(set (match_operand:SHORT 0 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 (unspec_volatile:SHORT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 [(atomic_hiqi_op:SHORT (match_dup 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 (match_operand:SHORT 1 "general_operand"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 generator.fn_4 = gen_sync_<optab>_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 NULL, operands[0], operands[1], NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 ;; Helper insn for sync_<optab><mode>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 (define_insn "sync_<optab>_12"
111
kono
parents: 67
diff changeset
137 [(set (match_operand:SI 0 "memory_operand" "+ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 (unspec_volatile:SI
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 [(match_operand:SI 1 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 (match_operand:SI 2 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 (atomic_hiqi_op:SI (match_dup 0)
111
kono
parents: 67
diff changeset
142 (match_operand:SI 3 "reg_or_0_operand" "dJ"))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 UNSPEC_SYNC_OLD_OP_12))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 (clobber (match_scratch:SI 4 "=&d"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
146 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
147 [(set_attr "sync_insn1" "<insn>")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
148 (set_attr "sync_insn2" "and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
149 (set_attr "sync_mem" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
150 (set_attr "sync_inclusive_mask" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
151 (set_attr "sync_exclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
152 (set_attr "sync_insn1_op2" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
153 (set_attr "sync_oldval" "4")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
154 (set_attr "sync_newval" "4")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 (define_expand "sync_old_<optab><mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 [(parallel [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 (set (match_operand:SHORT 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 (match_operand:SHORT 1 "memory_operand"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 (unspec_volatile:SHORT [(atomic_hiqi_op:SHORT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 (match_operand:SHORT 2 "general_operand"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 UNSPEC_SYNC_OLD_OP))])]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 generator.fn_5 = gen_sync_old_<optab>_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 operands[0], operands[1], operands[2], NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 ;; Helper insn for sync_old_<optab><mode>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 (define_insn "sync_old_<optab>_12"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 [(set (match_operand:SI 0 "register_operand" "=&d")
111
kono
parents: 67
diff changeset
177 (match_operand:SI 1 "memory_operand" "+ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 (unspec_volatile:SI
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 [(match_operand:SI 2 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 (match_operand:SI 3 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 (atomic_hiqi_op:SI (match_dup 0)
111
kono
parents: 67
diff changeset
183 (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 UNSPEC_SYNC_OLD_OP_12))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 (clobber (match_scratch:SI 5 "=&d"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
187 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
188 [(set_attr "sync_insn1" "<insn>")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
189 (set_attr "sync_insn2" "and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
190 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
191 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
192 (set_attr "sync_inclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
193 (set_attr "sync_exclusive_mask" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
194 (set_attr "sync_insn1_op2" "4")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
195 (set_attr "sync_newval" "5")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 (define_expand "sync_new_<optab><mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 [(parallel [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 (set (match_operand:SHORT 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 (unspec_volatile:SHORT [(atomic_hiqi_op:SHORT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 (match_operand:SHORT 1 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 (match_operand:SHORT 2 "general_operand"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 UNSPEC_SYNC_NEW_OP))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 (unspec_volatile:SHORT [(match_dup 1) (match_dup 2)]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 UNSPEC_SYNC_NEW_OP))])]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 generator.fn_5 = gen_sync_new_<optab>_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 operands[0], operands[1], operands[2], NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 ;; Helper insn for sync_new_<optab><mode>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 (define_insn "sync_new_<optab>_12"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 [(set (match_operand:SI 0 "register_operand" "=&d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 (unspec_volatile:SI
111
kono
parents: 67
diff changeset
220 [(match_operand:SI 1 "memory_operand" "+ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 (match_operand:SI 2 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 (match_operand:SI 3 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 (atomic_hiqi_op:SI (match_dup 0)
111
kono
parents: 67
diff changeset
224 (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 UNSPEC_SYNC_NEW_OP_12))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 (unspec_volatile:SI
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 [(match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 (match_dup 2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 (match_dup 3)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 (match_dup 4)] UNSPEC_SYNC_NEW_OP_12))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
233 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
234 [(set_attr "sync_insn1" "<insn>")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
235 (set_attr "sync_insn2" "and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
236 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
237 (set_attr "sync_newval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
238 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
239 (set_attr "sync_inclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
240 (set_attr "sync_exclusive_mask" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
241 (set_attr "sync_insn1_op2" "4")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
242
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
243 (define_expand "sync_nand<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
244 [(set (match_operand:SHORT 0 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 (unspec_volatile:SHORT
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246 [(match_dup 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 (match_operand:SHORT 1 "general_operand")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 generator.fn_4 = gen_sync_nand_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 NULL, operands[0], operands[1], NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 ;; Helper insn for sync_nand<mode>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259 (define_insn "sync_nand_12"
111
kono
parents: 67
diff changeset
260 [(set (match_operand:SI 0 "memory_operand" "+ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 (unspec_volatile:SI
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 [(match_operand:SI 1 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 (match_operand:SI 2 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 (match_dup 0)
111
kono
parents: 67
diff changeset
265 (match_operand:SI 3 "reg_or_0_operand" "dJ")]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 UNSPEC_SYNC_OLD_OP_12))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 (clobber (match_scratch:SI 4 "=&d"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
269 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
270 [(set_attr "sync_insn1" "and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
271 (set_attr "sync_insn2" "xor")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
272 (set_attr "sync_mem" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
273 (set_attr "sync_inclusive_mask" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
274 (set_attr "sync_exclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
275 (set_attr "sync_insn1_op2" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
276 (set_attr "sync_oldval" "4")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
277 (set_attr "sync_newval" "4")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 (define_expand "sync_old_nand<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 [(parallel [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 (set (match_operand:SHORT 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 (match_operand:SHORT 1 "memory_operand"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 (unspec_volatile:SHORT [(match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 (match_operand:SHORT 2 "general_operand")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 UNSPEC_SYNC_OLD_OP))])]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 generator.fn_5 = gen_sync_old_nand_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 operands[0], operands[1], operands[2], NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 ;; Helper insn for sync_old_nand<mode>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 (define_insn "sync_old_nand_12"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 [(set (match_operand:SI 0 "register_operand" "=&d")
111
kono
parents: 67
diff changeset
299 (match_operand:SI 1 "memory_operand" "+ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 (unspec_volatile:SI
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 [(match_operand:SI 2 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 (match_operand:SI 3 "register_operand" "d")
111
kono
parents: 67
diff changeset
304 (match_operand:SI 4 "reg_or_0_operand" "dJ")]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 UNSPEC_SYNC_OLD_OP_12))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 (clobber (match_scratch:SI 5 "=&d"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
308 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
309 [(set_attr "sync_insn1" "and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
310 (set_attr "sync_insn2" "xor")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
311 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
312 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
313 (set_attr "sync_inclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
314 (set_attr "sync_exclusive_mask" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
315 (set_attr "sync_insn1_op2" "4")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
316 (set_attr "sync_newval" "5")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
317
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
318 (define_expand "sync_new_nand<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 [(parallel [
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 (set (match_operand:SHORT 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 (unspec_volatile:SHORT [(match_operand:SHORT 1 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 (match_operand:SHORT 2 "general_operand")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 UNSPEC_SYNC_NEW_OP))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 (unspec_volatile:SHORT [(match_dup 1) (match_dup 2)]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 UNSPEC_SYNC_NEW_OP))])]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 generator.fn_5 = gen_sync_new_nand_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 operands[0], operands[1], operands[2], NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
335
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 ;; Helper insn for sync_new_nand<mode>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 (define_insn "sync_new_nand_12"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 [(set (match_operand:SI 0 "register_operand" "=&d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 (unspec_volatile:SI
111
kono
parents: 67
diff changeset
340 [(match_operand:SI 1 "memory_operand" "+ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
341 (match_operand:SI 2 "register_operand" "d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
342 (match_operand:SI 3 "register_operand" "d")
111
kono
parents: 67
diff changeset
343 (match_operand:SI 4 "reg_or_0_operand" "dJ")]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 UNSPEC_SYNC_NEW_OP_12))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
346 (unspec_volatile:SI
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 [(match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 (match_dup 2)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 (match_dup 3)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 (match_dup 4)] UNSPEC_SYNC_NEW_OP_12))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
352 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
353 [(set_attr "sync_insn1" "and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
354 (set_attr "sync_insn2" "xor")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
355 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
356 (set_attr "sync_newval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
357 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
358 (set_attr "sync_inclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
359 (set_attr "sync_exclusive_mask" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
360 (set_attr "sync_insn1_op2" "4")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
361
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 (define_insn "sync_sub<mode>"
111
kono
parents: 67
diff changeset
363 [(set (match_operand:GPR 0 "memory_operand" "+ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
365 [(minus:GPR (match_dup 0)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
366 (match_operand:GPR 1 "register_operand" "d"))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
368 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
369 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
370 [(set_attr "sync_insn1" "subu")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
371 (set_attr "sync_mem" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
372 (set_attr "sync_insn1_op2" "1")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373
111
kono
parents: 67
diff changeset
374 ;; Can be removed in favor of atomic_fetch_add below.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 (define_insn "sync_old_add<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
377 (match_operand:GPR 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 [(plus:GPR (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 (match_operand:GPR 2 "arith_operand" "I,d"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
384 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
385 [(set_attr "sync_insn1" "addiu,addu")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
386 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
387 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
388 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
389
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 (define_insn "sync_old_sub<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 [(set (match_operand:GPR 0 "register_operand" "=&d")
111
kono
parents: 67
diff changeset
392 (match_operand:GPR 1 "memory_operand" "+ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 [(minus:GPR (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 (match_operand:GPR 2 "register_operand" "d"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
399 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
400 [(set_attr "sync_insn1" "subu")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
401 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
402 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
403 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
404
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 (define_insn "sync_new_add<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
407 (plus:GPR (match_operand:GPR 1 "memory_operand" "+ZC,ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 (match_operand:GPR 2 "arith_operand" "I,d")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 [(plus:GPR (match_dup 1) (match_dup 2))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 UNSPEC_SYNC_NEW_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
414 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
415 [(set_attr "sync_insn1" "addiu,addu")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
416 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
417 (set_attr "sync_newval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
418 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
419 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
420
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
421 (define_insn "sync_new_sub<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
422 [(set (match_operand:GPR 0 "register_operand" "=&d")
111
kono
parents: 67
diff changeset
423 (minus:GPR (match_operand:GPR 1 "memory_operand" "+ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
424 (match_operand:GPR 2 "register_operand" "d")))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
425 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
426 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 [(minus:GPR (match_dup 1) (match_dup 2))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
428 UNSPEC_SYNC_NEW_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
429 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
430 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
431 [(set_attr "sync_insn1" "subu")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
432 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
433 (set_attr "sync_newval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
434 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
435 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
437 (define_insn "sync_<optab><mode>"
111
kono
parents: 67
diff changeset
438 [(set (match_operand:GPR 0 "memory_operand" "+ZC,ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 [(fetchop_bit:GPR (match_operand:GPR 1 "uns_arith_operand" "K,d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
441 (match_dup 0))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
443 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
444 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
445 [(set_attr "sync_insn1" "<immediate_insn>,<insn>")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
446 (set_attr "sync_mem" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
447 (set_attr "sync_insn1_op2" "1")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 (define_insn "sync_old_<optab><mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
451 (match_operand:GPR 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 [(fetchop_bit:GPR (match_operand:GPR 2 "uns_arith_operand" "K,d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 (match_dup 1))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
456 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
458 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
459 [(set_attr "sync_insn1" "<immediate_insn>,<insn>")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
460 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
461 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
462 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
463
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 (define_insn "sync_new_<optab><mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
466 (match_operand:GPR 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468 (unspec_volatile:GPR
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 [(fetchop_bit:GPR (match_operand:GPR 2 "uns_arith_operand" "K,d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 (match_dup 1))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471 UNSPEC_SYNC_NEW_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
473 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
474 [(set_attr "sync_insn1" "<immediate_insn>,<insn>")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
475 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
476 (set_attr "sync_newval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
477 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
478 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 (define_insn "sync_nand<mode>"
111
kono
parents: 67
diff changeset
481 [(set (match_operand:GPR 0 "memory_operand" "+ZC,ZC")
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 (unspec_volatile:GPR [(match_operand:GPR 1 "uns_arith_operand" "K,d")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
485 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
486 [(set_attr "sync_insn1" "andi,and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
487 (set_attr "sync_insn2" "not")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
488 (set_attr "sync_mem" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
489 (set_attr "sync_insn1_op2" "1")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491 (define_insn "sync_old_nand<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
493 (match_operand:GPR 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 (unspec_volatile:GPR [(match_operand:GPR 2 "uns_arith_operand" "K,d")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 UNSPEC_SYNC_OLD_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
498 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
499 [(set_attr "sync_insn1" "andi,and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
500 (set_attr "sync_insn2" "not")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
501 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
502 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
503 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 (define_insn "sync_new_nand<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
507 (match_operand:GPR 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 (unspec_volatile:GPR [(match_operand:GPR 2 "uns_arith_operand" "K,d")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 UNSPEC_SYNC_NEW_OP))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
512 { return mips_output_sync_loop (insn, operands); }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
513 [(set_attr "sync_insn1" "andi,and")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
514 (set_attr "sync_insn2" "not")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
515 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
516 (set_attr "sync_newval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
517 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
518 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 (define_insn "sync_lock_test_and_set<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
111
kono
parents: 67
diff changeset
522 (match_operand:GPR 1 "memory_operand" "+ZC,ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 (set (match_dup 1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 (unspec_volatile:GPR [(match_operand:GPR 2 "arith_operand" "I,d")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 UNSPEC_SYNC_EXCHANGE))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
527 { return mips_output_sync_loop (insn, operands); }
111
kono
parents: 67
diff changeset
528 [(set_attr "sync_memmodel" "11")
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
529 (set_attr "sync_insn1" "li,move")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
530 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
531 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
532 (set_attr "sync_insn1_op2" "2")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534 (define_expand "sync_lock_test_and_set<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535 [(match_operand:SHORT 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
536 (match_operand:SHORT 1 "memory_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
537 (match_operand:SHORT 2 "general_operand")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
538 "GENERATE_LL_SC"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
539 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
540 union mips_gen_fn_ptrs generator;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
541 generator.fn_5 = gen_test_and_set_12;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
542 mips_expand_atomic_qihi (generator,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
543 operands[0], operands[1], operands[2], NULL);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 (define_insn "test_and_set_12"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
548 [(set (match_operand:SI 0 "register_operand" "=&d")
111
kono
parents: 67
diff changeset
549 (match_operand:SI 1 "memory_operand" "+ZC"))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 (set (match_dup 1)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
551 (unspec_volatile:SI [(match_operand:SI 2 "register_operand" "d")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
552 (match_operand:SI 3 "register_operand" "d")
111
kono
parents: 67
diff changeset
553 (match_operand:SI 4 "reg_or_0_operand" "dJ")]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 UNSPEC_SYNC_EXCHANGE_12))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 "GENERATE_LL_SC"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
556 { return mips_output_sync_loop (insn, operands); }
111
kono
parents: 67
diff changeset
557 [(set_attr "sync_memmodel" "11")
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
558 (set_attr "sync_oldval" "0")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
559 (set_attr "sync_mem" "1")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
560 ;; Unused, but needed to give the number of operands expected by
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
561 ;; the expander.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
562 (set_attr "sync_inclusive_mask" "2")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
563 (set_attr "sync_exclusive_mask" "3")
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
564 (set_attr "sync_insn1_op2" "4")])
111
kono
parents: 67
diff changeset
565
kono
parents: 67
diff changeset
566 (define_insn "atomic_compare_and_swap<mode>"
kono
parents: 67
diff changeset
567 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
kono
parents: 67
diff changeset
568 ;; Logically this unspec is an "eq" operator, but we need to obscure
kono
parents: 67
diff changeset
569 ;; reads and writes from/to memory with an unspec to prevent
kono
parents: 67
diff changeset
570 ;; optimizations on shared memory locations. Otherwise, comparison in
kono
parents: 67
diff changeset
571 ;; { mem = 2; if (atomic_cmp_swap(mem,...) == 2) ...; }
kono
parents: 67
diff changeset
572 ;; would be optimized away. In addition to that we need to use
kono
parents: 67
diff changeset
573 ;; unspec_volatile, not just plain unspec -- for the sake of other
kono
parents: 67
diff changeset
574 ;; threads -- to make sure we don't remove the entirety of the pattern
kono
parents: 67
diff changeset
575 ;; just because current thread doesn't observe any effect from it.
kono
parents: 67
diff changeset
576 ;; TODO: the obscuring unspec can be relaxed for permissive memory
kono
parents: 67
diff changeset
577 ;; models.
kono
parents: 67
diff changeset
578 ;; Same applies to other atomic_* patterns.
kono
parents: 67
diff changeset
579 (unspec_volatile:GPR [(match_operand:GPR 2 "memory_operand" "+ZC,ZC")
kono
parents: 67
diff changeset
580 (match_operand:GPR 3 "reg_or_0_operand" "dJ,dJ")]
kono
parents: 67
diff changeset
581 UNSPEC_ATOMIC_COMPARE_AND_SWAP))
kono
parents: 67
diff changeset
582 (set (match_operand:GPR 1 "register_operand" "=&d,&d")
kono
parents: 67
diff changeset
583 (unspec_volatile:GPR [(match_dup 2)]
kono
parents: 67
diff changeset
584 UNSPEC_ATOMIC_COMPARE_AND_SWAP))
kono
parents: 67
diff changeset
585 (set (match_dup 2)
kono
parents: 67
diff changeset
586 (unspec_volatile:GPR [(match_dup 2)
kono
parents: 67
diff changeset
587 (match_dup 3)
kono
parents: 67
diff changeset
588 (match_operand:GPR 4 "arith_operand" "I,d")]
kono
parents: 67
diff changeset
589 UNSPEC_ATOMIC_COMPARE_AND_SWAP))
kono
parents: 67
diff changeset
590 (unspec_volatile:GPR [(match_operand:SI 5 "const_int_operand")
kono
parents: 67
diff changeset
591 (match_operand:SI 6 "const_int_operand")
kono
parents: 67
diff changeset
592 (match_operand:SI 7 "const_int_operand")]
kono
parents: 67
diff changeset
593 UNSPEC_ATOMIC_COMPARE_AND_SWAP)]
kono
parents: 67
diff changeset
594 "GENERATE_LL_SC"
kono
parents: 67
diff changeset
595 { return mips_output_sync_loop (insn, operands); }
kono
parents: 67
diff changeset
596 [(set_attr "sync_insn1" "li,move")
kono
parents: 67
diff changeset
597 (set_attr "sync_oldval" "1")
kono
parents: 67
diff changeset
598 (set_attr "sync_cmp" "0")
kono
parents: 67
diff changeset
599 (set_attr "sync_mem" "2")
kono
parents: 67
diff changeset
600 (set_attr "sync_required_oldval" "3")
kono
parents: 67
diff changeset
601 (set_attr "sync_insn1_op2" "4")
kono
parents: 67
diff changeset
602 (set_attr "sync_memmodel" "6")])
kono
parents: 67
diff changeset
603
kono
parents: 67
diff changeset
604 (define_expand "atomic_exchange<mode>"
kono
parents: 67
diff changeset
605 [(match_operand:GPR 0 "register_operand")
kono
parents: 67
diff changeset
606 (match_operand:GPR 1 "memory_operand")
kono
parents: 67
diff changeset
607 (match_operand:GPR 2 "arith_operand")
kono
parents: 67
diff changeset
608 (match_operand:SI 3 "const_int_operand")]
kono
parents: 67
diff changeset
609 "GENERATE_LL_SC || ISA_HAS_SWAP"
kono
parents: 67
diff changeset
610 {
kono
parents: 67
diff changeset
611 if (ISA_HAS_SWAP)
kono
parents: 67
diff changeset
612 {
kono
parents: 67
diff changeset
613 if (!mem_noofs_operand (operands[1], <MODE>mode))
kono
parents: 67
diff changeset
614 {
kono
parents: 67
diff changeset
615 rtx addr;
kono
parents: 67
diff changeset
616
kono
parents: 67
diff changeset
617 addr = force_reg (Pmode, XEXP (operands[1], 0));
kono
parents: 67
diff changeset
618 operands[1] = replace_equiv_address (operands[1], addr);
kono
parents: 67
diff changeset
619 }
kono
parents: 67
diff changeset
620 operands[2] = force_reg (<MODE>mode, operands[2]);
kono
parents: 67
diff changeset
621 emit_insn (gen_atomic_exchange<mode>_swap (operands[0], operands[1],
kono
parents: 67
diff changeset
622 operands[2]));
kono
parents: 67
diff changeset
623 }
kono
parents: 67
diff changeset
624 else
kono
parents: 67
diff changeset
625 emit_insn (gen_atomic_exchange<mode>_llsc (operands[0], operands[1],
kono
parents: 67
diff changeset
626 operands[2], operands[3]));
kono
parents: 67
diff changeset
627 DONE;
kono
parents: 67
diff changeset
628 })
kono
parents: 67
diff changeset
629
kono
parents: 67
diff changeset
630 (define_insn "atomic_exchange<mode>_llsc"
kono
parents: 67
diff changeset
631 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
kono
parents: 67
diff changeset
632 (unspec_volatile:GPR [(match_operand:GPR 1 "memory_operand" "+ZC,ZC")]
kono
parents: 67
diff changeset
633 UNSPEC_ATOMIC_EXCHANGE))
kono
parents: 67
diff changeset
634 (set (match_dup 1)
kono
parents: 67
diff changeset
635 (unspec_volatile:GPR [(match_operand:GPR 2 "arith_operand" "I,d")]
kono
parents: 67
diff changeset
636 UNSPEC_ATOMIC_EXCHANGE))
kono
parents: 67
diff changeset
637 (unspec_volatile:GPR [(match_operand:SI 3 "const_int_operand")]
kono
parents: 67
diff changeset
638 UNSPEC_ATOMIC_EXCHANGE)]
kono
parents: 67
diff changeset
639 "GENERATE_LL_SC && !ISA_HAS_SWAP"
kono
parents: 67
diff changeset
640 { return mips_output_sync_loop (insn, operands); }
kono
parents: 67
diff changeset
641 [(set_attr "sync_insn1" "li,move")
kono
parents: 67
diff changeset
642 (set_attr "sync_oldval" "0")
kono
parents: 67
diff changeset
643 (set_attr "sync_mem" "1")
kono
parents: 67
diff changeset
644 (set_attr "sync_insn1_op2" "2")
kono
parents: 67
diff changeset
645 (set_attr "sync_memmodel" "3")])
kono
parents: 67
diff changeset
646
kono
parents: 67
diff changeset
647 ;; XLP issues implicit sync for SWAP/LDADD, so no need for an explicit one.
kono
parents: 67
diff changeset
648 (define_insn "atomic_exchange<mode>_swap"
kono
parents: 67
diff changeset
649 [(set (match_operand:GPR 0 "register_operand" "=d")
kono
parents: 67
diff changeset
650 (unspec_volatile:GPR [(match_operand:GPR 1 "mem_noofs_operand" "+ZR")]
kono
parents: 67
diff changeset
651 UNSPEC_ATOMIC_EXCHANGE))
kono
parents: 67
diff changeset
652 (set (match_dup 1)
kono
parents: 67
diff changeset
653 (unspec_volatile:GPR [(match_operand:GPR 2 "register_operand" "0")]
kono
parents: 67
diff changeset
654 UNSPEC_ATOMIC_EXCHANGE))]
kono
parents: 67
diff changeset
655 "ISA_HAS_SWAP"
kono
parents: 67
diff changeset
656 "swap<size>\t%0,%b1"
kono
parents: 67
diff changeset
657 [(set_attr "type" "atomic")])
kono
parents: 67
diff changeset
658
kono
parents: 67
diff changeset
659 (define_expand "atomic_fetch_add<mode>"
kono
parents: 67
diff changeset
660 [(match_operand:GPR 0 "register_operand")
kono
parents: 67
diff changeset
661 (match_operand:GPR 1 "memory_operand")
kono
parents: 67
diff changeset
662 (match_operand:GPR 2 "arith_operand")
kono
parents: 67
diff changeset
663 (match_operand:SI 3 "const_int_operand")]
kono
parents: 67
diff changeset
664 "GENERATE_LL_SC || ISA_HAS_LDADD"
kono
parents: 67
diff changeset
665 {
kono
parents: 67
diff changeset
666 if (ISA_HAS_LDADD)
kono
parents: 67
diff changeset
667 {
kono
parents: 67
diff changeset
668 if (!mem_noofs_operand (operands[1], <MODE>mode))
kono
parents: 67
diff changeset
669 {
kono
parents: 67
diff changeset
670 rtx addr;
kono
parents: 67
diff changeset
671
kono
parents: 67
diff changeset
672 addr = force_reg (Pmode, XEXP (operands[1], 0));
kono
parents: 67
diff changeset
673 operands[1] = replace_equiv_address (operands[1], addr);
kono
parents: 67
diff changeset
674 }
kono
parents: 67
diff changeset
675 operands[2] = force_reg (<MODE>mode, operands[2]);
kono
parents: 67
diff changeset
676 emit_insn (gen_atomic_fetch_add<mode>_ldadd (operands[0], operands[1],
kono
parents: 67
diff changeset
677 operands[2]));
kono
parents: 67
diff changeset
678 }
kono
parents: 67
diff changeset
679 else
kono
parents: 67
diff changeset
680 emit_insn (gen_atomic_fetch_add<mode>_llsc (operands[0], operands[1],
kono
parents: 67
diff changeset
681 operands[2], operands[3]));
kono
parents: 67
diff changeset
682 DONE;
kono
parents: 67
diff changeset
683 })
kono
parents: 67
diff changeset
684
kono
parents: 67
diff changeset
685 (define_insn "atomic_fetch_add<mode>_llsc"
kono
parents: 67
diff changeset
686 [(set (match_operand:GPR 0 "register_operand" "=&d,&d")
kono
parents: 67
diff changeset
687 (unspec_volatile:GPR [(match_operand:GPR 1 "memory_operand" "+ZC,ZC")]
kono
parents: 67
diff changeset
688 UNSPEC_ATOMIC_FETCH_OP))
kono
parents: 67
diff changeset
689 (set (match_dup 1)
kono
parents: 67
diff changeset
690 (unspec_volatile:GPR
kono
parents: 67
diff changeset
691 [(plus:GPR (match_dup 1)
kono
parents: 67
diff changeset
692 (match_operand:GPR 2 "arith_operand" "I,d"))]
kono
parents: 67
diff changeset
693 UNSPEC_ATOMIC_FETCH_OP))
kono
parents: 67
diff changeset
694 (unspec_volatile:GPR [(match_operand:SI 3 "const_int_operand")]
kono
parents: 67
diff changeset
695 UNSPEC_ATOMIC_FETCH_OP)]
kono
parents: 67
diff changeset
696 "GENERATE_LL_SC && !ISA_HAS_LDADD"
kono
parents: 67
diff changeset
697 { return mips_output_sync_loop (insn, operands); }
kono
parents: 67
diff changeset
698 [(set_attr "sync_insn1" "addiu,addu")
kono
parents: 67
diff changeset
699 (set_attr "sync_oldval" "0")
kono
parents: 67
diff changeset
700 (set_attr "sync_mem" "1")
kono
parents: 67
diff changeset
701 (set_attr "sync_insn1_op2" "2")
kono
parents: 67
diff changeset
702 (set_attr "sync_memmodel" "3")])
kono
parents: 67
diff changeset
703
kono
parents: 67
diff changeset
704 ;; XLP issues implicit sync for SWAP/LDADD, so no need for an explicit one.
kono
parents: 67
diff changeset
705 (define_insn "atomic_fetch_add<mode>_ldadd"
kono
parents: 67
diff changeset
706 [(set (match_operand:GPR 0 "register_operand" "=d")
kono
parents: 67
diff changeset
707 (unspec_volatile:GPR [(match_operand:GPR 1 "mem_noofs_operand" "+ZR")]
kono
parents: 67
diff changeset
708 UNSPEC_ATOMIC_FETCH_OP))
kono
parents: 67
diff changeset
709 (set (match_dup 1)
kono
parents: 67
diff changeset
710 (unspec_volatile:GPR
kono
parents: 67
diff changeset
711 [(plus:GPR (match_dup 1)
kono
parents: 67
diff changeset
712 (match_operand:GPR 2 "register_operand" "0"))]
kono
parents: 67
diff changeset
713 UNSPEC_ATOMIC_FETCH_OP))]
kono
parents: 67
diff changeset
714 "ISA_HAS_LDADD"
kono
parents: 67
diff changeset
715 "ldadd<size>\t%0,%b1"
kono
parents: 67
diff changeset
716 [(set_attr "type" "atomic")])