1
2
3
4
5 package main
6
7 import "strings"
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 var regNamesLOONG64 = []string{
32 "R0",
33 "R1",
34 "SP",
35 "R4",
36 "R5",
37 "R6",
38 "R7",
39 "R8",
40 "R9",
41 "R10",
42 "R11",
43 "R12",
44 "R13",
45 "R14",
46 "R15",
47 "R16",
48 "R17",
49 "R18",
50 "R19",
51 "R20",
52 "R21",
53 "g",
54 "R23",
55 "R24",
56 "R25",
57 "R26",
58 "R27",
59 "R28",
60 "R29",
61
62 "R31",
63
64 "F0",
65 "F1",
66 "F2",
67 "F3",
68 "F4",
69 "F5",
70 "F6",
71 "F7",
72 "F8",
73 "F9",
74 "F10",
75 "F11",
76 "F12",
77 "F13",
78 "F14",
79 "F15",
80 "F16",
81 "F17",
82 "F18",
83 "F19",
84 "F20",
85 "F21",
86 "F22",
87 "F23",
88 "F24",
89 "F25",
90 "F26",
91 "F27",
92 "F28",
93 "F29",
94 "F30",
95 "F31",
96
97
98
99
100 "SB",
101 }
102
103 func init() {
104
105 if len(regNamesLOONG64) > 64 {
106 panic("too many registers")
107 }
108 num := map[string]int{}
109 for i, name := range regNamesLOONG64 {
110 num[name] = i
111 }
112 buildReg := func(s string) regMask {
113 m := regMask(0)
114 for _, r := range strings.Split(s, " ") {
115 if n, ok := num[r]; ok {
116 m |= regMask(1) << uint(n)
117 continue
118 }
119 panic("register " + r + " not found")
120 }
121 return m
122 }
123
124
125 var (
126 gp = buildReg("R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19 R20 R21 R23 R24 R25 R26 R27 R28 R29 R31")
127 gpg = gp | buildReg("g")
128 gpsp = gp | buildReg("SP")
129 gpspg = gpg | buildReg("SP")
130 gpspsbg = gpspg | buildReg("SB")
131 fp = buildReg("F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31")
132 callerSave = gp | fp | buildReg("g")
133 r1 = buildReg("R20")
134 r2 = buildReg("R21")
135 r3 = buildReg("R23")
136 r4 = buildReg("R24")
137 )
138
139 var (
140 gp01 = regInfo{inputs: nil, outputs: []regMask{gp}}
141 gp11 = regInfo{inputs: []regMask{gpg}, outputs: []regMask{gp}}
142 gp11sp = regInfo{inputs: []regMask{gpspg}, outputs: []regMask{gp}}
143 gp21 = regInfo{inputs: []regMask{gpg, gpg}, outputs: []regMask{gp}}
144 gpload = regInfo{inputs: []regMask{gpspsbg}, outputs: []regMask{gp}}
145 gp2load = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{gp}}
146 gpstore = regInfo{inputs: []regMask{gpspsbg, gpg}}
147 gpstore0 = regInfo{inputs: []regMask{gpspsbg}}
148 gpstore2 = regInfo{inputs: []regMask{gpspsbg, gpg, gpg}}
149 gpxchg = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{gp}}
150 gpcas = regInfo{inputs: []regMask{gpspsbg, gpg, gpg}, outputs: []regMask{gp}}
151 fp01 = regInfo{inputs: nil, outputs: []regMask{fp}}
152 fp11 = regInfo{inputs: []regMask{fp}, outputs: []regMask{fp}}
153 fp21 = regInfo{inputs: []regMask{fp, fp}, outputs: []regMask{fp}}
154 fp31 = regInfo{inputs: []regMask{fp, fp, fp}, outputs: []regMask{fp}}
155 fp2flags = regInfo{inputs: []regMask{fp, fp}}
156 fpload = regInfo{inputs: []regMask{gpspsbg}, outputs: []regMask{fp}}
157 fp2load = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{fp}}
158 fpstore = regInfo{inputs: []regMask{gpspsbg, fp}}
159 fpstore2 = regInfo{inputs: []regMask{gpspsbg, gpg, fp}}
160 fpgp = regInfo{inputs: []regMask{fp}, outputs: []regMask{gp}}
161 gpfp = regInfo{inputs: []regMask{gp}, outputs: []regMask{fp}}
162 readflags = regInfo{inputs: nil, outputs: []regMask{gp}}
163 )
164 ops := []opData{
165
166 {name: "NEGV", argLength: 1, reg: gp11},
167 {name: "NEGF", argLength: 1, reg: fp11, asm: "NEGF"},
168 {name: "NEGD", argLength: 1, reg: fp11, asm: "NEGD"},
169
170 {name: "SQRTD", argLength: 1, reg: fp11, asm: "SQRTD"},
171 {name: "SQRTF", argLength: 1, reg: fp11, asm: "SQRTF"},
172
173 {name: "ABSD", argLength: 1, reg: fp11, asm: "ABSD"},
174
175 {name: "CLZW", argLength: 1, reg: gp11, asm: "CLZW"},
176 {name: "CLZV", argLength: 1, reg: gp11, asm: "CLZV"},
177 {name: "CTZW", argLength: 1, reg: gp11, asm: "CTZW"},
178 {name: "CTZV", argLength: 1, reg: gp11, asm: "CTZV"},
179
180 {name: "REVB2H", argLength: 1, reg: gp11, asm: "REVB2H"},
181 {name: "REVB2W", argLength: 1, reg: gp11, asm: "REVB2W"},
182 {name: "REVBV", argLength: 1, reg: gp11, asm: "REVBV"},
183
184 {name: "BITREV4B", argLength: 1, reg: gp11, asm: "BITREV4B"},
185 {name: "BITREVW", argLength: 1, reg: gp11, asm: "BITREVW"},
186 {name: "BITREVV", argLength: 1, reg: gp11, asm: "BITREVV"},
187
188 {name: "VPCNT64", argLength: 1, reg: fp11, asm: "VPCNTV"},
189 {name: "VPCNT32", argLength: 1, reg: fp11, asm: "VPCNTW"},
190 {name: "VPCNT16", argLength: 1, reg: fp11, asm: "VPCNTH"},
191
192
193 {name: "ADDV", argLength: 2, reg: gp21, asm: "ADDVU", commutative: true},
194 {name: "ADDVconst", argLength: 1, reg: gp11sp, asm: "ADDVU", aux: "Int64"},
195 {name: "SUBV", argLength: 2, reg: gp21, asm: "SUBVU"},
196 {name: "SUBVconst", argLength: 1, reg: gp11, asm: "SUBVU", aux: "Int64"},
197
198 {name: "MULV", argLength: 2, reg: gp21, asm: "MULV", commutative: true, typ: "Int64"},
199 {name: "MULHV", argLength: 2, reg: gp21, asm: "MULHV", commutative: true, typ: "Int64"},
200 {name: "MULHVU", argLength: 2, reg: gp21, asm: "MULHVU", commutative: true, typ: "UInt64"},
201 {name: "DIVV", argLength: 2, reg: gp21, asm: "DIVV", typ: "Int64"},
202 {name: "DIVVU", argLength: 2, reg: gp21, asm: "DIVVU", typ: "UInt64"},
203 {name: "REMV", argLength: 2, reg: gp21, asm: "REMV", typ: "Int64"},
204 {name: "REMVU", argLength: 2, reg: gp21, asm: "REMVU", typ: "UInt64"},
205
206 {name: "ADDF", argLength: 2, reg: fp21, asm: "ADDF", commutative: true},
207 {name: "ADDD", argLength: 2, reg: fp21, asm: "ADDD", commutative: true},
208 {name: "SUBF", argLength: 2, reg: fp21, asm: "SUBF"},
209 {name: "SUBD", argLength: 2, reg: fp21, asm: "SUBD"},
210 {name: "MULF", argLength: 2, reg: fp21, asm: "MULF", commutative: true},
211 {name: "MULD", argLength: 2, reg: fp21, asm: "MULD", commutative: true},
212 {name: "DIVF", argLength: 2, reg: fp21, asm: "DIVF"},
213 {name: "DIVD", argLength: 2, reg: fp21, asm: "DIVD"},
214
215 {name: "AND", argLength: 2, reg: gp21, asm: "AND", commutative: true},
216 {name: "ANDconst", argLength: 1, reg: gp11, asm: "AND", aux: "Int64"},
217 {name: "OR", argLength: 2, reg: gp21, asm: "OR", commutative: true},
218 {name: "ORconst", argLength: 1, reg: gp11, asm: "OR", aux: "Int64"},
219 {name: "XOR", argLength: 2, reg: gp21, asm: "XOR", commutative: true, typ: "UInt64"},
220 {name: "XORconst", argLength: 1, reg: gp11, asm: "XOR", aux: "Int64", typ: "UInt64"},
221 {name: "NOR", argLength: 2, reg: gp21, asm: "NOR", commutative: true},
222 {name: "NORconst", argLength: 1, reg: gp11, asm: "NOR", aux: "Int64"},
223
224 {name: "FMADDF", argLength: 3, reg: fp31, asm: "FMADDF", commutative: true, typ: "Float32"},
225 {name: "FMADDD", argLength: 3, reg: fp31, asm: "FMADDD", commutative: true, typ: "Float64"},
226 {name: "FMSUBF", argLength: 3, reg: fp31, asm: "FMSUBF", commutative: true, typ: "Float32"},
227 {name: "FMSUBD", argLength: 3, reg: fp31, asm: "FMSUBD", commutative: true, typ: "Float64"},
228 {name: "FNMADDF", argLength: 3, reg: fp31, asm: "FNMADDF", commutative: true, typ: "Float32"},
229 {name: "FNMADDD", argLength: 3, reg: fp31, asm: "FNMADDD", commutative: true, typ: "Float64"},
230 {name: "FNMSUBF", argLength: 3, reg: fp31, asm: "FNMSUBF", commutative: true, typ: "Float32"},
231 {name: "FNMSUBD", argLength: 3, reg: fp31, asm: "FNMSUBD", commutative: true, typ: "Float64"},
232
233 {name: "FMINF", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMINF", commutative: true, typ: "Float32"},
234 {name: "FMIND", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMIND", commutative: true, typ: "Float64"},
235 {name: "FMAXF", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMAXF", commutative: true, typ: "Float32"},
236 {name: "FMAXD", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMAXD", commutative: true, typ: "Float64"},
237
238 {name: "MASKEQZ", argLength: 2, reg: gp21, asm: "MASKEQZ"},
239 {name: "MASKNEZ", argLength: 2, reg: gp21, asm: "MASKNEZ"},
240 {name: "FCOPYSGD", argLength: 2, reg: fp21, asm: "FCOPYSGD"},
241
242
243 {name: "SLLV", argLength: 2, reg: gp21, asm: "SLLV"},
244 {name: "SLLVconst", argLength: 1, reg: gp11, asm: "SLLV", aux: "Int64"},
245 {name: "SRLV", argLength: 2, reg: gp21, asm: "SRLV"},
246 {name: "SRLVconst", argLength: 1, reg: gp11, asm: "SRLV", aux: "Int64"},
247 {name: "SRAV", argLength: 2, reg: gp21, asm: "SRAV"},
248 {name: "SRAVconst", argLength: 1, reg: gp11, asm: "SRAV", aux: "Int64"},
249 {name: "ROTR", argLength: 2, reg: gp21, asm: "ROTR"},
250 {name: "ROTRV", argLength: 2, reg: gp21, asm: "ROTRV"},
251 {name: "ROTRconst", argLength: 1, reg: gp11, asm: "ROTR", aux: "Int64"},
252 {name: "ROTRVconst", argLength: 1, reg: gp11, asm: "ROTRV", aux: "Int64"},
253
254
255 {name: "SGT", argLength: 2, reg: gp21, asm: "SGT", typ: "Bool"},
256 {name: "SGTconst", argLength: 1, reg: gp11, asm: "SGT", aux: "Int64", typ: "Bool"},
257 {name: "SGTU", argLength: 2, reg: gp21, asm: "SGTU", typ: "Bool"},
258 {name: "SGTUconst", argLength: 1, reg: gp11, asm: "SGTU", aux: "Int64", typ: "Bool"},
259
260 {name: "CMPEQF", argLength: 2, reg: fp2flags, asm: "CMPEQF", typ: "Flags"},
261 {name: "CMPEQD", argLength: 2, reg: fp2flags, asm: "CMPEQD", typ: "Flags"},
262 {name: "CMPGEF", argLength: 2, reg: fp2flags, asm: "CMPGEF", typ: "Flags"},
263 {name: "CMPGED", argLength: 2, reg: fp2flags, asm: "CMPGED", typ: "Flags"},
264 {name: "CMPGTF", argLength: 2, reg: fp2flags, asm: "CMPGTF", typ: "Flags"},
265 {name: "CMPGTD", argLength: 2, reg: fp2flags, asm: "CMPGTD", typ: "Flags"},
266
267
268
269
270 {name: "BSTRPICKW", argLength: 1, reg: gp11, asm: "BSTRPICKW", aux: "Int64"},
271 {name: "BSTRPICKV", argLength: 1, reg: gp11, asm: "BSTRPICKV", aux: "Int64"},
272
273
274 {name: "MOVVconst", argLength: 0, reg: gp01, aux: "Int64", asm: "MOVV", typ: "UInt64", rematerializeable: true},
275 {name: "MOVFconst", argLength: 0, reg: fp01, aux: "Float64", asm: "MOVF", typ: "Float32", rematerializeable: true},
276 {name: "MOVDconst", argLength: 0, reg: fp01, aux: "Float64", asm: "MOVD", typ: "Float64", rematerializeable: true},
277
278 {name: "MOVVaddr", argLength: 1, reg: regInfo{inputs: []regMask{buildReg("SP") | buildReg("SB")}, outputs: []regMask{gp}}, aux: "SymOff", asm: "MOVV", rematerializeable: true, symEffect: "Addr"},
279
280 {name: "MOVBload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVB", typ: "Int8", faultOnNilArg0: true, symEffect: "Read"},
281 {name: "MOVBUload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVBU", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"},
282 {name: "MOVHload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVH", typ: "Int16", faultOnNilArg0: true, symEffect: "Read"},
283 {name: "MOVHUload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVHU", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"},
284 {name: "MOVWload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVW", typ: "Int32", faultOnNilArg0: true, symEffect: "Read"},
285 {name: "MOVWUload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVWU", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"},
286 {name: "MOVVload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVV", typ: "UInt64", faultOnNilArg0: true, symEffect: "Read"},
287 {name: "MOVFload", argLength: 2, reg: fpload, aux: "SymOff", asm: "MOVF", typ: "Float32", faultOnNilArg0: true, symEffect: "Read"},
288 {name: "MOVDload", argLength: 2, reg: fpload, aux: "SymOff", asm: "MOVD", typ: "Float64", faultOnNilArg0: true, symEffect: "Read"},
289
290
291 {name: "MOVVloadidx", argLength: 3, reg: gp2load, asm: "MOVV", typ: "UInt64"},
292 {name: "MOVWloadidx", argLength: 3, reg: gp2load, asm: "MOVW", typ: "Int32"},
293 {name: "MOVWUloadidx", argLength: 3, reg: gp2load, asm: "MOVWU", typ: "UInt32"},
294 {name: "MOVHloadidx", argLength: 3, reg: gp2load, asm: "MOVH", typ: "Int16"},
295 {name: "MOVHUloadidx", argLength: 3, reg: gp2load, asm: "MOVHU", typ: "UInt16"},
296 {name: "MOVBloadidx", argLength: 3, reg: gp2load, asm: "MOVB", typ: "Int8"},
297 {name: "MOVBUloadidx", argLength: 3, reg: gp2load, asm: "MOVBU", typ: "UInt8"},
298 {name: "MOVFloadidx", argLength: 3, reg: fp2load, asm: "MOVF", typ: "Float32"},
299 {name: "MOVDloadidx", argLength: 3, reg: fp2load, asm: "MOVD", typ: "Float64"},
300
301 {name: "MOVBstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVB", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
302 {name: "MOVHstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVH", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
303 {name: "MOVWstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVW", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
304 {name: "MOVVstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVV", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
305 {name: "MOVFstore", argLength: 3, reg: fpstore, aux: "SymOff", asm: "MOVF", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
306 {name: "MOVDstore", argLength: 3, reg: fpstore, aux: "SymOff", asm: "MOVD", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
307
308
309 {name: "MOVBstoreidx", argLength: 4, reg: gpstore2, asm: "MOVB", typ: "Mem"},
310 {name: "MOVHstoreidx", argLength: 4, reg: gpstore2, asm: "MOVH", typ: "Mem"},
311 {name: "MOVWstoreidx", argLength: 4, reg: gpstore2, asm: "MOVW", typ: "Mem"},
312 {name: "MOVVstoreidx", argLength: 4, reg: gpstore2, asm: "MOVV", typ: "Mem"},
313 {name: "MOVFstoreidx", argLength: 4, reg: fpstore2, asm: "MOVF", typ: "Mem"},
314 {name: "MOVDstoreidx", argLength: 4, reg: fpstore2, asm: "MOVD", typ: "Mem"},
315
316 {name: "MOVBstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVB", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
317 {name: "MOVHstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVH", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
318 {name: "MOVWstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVW", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
319 {name: "MOVVstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVV", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
320
321
322 {name: "MOVBstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVB", typ: "Mem"},
323 {name: "MOVHstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVH", typ: "Mem"},
324 {name: "MOVWstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVW", typ: "Mem"},
325 {name: "MOVVstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVV", typ: "Mem"},
326
327
328 {name: "MOVWfpgp", argLength: 1, reg: fpgp, asm: "MOVW"},
329 {name: "MOVWgpfp", argLength: 1, reg: gpfp, asm: "MOVW"},
330 {name: "MOVVfpgp", argLength: 1, reg: fpgp, asm: "MOVV"},
331 {name: "MOVVgpfp", argLength: 1, reg: gpfp, asm: "MOVV"},
332
333
334 {name: "MOVBreg", argLength: 1, reg: gp11, asm: "MOVB"},
335 {name: "MOVBUreg", argLength: 1, reg: gp11, asm: "MOVBU"},
336 {name: "MOVHreg", argLength: 1, reg: gp11, asm: "MOVH"},
337 {name: "MOVHUreg", argLength: 1, reg: gp11, asm: "MOVHU"},
338 {name: "MOVWreg", argLength: 1, reg: gp11, asm: "MOVW"},
339 {name: "MOVWUreg", argLength: 1, reg: gp11, asm: "MOVWU"},
340 {name: "MOVVreg", argLength: 1, reg: gp11, asm: "MOVV"},
341
342 {name: "MOVVnop", argLength: 1, reg: regInfo{inputs: []regMask{gp}, outputs: []regMask{gp}}, resultInArg0: true},
343
344 {name: "MOVWF", argLength: 1, reg: fp11, asm: "MOVWF"},
345 {name: "MOVWD", argLength: 1, reg: fp11, asm: "MOVWD"},
346 {name: "MOVVF", argLength: 1, reg: fp11, asm: "MOVVF"},
347 {name: "MOVVD", argLength: 1, reg: fp11, asm: "MOVVD"},
348 {name: "TRUNCFW", argLength: 1, reg: fp11, asm: "TRUNCFW"},
349 {name: "TRUNCDW", argLength: 1, reg: fp11, asm: "TRUNCDW"},
350 {name: "TRUNCFV", argLength: 1, reg: fp11, asm: "TRUNCFV"},
351 {name: "TRUNCDV", argLength: 1, reg: fp11, asm: "TRUNCDV"},
352 {name: "MOVFD", argLength: 1, reg: fp11, asm: "MOVFD"},
353 {name: "MOVDF", argLength: 1, reg: fp11, asm: "MOVDF"},
354
355
356 {name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true},
357 {name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true},
358
359
360 {name: "CALLstatic", argLength: -1, reg: regInfo{clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
361 {name: "CALLtail", argLength: -1, reg: regInfo{clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true, tailCall: true},
362 {name: "CALLclosure", argLength: -1, reg: regInfo{inputs: []regMask{gpsp, buildReg("R29"), 0}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
363 {name: "CALLinter", argLength: -1, reg: regInfo{inputs: []regMask{gp}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
364
365
366
367
368
369
370
371 {
372 name: "DUFFZERO",
373 aux: "Int64",
374 argLength: 2,
375 reg: regInfo{
376 inputs: []regMask{buildReg("R20")},
377 clobbers: buildReg("R20 R1"),
378 },
379 typ: "Mem",
380 faultOnNilArg0: true,
381 },
382
383
384
385
386
387
388
389 {
390 name: "DUFFCOPY",
391 aux: "Int64",
392 argLength: 3,
393 reg: regInfo{
394 inputs: []regMask{buildReg("R21"), buildReg("R20")},
395 clobbers: buildReg("R20 R21 R1"),
396 },
397 typ: "Mem",
398 faultOnNilArg0: true,
399 faultOnNilArg1: true,
400 },
401
402
403
404
405
406
407
408
409
410
411 {
412 name: "LoweredZero",
413 aux: "Int64",
414 argLength: 3,
415 reg: regInfo{
416 inputs: []regMask{buildReg("R20"), gp},
417 clobbers: buildReg("R20"),
418 },
419 typ: "Mem",
420 faultOnNilArg0: true,
421 },
422
423
424
425
426
427
428
429
430
431
432
433
434
435 {
436 name: "LoweredMove",
437 aux: "Int64",
438 argLength: 4,
439 reg: regInfo{
440 inputs: []regMask{buildReg("R21"), buildReg("R20"), gp},
441 clobbers: buildReg("R20 R21"),
442 },
443 typ: "Mem",
444 faultOnNilArg0: true,
445 faultOnNilArg1: true,
446 },
447
448
449
450
451 {name: "LoweredAtomicLoad8", argLength: 2, reg: gpload, faultOnNilArg0: true},
452 {name: "LoweredAtomicLoad32", argLength: 2, reg: gpload, faultOnNilArg0: true},
453 {name: "LoweredAtomicLoad64", argLength: 2, reg: gpload, faultOnNilArg0: true},
454
455
456
457 {name: "LoweredAtomicStore8", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
458 {name: "LoweredAtomicStore32", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
459 {name: "LoweredAtomicStore64", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
460 {name: "LoweredAtomicStore8Variant", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
461 {name: "LoweredAtomicStore32Variant", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
462 {name: "LoweredAtomicStore64Variant", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
463
464
465
466 {name: "LoweredAtomicExchange32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
467 {name: "LoweredAtomicExchange64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
468
469
470
471
472 {name: "LoweredAtomicExchange8Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
473
474
475
476 {name: "LoweredAtomicAdd32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
477 {name: "LoweredAtomicAdd64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495 {name: "LoweredAtomicCas32", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
496 {name: "LoweredAtomicCas64", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512 {name: "LoweredAtomicCas64Variant", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
513 {name: "LoweredAtomicCas32Variant", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
514
515
516
517 {name: "LoweredAtomicAnd32", argLength: 3, reg: gpxchg, asm: "AMANDDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
518 {name: "LoweredAtomicOr32", argLength: 3, reg: gpxchg, asm: "AMORDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
519
520
521
522 {name: "LoweredAtomicAnd32value", argLength: 3, reg: gpxchg, asm: "AMANDDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
523 {name: "LoweredAtomicAnd64value", argLength: 3, reg: gpxchg, asm: "AMANDDBV", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
524 {name: "LoweredAtomicOr32value", argLength: 3, reg: gpxchg, asm: "AMORDBW", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
525 {name: "LoweredAtomicOr64value", argLength: 3, reg: gpxchg, asm: "AMORDBV", resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
526
527
528 {name: "LoweredNilCheck", argLength: 2, reg: regInfo{inputs: []regMask{gpg}}, nilCheck: true, faultOnNilArg0: true},
529
530 {name: "FPFlagTrue", argLength: 1, reg: readflags},
531 {name: "FPFlagFalse", argLength: 1, reg: readflags},
532
533
534
535
536 {name: "LoweredGetClosurePtr", reg: regInfo{outputs: []regMask{buildReg("R29")}}, zeroWidth: true},
537
538
539 {name: "LoweredGetCallerSP", argLength: 1, reg: gp01, rematerializeable: true},
540
541
542
543
544
545 {name: "LoweredGetCallerPC", reg: gp01, rematerializeable: true},
546
547
548
549
550
551
552 {name: "LoweredWB", argLength: 1, reg: regInfo{clobbers: (callerSave &^ gpg) | buildReg("R1"), outputs: []regMask{buildReg("R29")}}, clobberFlags: true, aux: "Int64"},
553
554
555 {name: "LoweredPubBarrier", argLength: 1, asm: "DBAR", hasSideEffects: true},
556
557
558
559
560 {name: "LoweredPanicBoundsA", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r3, r4}}, typ: "Mem", call: true},
561 {name: "LoweredPanicBoundsB", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r2, r3}}, typ: "Mem", call: true},
562 {name: "LoweredPanicBoundsC", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r1, r2}}, typ: "Mem", call: true},
563 }
564
565 blocks := []blockData{
566 {name: "EQ", controls: 1},
567 {name: "NE", controls: 1},
568 {name: "LTZ", controls: 1},
569 {name: "LEZ", controls: 1},
570 {name: "GTZ", controls: 1},
571 {name: "GEZ", controls: 1},
572 {name: "FPT", controls: 1},
573 {name: "FPF", controls: 1},
574 {name: "BEQ", controls: 2},
575 {name: "BNE", controls: 2},
576 {name: "BGE", controls: 2},
577 {name: "BLT", controls: 2},
578 {name: "BGEU", controls: 2},
579 {name: "BLTU", controls: 2},
580 }
581
582 archs = append(archs, arch{
583 name: "LOONG64",
584 pkg: "cmd/internal/obj/loong64",
585 genfile: "../../loong64/ssa.go",
586 ops: ops,
587 blocks: blocks,
588 regnames: regNamesLOONG64,
589
590 ParamIntRegNames: "R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R18 R19",
591 ParamFloatRegNames: "F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15",
592 gpregmask: gp,
593 fpregmask: fp,
594 framepointerreg: -1,
595 linkreg: int8(num["R1"]),
596 })
597 }
598
View as plain text