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