1
2
3
4
5
6
7
8 package main
9
10 import "strings"
11
12
13
14
15
16
17
18
19
20 var regNamesPPC64 = []string{
21 "R0",
22 "SP",
23 "SB",
24 "R3",
25 "R4",
26 "R5",
27 "R6",
28 "R7",
29 "R8",
30 "R9",
31 "R10",
32 "R11",
33 "R12",
34 "R13",
35 "R14",
36 "R15",
37 "R16",
38 "R17",
39 "R18",
40 "R19",
41 "R20",
42 "R21",
43 "R22",
44 "R23",
45 "R24",
46 "R25",
47 "R26",
48 "R27",
49 "R28",
50 "R29",
51 "g",
52 "R31",
53
54 "F0",
55 "F1",
56 "F2",
57 "F3",
58 "F4",
59 "F5",
60 "F6",
61 "F7",
62 "F8",
63 "F9",
64 "F10",
65 "F11",
66 "F12",
67 "F13",
68 "F14",
69 "F15",
70 "F16",
71 "F17",
72 "F18",
73 "F19",
74 "F20",
75 "F21",
76 "F22",
77 "F23",
78 "F24",
79 "F25",
80 "F26",
81 "F27",
82 "F28",
83 "F29",
84 "F30",
85 "F31",
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 }
103
104 func init() {
105
106 if len(regNamesPPC64) > 64 {
107 panic("too many registers")
108 }
109 num := map[string]int{}
110 for i, name := range regNamesPPC64 {
111 num[name] = i
112 }
113 buildReg := func(s string) regMask {
114 m := regMask(0)
115 for _, r := range strings.Split(s, " ") {
116 if n, ok := num[r]; ok {
117 m |= regMask(1) << uint(n)
118 continue
119 }
120 panic("register " + r + " not found")
121 }
122 return m
123 }
124
125 var (
126 gp = buildReg("R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R14 R15 R16 R17 R18 R19 R20 R21 R22 R23 R24 R25 R26 R27 R28 R29")
127 fp = buildReg("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")
128 sp = buildReg("SP")
129 sb = buildReg("SB")
130 gr = buildReg("g")
131
132
133
134 tmp = buildReg("R31")
135 ctxt = buildReg("R11")
136 callptr = buildReg("R12")
137
138 gp01 = regInfo{inputs: nil, outputs: []regMask{gp}}
139 gp11 = regInfo{inputs: []regMask{gp | sp | sb}, outputs: []regMask{gp}}
140 gp21 = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb}, outputs: []regMask{gp}}
141 gp21a0 = regInfo{inputs: []regMask{gp, gp | sp | sb}, outputs: []regMask{gp}}
142 gp31 = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb, gp | sp | sb}, outputs: []regMask{gp}}
143 gp22 = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb}, outputs: []regMask{gp, gp}}
144 gp32 = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb, gp | sp | sb}, outputs: []regMask{gp, gp}}
145 gp1cr = regInfo{inputs: []regMask{gp | sp | sb}}
146 gp2cr = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb}}
147 crgp = regInfo{inputs: nil, outputs: []regMask{gp}}
148 crgp11 = regInfo{inputs: []regMask{gp}, outputs: []regMask{gp}}
149 crgp21 = regInfo{inputs: []regMask{gp, gp}, outputs: []regMask{gp}}
150 gpload = regInfo{inputs: []regMask{gp | sp | sb}, outputs: []regMask{gp}}
151 gploadidx = regInfo{inputs: []regMask{gp | sp | sb, gp}, outputs: []regMask{gp}}
152 prefreg = regInfo{inputs: []regMask{gp | sp | sb}}
153 gpstore = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb}}
154 gpstoreidx = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb, gp | sp | sb}}
155 gpstorezero = regInfo{inputs: []regMask{gp | sp | sb}}
156 gpxchg = regInfo{inputs: []regMask{gp | sp | sb, gp}, outputs: []regMask{gp}}
157 gpcas = regInfo{inputs: []regMask{gp | sp | sb, gp, gp}, outputs: []regMask{gp}}
158 fp01 = regInfo{inputs: nil, outputs: []regMask{fp}}
159 fp11 = regInfo{inputs: []regMask{fp}, outputs: []regMask{fp}}
160 fpgp = regInfo{inputs: []regMask{fp}, outputs: []regMask{gp}}
161 gpfp = regInfo{inputs: []regMask{gp}, outputs: []regMask{fp}}
162 fp21 = regInfo{inputs: []regMask{fp, fp}, outputs: []regMask{fp}}
163 fp31 = regInfo{inputs: []regMask{fp, fp, fp}, outputs: []regMask{fp}}
164 fp2cr = regInfo{inputs: []regMask{fp, fp}}
165 fpload = regInfo{inputs: []regMask{gp | sp | sb}, outputs: []regMask{fp}}
166 fploadidx = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb}, outputs: []regMask{fp}}
167 fpstore = regInfo{inputs: []regMask{gp | sp | sb, fp}}
168 fpstoreidx = regInfo{inputs: []regMask{gp | sp | sb, gp | sp | sb, fp}}
169 callerSave = regMask(gp | fp | gr)
170 r3 = buildReg("R3")
171 r4 = buildReg("R4")
172 r5 = buildReg("R5")
173 r6 = buildReg("R6")
174 )
175 ops := []opData{
176 {name: "ADD", argLength: 2, reg: gp21, asm: "ADD", commutative: true},
177 {name: "ADDconst", argLength: 1, reg: gp11, asm: "ADD", aux: "Int64"},
178 {name: "FADD", argLength: 2, reg: fp21, asm: "FADD", commutative: true},
179 {name: "FADDS", argLength: 2, reg: fp21, asm: "FADDS", commutative: true},
180 {name: "SUB", argLength: 2, reg: gp21, asm: "SUB"},
181 {name: "SUBFCconst", argLength: 1, reg: gp11, asm: "SUBC", aux: "Int64"},
182 {name: "FSUB", argLength: 2, reg: fp21, asm: "FSUB"},
183 {name: "FSUBS", argLength: 2, reg: fp21, asm: "FSUBS"},
184
185 {name: "MULLD", argLength: 2, reg: gp21, asm: "MULLD", typ: "Int64", commutative: true},
186 {name: "MULLW", argLength: 2, reg: gp21, asm: "MULLW", typ: "Int32", commutative: true},
187 {name: "MULLDconst", argLength: 1, reg: gp11, asm: "MULLD", aux: "Int32", typ: "Int64"},
188 {name: "MULLWconst", argLength: 1, reg: gp11, asm: "MULLW", aux: "Int32", typ: "Int64"},
189 {name: "MADDLD", argLength: 3, reg: gp31, asm: "MADDLD", typ: "Int64"},
190
191 {name: "MULHD", argLength: 2, reg: gp21, asm: "MULHD", commutative: true},
192 {name: "MULHW", argLength: 2, reg: gp21, asm: "MULHW", commutative: true},
193 {name: "MULHDU", argLength: 2, reg: gp21, asm: "MULHDU", commutative: true},
194 {name: "MULHWU", argLength: 2, reg: gp21, asm: "MULHWU", commutative: true},
195 {name: "LoweredMuluhilo", argLength: 2, reg: gp22, resultNotInArgs: true},
196
197 {name: "FMUL", argLength: 2, reg: fp21, asm: "FMUL", commutative: true},
198 {name: "FMULS", argLength: 2, reg: fp21, asm: "FMULS", commutative: true},
199
200 {name: "FMADD", argLength: 3, reg: fp31, asm: "FMADD"},
201 {name: "FMADDS", argLength: 3, reg: fp31, asm: "FMADDS"},
202 {name: "FMSUB", argLength: 3, reg: fp31, asm: "FMSUB"},
203 {name: "FMSUBS", argLength: 3, reg: fp31, asm: "FMSUBS"},
204
205 {name: "SRAD", argLength: 2, reg: gp21, asm: "SRAD"},
206 {name: "SRAW", argLength: 2, reg: gp21, asm: "SRAW"},
207 {name: "SRD", argLength: 2, reg: gp21, asm: "SRD"},
208 {name: "SRW", argLength: 2, reg: gp21, asm: "SRW"},
209 {name: "SLD", argLength: 2, reg: gp21, asm: "SLD"},
210 {name: "SLW", argLength: 2, reg: gp21, asm: "SLW"},
211
212 {name: "ROTL", argLength: 2, reg: gp21, asm: "ROTL"},
213 {name: "ROTLW", argLength: 2, reg: gp21, asm: "ROTLW"},
214
215
216 {name: "RLDICL", argLength: 1, reg: gp11, asm: "RLDICL", aux: "Int32"},
217 {name: "CLRLSLWI", argLength: 1, reg: gp11, asm: "CLRLSLWI", aux: "Int32"},
218 {name: "CLRLSLDI", argLength: 1, reg: gp11, asm: "CLRLSLDI", aux: "Int32"},
219
220 {name: "LoweredAdd64Carry", argLength: 3, reg: gp32, resultNotInArgs: true},
221
222 {name: "SRADconst", argLength: 1, reg: gp11, asm: "SRAD", aux: "Int64"},
223 {name: "SRAWconst", argLength: 1, reg: gp11, asm: "SRAW", aux: "Int64"},
224 {name: "SRDconst", argLength: 1, reg: gp11, asm: "SRD", aux: "Int64"},
225 {name: "SRWconst", argLength: 1, reg: gp11, asm: "SRW", aux: "Int64"},
226 {name: "SLDconst", argLength: 1, reg: gp11, asm: "SLD", aux: "Int64"},
227 {name: "SLWconst", argLength: 1, reg: gp11, asm: "SLW", aux: "Int64"},
228
229 {name: "ROTLconst", argLength: 1, reg: gp11, asm: "ROTL", aux: "Int64"},
230 {name: "ROTLWconst", argLength: 1, reg: gp11, asm: "ROTLW", aux: "Int64"},
231 {name: "EXTSWSLconst", argLength: 1, reg: gp11, asm: "EXTSWSLI", aux: "Int64"},
232
233 {name: "RLWINM", argLength: 1, reg: gp11, asm: "RLWNM", aux: "Int64"},
234 {name: "RLWNM", argLength: 2, reg: gp21, asm: "RLWNM", aux: "Int64"},
235 {name: "RLWMI", argLength: 2, reg: gp21a0, asm: "RLWMI", aux: "Int64", resultInArg0: true},
236
237 {name: "CNTLZD", argLength: 1, reg: gp11, asm: "CNTLZD", clobberFlags: true},
238 {name: "CNTLZW", argLength: 1, reg: gp11, asm: "CNTLZW", clobberFlags: true},
239
240 {name: "CNTTZD", argLength: 1, reg: gp11, asm: "CNTTZD"},
241 {name: "CNTTZW", argLength: 1, reg: gp11, asm: "CNTTZW"},
242
243 {name: "POPCNTD", argLength: 1, reg: gp11, asm: "POPCNTD"},
244 {name: "POPCNTW", argLength: 1, reg: gp11, asm: "POPCNTW"},
245 {name: "POPCNTB", argLength: 1, reg: gp11, asm: "POPCNTB"},
246
247 {name: "FDIV", argLength: 2, reg: fp21, asm: "FDIV"},
248 {name: "FDIVS", argLength: 2, reg: fp21, asm: "FDIVS"},
249
250 {name: "DIVD", argLength: 2, reg: gp21, asm: "DIVD", typ: "Int64"},
251 {name: "DIVW", argLength: 2, reg: gp21, asm: "DIVW", typ: "Int32"},
252 {name: "DIVDU", argLength: 2, reg: gp21, asm: "DIVDU", typ: "Int64"},
253 {name: "DIVWU", argLength: 2, reg: gp21, asm: "DIVWU", typ: "Int32"},
254
255 {name: "MODUD", argLength: 2, reg: gp21, asm: "MODUD", typ: "UInt64"},
256 {name: "MODSD", argLength: 2, reg: gp21, asm: "MODSD", typ: "Int64"},
257 {name: "MODUW", argLength: 2, reg: gp21, asm: "MODUW", typ: "UInt32"},
258 {name: "MODSW", argLength: 2, reg: gp21, asm: "MODSW", typ: "Int32"},
259
260
261
262 {name: "FCTIDZ", argLength: 1, reg: fp11, asm: "FCTIDZ", typ: "Float64"},
263 {name: "FCTIWZ", argLength: 1, reg: fp11, asm: "FCTIWZ", typ: "Float64"},
264 {name: "FCFID", argLength: 1, reg: fp11, asm: "FCFID", typ: "Float64"},
265 {name: "FCFIDS", argLength: 1, reg: fp11, asm: "FCFIDS", typ: "Float32"},
266 {name: "FRSP", argLength: 1, reg: fp11, asm: "FRSP", typ: "Float64"},
267
268
269
270
271
272
273
274 {name: "MFVSRD", argLength: 1, reg: fpgp, asm: "MFVSRD", typ: "Int64"},
275 {name: "MTVSRD", argLength: 1, reg: gpfp, asm: "MTVSRD", typ: "Float64"},
276
277 {name: "AND", argLength: 2, reg: gp21, asm: "AND", commutative: true},
278 {name: "ANDN", argLength: 2, reg: gp21, asm: "ANDN"},
279 {name: "ANDCC", argLength: 2, reg: gp2cr, asm: "ANDCC", commutative: true, typ: "Flags"},
280 {name: "OR", argLength: 2, reg: gp21, asm: "OR", commutative: true},
281 {name: "ORN", argLength: 2, reg: gp21, asm: "ORN"},
282 {name: "ORCC", argLength: 2, reg: gp2cr, asm: "ORCC", commutative: true, typ: "Flags"},
283 {name: "NOR", argLength: 2, reg: gp21, asm: "NOR", commutative: true},
284 {name: "XOR", argLength: 2, reg: gp21, asm: "XOR", typ: "Int64", commutative: true},
285 {name: "XORCC", argLength: 2, reg: gp2cr, asm: "XORCC", commutative: true, typ: "Flags"},
286 {name: "EQV", argLength: 2, reg: gp21, asm: "EQV", typ: "Int64", commutative: true},
287 {name: "NEG", argLength: 1, reg: gp11, asm: "NEG"},
288 {name: "FNEG", argLength: 1, reg: fp11, asm: "FNEG"},
289 {name: "FSQRT", argLength: 1, reg: fp11, asm: "FSQRT"},
290 {name: "FSQRTS", argLength: 1, reg: fp11, asm: "FSQRTS"},
291 {name: "FFLOOR", argLength: 1, reg: fp11, asm: "FRIM"},
292 {name: "FCEIL", argLength: 1, reg: fp11, asm: "FRIP"},
293 {name: "FTRUNC", argLength: 1, reg: fp11, asm: "FRIZ"},
294 {name: "FROUND", argLength: 1, reg: fp11, asm: "FRIN"},
295 {name: "FABS", argLength: 1, reg: fp11, asm: "FABS"},
296 {name: "FNABS", argLength: 1, reg: fp11, asm: "FNABS"},
297 {name: "FCPSGN", argLength: 2, reg: fp21, asm: "FCPSGN"},
298
299 {name: "ORconst", argLength: 1, reg: gp11, asm: "OR", aux: "Int64"},
300 {name: "XORconst", argLength: 1, reg: gp11, asm: "XOR", aux: "Int64"},
301 {name: "ANDconst", argLength: 1, reg: regInfo{inputs: []regMask{gp | sp | sb}, outputs: []regMask{gp}}, asm: "ANDCC", aux: "Int64", clobberFlags: true},
302 {name: "ANDCCconst", argLength: 1, reg: regInfo{inputs: []regMask{gp | sp | sb}}, asm: "ANDCC", aux: "Int64", typ: "Flags"},
303
304 {name: "MOVBreg", argLength: 1, reg: gp11, asm: "MOVB", typ: "Int64"},
305 {name: "MOVBZreg", argLength: 1, reg: gp11, asm: "MOVBZ", typ: "Int64"},
306 {name: "MOVHreg", argLength: 1, reg: gp11, asm: "MOVH", typ: "Int64"},
307 {name: "MOVHZreg", argLength: 1, reg: gp11, asm: "MOVHZ", typ: "Int64"},
308 {name: "MOVWreg", argLength: 1, reg: gp11, asm: "MOVW", typ: "Int64"},
309 {name: "MOVWZreg", argLength: 1, reg: gp11, asm: "MOVWZ", typ: "Int64"},
310
311
312 {name: "MOVBZload", argLength: 2, reg: gpload, asm: "MOVBZ", aux: "SymOff", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"},
313 {name: "MOVHload", argLength: 2, reg: gpload, asm: "MOVH", aux: "SymOff", typ: "Int16", faultOnNilArg0: true, symEffect: "Read"},
314 {name: "MOVHZload", argLength: 2, reg: gpload, asm: "MOVHZ", aux: "SymOff", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"},
315 {name: "MOVWload", argLength: 2, reg: gpload, asm: "MOVW", aux: "SymOff", typ: "Int32", faultOnNilArg0: true, symEffect: "Read"},
316 {name: "MOVWZload", argLength: 2, reg: gpload, asm: "MOVWZ", aux: "SymOff", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"},
317 {name: "MOVDload", argLength: 2, reg: gpload, asm: "MOVD", aux: "SymOff", typ: "Int64", faultOnNilArg0: true, symEffect: "Read"},
318
319
320
321
322 {name: "MOVDBRload", argLength: 2, reg: gpload, asm: "MOVDBR", aux: "SymOff", typ: "Int64", faultOnNilArg0: true, symEffect: "Read"},
323 {name: "MOVWBRload", argLength: 2, reg: gpload, asm: "MOVWBR", aux: "SymOff", typ: "Int32", faultOnNilArg0: true, symEffect: "Read"},
324 {name: "MOVHBRload", argLength: 2, reg: gpload, asm: "MOVHBR", aux: "SymOff", typ: "Int16", faultOnNilArg0: true, symEffect: "Read"},
325
326
327
328 {name: "MOVBZloadidx", argLength: 3, reg: gploadidx, asm: "MOVBZ", typ: "UInt8"},
329 {name: "MOVHloadidx", argLength: 3, reg: gploadidx, asm: "MOVH", typ: "Int16"},
330 {name: "MOVHZloadidx", argLength: 3, reg: gploadidx, asm: "MOVHZ", typ: "UInt16"},
331 {name: "MOVWloadidx", argLength: 3, reg: gploadidx, asm: "MOVW", typ: "Int32"},
332 {name: "MOVWZloadidx", argLength: 3, reg: gploadidx, asm: "MOVWZ", typ: "UInt32"},
333 {name: "MOVDloadidx", argLength: 3, reg: gploadidx, asm: "MOVD", typ: "Int64"},
334 {name: "MOVHBRloadidx", argLength: 3, reg: gploadidx, asm: "MOVHBR", typ: "Int16"},
335 {name: "MOVWBRloadidx", argLength: 3, reg: gploadidx, asm: "MOVWBR", typ: "Int32"},
336 {name: "MOVDBRloadidx", argLength: 3, reg: gploadidx, asm: "MOVDBR", typ: "Int64"},
337 {name: "FMOVDloadidx", argLength: 3, reg: fploadidx, asm: "FMOVD", typ: "Float64"},
338 {name: "FMOVSloadidx", argLength: 3, reg: fploadidx, asm: "FMOVS", typ: "Float32"},
339
340
341
342 {name: "DCBT", argLength: 2, aux: "Int64", reg: prefreg, asm: "DCBT", hasSideEffects: true},
343
344
345
346 {name: "MOVDBRstore", argLength: 3, reg: gpstore, asm: "MOVDBR", aux: "Sym", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
347 {name: "MOVWBRstore", argLength: 3, reg: gpstore, asm: "MOVWBR", aux: "Sym", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
348 {name: "MOVHBRstore", argLength: 3, reg: gpstore, asm: "MOVHBR", aux: "Sym", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
349
350
351 {name: "FMOVDload", argLength: 2, reg: fpload, asm: "FMOVD", aux: "SymOff", typ: "Float64", faultOnNilArg0: true, symEffect: "Read"},
352 {name: "FMOVSload", argLength: 2, reg: fpload, asm: "FMOVS", aux: "SymOff", typ: "Float32", faultOnNilArg0: true, symEffect: "Read"},
353
354
355 {name: "MOVBstore", argLength: 3, reg: gpstore, asm: "MOVB", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
356 {name: "MOVHstore", argLength: 3, reg: gpstore, asm: "MOVH", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
357 {name: "MOVWstore", argLength: 3, reg: gpstore, asm: "MOVW", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
358 {name: "MOVDstore", argLength: 3, reg: gpstore, asm: "MOVD", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
359
360
361 {name: "FMOVDstore", argLength: 3, reg: fpstore, asm: "FMOVD", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
362 {name: "FMOVSstore", argLength: 3, reg: fpstore, asm: "FMOVS", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
363
364
365
366 {name: "MOVBstoreidx", argLength: 4, reg: gpstoreidx, asm: "MOVB", typ: "Mem"},
367 {name: "MOVHstoreidx", argLength: 4, reg: gpstoreidx, asm: "MOVH", typ: "Mem"},
368 {name: "MOVWstoreidx", argLength: 4, reg: gpstoreidx, asm: "MOVW", typ: "Mem"},
369 {name: "MOVDstoreidx", argLength: 4, reg: gpstoreidx, asm: "MOVD", typ: "Mem"},
370 {name: "FMOVDstoreidx", argLength: 4, reg: fpstoreidx, asm: "FMOVD", typ: "Mem"},
371 {name: "FMOVSstoreidx", argLength: 4, reg: fpstoreidx, asm: "FMOVS", typ: "Mem"},
372 {name: "MOVHBRstoreidx", argLength: 4, reg: gpstoreidx, asm: "MOVHBR", typ: "Mem"},
373 {name: "MOVWBRstoreidx", argLength: 4, reg: gpstoreidx, asm: "MOVWBR", typ: "Mem"},
374 {name: "MOVDBRstoreidx", argLength: 4, reg: gpstoreidx, asm: "MOVDBR", typ: "Mem"},
375
376
377 {name: "MOVBstorezero", argLength: 2, reg: gpstorezero, asm: "MOVB", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
378 {name: "MOVHstorezero", argLength: 2, reg: gpstorezero, asm: "MOVH", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
379 {name: "MOVWstorezero", argLength: 2, reg: gpstorezero, asm: "MOVW", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
380 {name: "MOVDstorezero", argLength: 2, reg: gpstorezero, asm: "MOVD", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
381
382 {name: "MOVDaddr", argLength: 1, reg: regInfo{inputs: []regMask{sp | sb | gp}, outputs: []regMask{gp}}, aux: "SymOff", asm: "MOVD", rematerializeable: true, symEffect: "Addr"},
383
384 {name: "MOVDconst", argLength: 0, reg: gp01, aux: "Int64", asm: "MOVD", typ: "Int64", rematerializeable: true},
385 {name: "FMOVDconst", argLength: 0, reg: fp01, aux: "Float64", asm: "FMOVD", rematerializeable: true},
386 {name: "FMOVSconst", argLength: 0, reg: fp01, aux: "Float32", asm: "FMOVS", rematerializeable: true},
387 {name: "FCMPU", argLength: 2, reg: fp2cr, asm: "FCMPU", typ: "Flags"},
388
389 {name: "CMP", argLength: 2, reg: gp2cr, asm: "CMP", typ: "Flags"},
390 {name: "CMPU", argLength: 2, reg: gp2cr, asm: "CMPU", typ: "Flags"},
391 {name: "CMPW", argLength: 2, reg: gp2cr, asm: "CMPW", typ: "Flags"},
392 {name: "CMPWU", argLength: 2, reg: gp2cr, asm: "CMPWU", typ: "Flags"},
393 {name: "CMPconst", argLength: 1, reg: gp1cr, asm: "CMP", aux: "Int64", typ: "Flags"},
394 {name: "CMPUconst", argLength: 1, reg: gp1cr, asm: "CMPU", aux: "Int64", typ: "Flags"},
395 {name: "CMPWconst", argLength: 1, reg: gp1cr, asm: "CMPW", aux: "Int32", typ: "Flags"},
396 {name: "CMPWUconst", argLength: 1, reg: gp1cr, asm: "CMPWU", aux: "Int32", typ: "Flags"},
397
398
399
400
401 {name: "ISEL", argLength: 3, reg: crgp21, asm: "ISEL", aux: "Int32", typ: "Int32"},
402 {name: "ISELB", argLength: 2, reg: crgp11, asm: "ISEL", aux: "Int32", typ: "Int32"},
403
404
405 {name: "Equal", argLength: 1, reg: crgp},
406 {name: "NotEqual", argLength: 1, reg: crgp},
407 {name: "LessThan", argLength: 1, reg: crgp},
408 {name: "FLessThan", argLength: 1, reg: crgp},
409 {name: "LessEqual", argLength: 1, reg: crgp},
410 {name: "FLessEqual", argLength: 1, reg: crgp},
411 {name: "GreaterThan", argLength: 1, reg: crgp},
412 {name: "FGreaterThan", argLength: 1, reg: crgp},
413 {name: "GreaterEqual", argLength: 1, reg: crgp},
414 {name: "FGreaterEqual", argLength: 1, reg: crgp},
415
416
417
418
419 {name: "LoweredGetClosurePtr", reg: regInfo{outputs: []regMask{ctxt}}, zeroWidth: true},
420
421
422 {name: "LoweredGetCallerSP", reg: gp01, rematerializeable: true},
423
424
425
426
427
428 {name: "LoweredGetCallerPC", reg: gp01, rematerializeable: true},
429
430
431 {name: "LoweredNilCheck", argLength: 2, reg: regInfo{inputs: []regMask{gp | sp | sb}, clobbers: tmp}, clobberFlags: true, nilCheck: true, faultOnNilArg0: true},
432
433 {name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true, zeroWidth: true},
434 {name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true, zeroWidth: true},
435
436 {name: "CALLstatic", argLength: -1, reg: regInfo{clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
437 {name: "CALLtail", argLength: -1, reg: regInfo{clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true, tailCall: true},
438 {name: "CALLclosure", argLength: -1, reg: regInfo{inputs: []regMask{callptr, ctxt, 0}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
439 {name: "CALLinter", argLength: -1, reg: regInfo{inputs: []regMask{callptr}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468 {
469 name: "LoweredZero",
470 aux: "Int64",
471 argLength: 2,
472 reg: regInfo{
473 inputs: []regMask{buildReg("R20")},
474 clobbers: buildReg("R20"),
475 },
476 clobberFlags: true,
477 typ: "Mem",
478 faultOnNilArg0: true,
479 unsafePoint: true,
480 },
481 {
482 name: "LoweredZeroShort",
483 aux: "Int64",
484 argLength: 2,
485 reg: regInfo{
486 inputs: []regMask{gp}},
487 typ: "Mem",
488 faultOnNilArg0: true,
489 unsafePoint: true,
490 },
491 {
492 name: "LoweredQuadZeroShort",
493 aux: "Int64",
494 argLength: 2,
495 reg: regInfo{
496 inputs: []regMask{gp},
497 },
498 typ: "Mem",
499 faultOnNilArg0: true,
500 unsafePoint: true,
501 },
502 {
503 name: "LoweredQuadZero",
504 aux: "Int64",
505 argLength: 2,
506 reg: regInfo{
507 inputs: []regMask{buildReg("R20")},
508 clobbers: buildReg("R20"),
509 },
510 clobberFlags: true,
511 typ: "Mem",
512 faultOnNilArg0: true,
513 unsafePoint: true,
514 },
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549 {
550 name: "LoweredMove",
551 aux: "Int64",
552 argLength: 3,
553 reg: regInfo{
554 inputs: []regMask{buildReg("R20"), buildReg("R21")},
555 clobbers: buildReg("R20 R21"),
556 },
557 clobberFlags: true,
558 typ: "Mem",
559 faultOnNilArg0: true,
560 faultOnNilArg1: true,
561 unsafePoint: true,
562 },
563 {
564 name: "LoweredMoveShort",
565 aux: "Int64",
566 argLength: 3,
567 reg: regInfo{
568 inputs: []regMask{gp, gp},
569 },
570 typ: "Mem",
571 faultOnNilArg0: true,
572 faultOnNilArg1: true,
573 unsafePoint: true,
574 },
575
576
577
578
579 {
580 name: "LoweredQuadMove",
581 aux: "Int64",
582 argLength: 3,
583 reg: regInfo{
584 inputs: []regMask{buildReg("R20"), buildReg("R21")},
585 clobbers: buildReg("R20 R21"),
586 },
587 clobberFlags: true,
588 typ: "Mem",
589 faultOnNilArg0: true,
590 faultOnNilArg1: true,
591 unsafePoint: true,
592 },
593
594 {
595 name: "LoweredQuadMoveShort",
596 aux: "Int64",
597 argLength: 3,
598 reg: regInfo{
599 inputs: []regMask{gp, gp},
600 },
601 typ: "Mem",
602 faultOnNilArg0: true,
603 faultOnNilArg1: true,
604 unsafePoint: true,
605 },
606
607 {name: "LoweredAtomicStore8", argLength: 3, reg: gpstore, typ: "Mem", aux: "Int64", faultOnNilArg0: true, hasSideEffects: true},
608 {name: "LoweredAtomicStore32", argLength: 3, reg: gpstore, typ: "Mem", aux: "Int64", faultOnNilArg0: true, hasSideEffects: true},
609 {name: "LoweredAtomicStore64", argLength: 3, reg: gpstore, typ: "Mem", aux: "Int64", faultOnNilArg0: true, hasSideEffects: true},
610
611 {name: "LoweredAtomicLoad8", argLength: 2, reg: gpload, typ: "UInt8", aux: "Int64", clobberFlags: true, faultOnNilArg0: true},
612 {name: "LoweredAtomicLoad32", argLength: 2, reg: gpload, typ: "UInt32", aux: "Int64", clobberFlags: true, faultOnNilArg0: true},
613 {name: "LoweredAtomicLoad64", argLength: 2, reg: gpload, typ: "Int64", aux: "Int64", clobberFlags: true, faultOnNilArg0: true},
614 {name: "LoweredAtomicLoadPtr", argLength: 2, reg: gpload, typ: "Int64", aux: "Int64", clobberFlags: true, faultOnNilArg0: true},
615
616
617
618
619
620
621
622
623 {name: "LoweredAtomicAdd32", argLength: 3, reg: gpxchg, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true},
624 {name: "LoweredAtomicAdd64", argLength: 3, reg: gpxchg, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true},
625
626
627
628
629
630
631
632
633 {name: "LoweredAtomicExchange32", argLength: 3, reg: gpxchg, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true},
634 {name: "LoweredAtomicExchange64", argLength: 3, reg: gpxchg, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true},
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652 {name: "LoweredAtomicCas64", argLength: 4, reg: gpcas, resultNotInArgs: true, aux: "Int64", clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true},
653 {name: "LoweredAtomicCas32", argLength: 4, reg: gpcas, resultNotInArgs: true, aux: "Int64", clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true},
654
655
656
657
658
659
660
661 {name: "LoweredAtomicAnd8", argLength: 3, reg: gpstore, asm: "AND", faultOnNilArg0: true, hasSideEffects: true},
662 {name: "LoweredAtomicAnd32", argLength: 3, reg: gpstore, asm: "AND", faultOnNilArg0: true, hasSideEffects: true},
663 {name: "LoweredAtomicOr8", argLength: 3, reg: gpstore, asm: "OR", faultOnNilArg0: true, hasSideEffects: true},
664 {name: "LoweredAtomicOr32", argLength: 3, reg: gpstore, asm: "OR", faultOnNilArg0: true, hasSideEffects: true},
665
666
667
668
669 {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("R20"), buildReg("R21")}, clobbers: (callerSave &^ buildReg("R0 R3 R4 R5 R6 R7 R8 R9 R10 R14 R15 R16 R17 R20 R21 g")) | buildReg("R31")}, clobberFlags: true, aux: "Sym", symEffect: "None"},
670
671
672
673
674 {name: "LoweredPanicBoundsA", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r5, r6}}, typ: "Mem", call: true},
675 {name: "LoweredPanicBoundsB", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r4, r5}}, typ: "Mem", call: true},
676 {name: "LoweredPanicBoundsC", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r3, r4}}, typ: "Mem", call: true},
677
678
679
680
681
682
683 {name: "InvertFlags", argLength: 1},
684
685
686
687
688
689
690
691
692
693
694 {name: "FlagEQ"},
695 {name: "FlagLT"},
696 {name: "FlagGT"},
697 }
698
699 blocks := []blockData{
700 {name: "EQ", controls: 1},
701 {name: "NE", controls: 1},
702 {name: "LT", controls: 1},
703 {name: "LE", controls: 1},
704 {name: "GT", controls: 1},
705 {name: "GE", controls: 1},
706 {name: "FLT", controls: 1},
707 {name: "FLE", controls: 1},
708 {name: "FGT", controls: 1},
709 {name: "FGE", controls: 1},
710 }
711
712 archs = append(archs, arch{
713 name: "PPC64",
714 pkg: "cmd/internal/obj/ppc64",
715 genfile: "../../ppc64/ssa.go",
716 ops: ops,
717 blocks: blocks,
718 regnames: regNamesPPC64,
719 ParamIntRegNames: "R3 R4 R5 R6 R7 R8 R9 R10 R14 R15 R16 R17",
720 ParamFloatRegNames: "F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12",
721 gpregmask: gp,
722 fpregmask: fp,
723 framepointerreg: -1,
724 linkreg: -1,
725 })
726 }
727
View as plain text