1
2
3
4
5
6
7
8 package main
9
10 import "strings"
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 var regNamesARM64 = []string{
34 "R0",
35 "R1",
36 "R2",
37 "R3",
38 "R4",
39 "R5",
40 "R6",
41 "R7",
42 "R8",
43 "R9",
44 "R10",
45 "R11",
46 "R12",
47 "R13",
48 "R14",
49 "R15",
50 "R16",
51 "R17",
52 "R18",
53 "R19",
54 "R20",
55 "R21",
56 "R22",
57 "R23",
58 "R24",
59 "R25",
60 "R26",
61
62 "g",
63 "R29",
64 "R30",
65 "SP",
66
67 "F0",
68 "F1",
69 "F2",
70 "F3",
71 "F4",
72 "F5",
73 "F6",
74 "F7",
75 "F8",
76 "F9",
77 "F10",
78 "F11",
79 "F12",
80 "F13",
81 "F14",
82 "F15",
83 "F16",
84 "F17",
85 "F18",
86 "F19",
87 "F20",
88 "F21",
89 "F22",
90 "F23",
91 "F24",
92 "F25",
93 "F26",
94 "F27",
95 "F28",
96 "F29",
97 "F30",
98 "F31",
99
100
101
102
103 "SB",
104 }
105
106 func init() {
107
108 if len(regNamesARM64) > 64 {
109 panic("too many registers")
110 }
111 num := map[string]int{}
112 for i, name := range regNamesARM64 {
113 num[name] = i
114 }
115 buildReg := func(s string) regMask {
116 m := regMask(0)
117 for _, r := range strings.Split(s, " ") {
118 if n, ok := num[r]; ok {
119 m |= regMask(1) << uint(n)
120 continue
121 }
122 panic("register " + r + " not found")
123 }
124 return m
125 }
126
127
128 var (
129 gp = buildReg("R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 R30")
130 gpg = gp | buildReg("g")
131 gpsp = gp | buildReg("SP")
132 gpspg = gpg | buildReg("SP")
133 gpspsbg = gpspg | buildReg("SB")
134 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")
135 callerSave = gp | fp | buildReg("g")
136 r0 = buildReg("R0")
137 r1 = buildReg("R1")
138 r2 = buildReg("R2")
139 r3 = buildReg("R3")
140 )
141
142 var (
143 gp01 = regInfo{inputs: nil, outputs: []regMask{gp}}
144 gp0flags1 = regInfo{inputs: []regMask{0}, outputs: []regMask{gp}}
145 gp11 = regInfo{inputs: []regMask{gpg}, outputs: []regMask{gp}}
146 gp11sp = regInfo{inputs: []regMask{gpspg}, outputs: []regMask{gp}}
147 gp1flags = regInfo{inputs: []regMask{gpg}}
148 gp1flags1 = regInfo{inputs: []regMask{gpg}, outputs: []regMask{gp}}
149 gp11flags = regInfo{inputs: []regMask{gpg}, outputs: []regMask{gp, 0}}
150 gp21 = regInfo{inputs: []regMask{gpg, gpg}, outputs: []regMask{gp}}
151 gp21nog = regInfo{inputs: []regMask{gp, gp}, outputs: []regMask{gp}}
152 gp21flags = regInfo{inputs: []regMask{gp, gp}, outputs: []regMask{gp, 0}}
153 gp2flags = regInfo{inputs: []regMask{gpg, gpg}}
154 gp2flags1 = regInfo{inputs: []regMask{gp, gp}, outputs: []regMask{gp}}
155 gp2flags1flags = regInfo{inputs: []regMask{gp, gp, 0}, outputs: []regMask{gp, 0}}
156 gp2load = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{gp}}
157 gp22 = regInfo{inputs: []regMask{gpg, gpg}, outputs: []regMask{gp, gp}}
158 gp31 = regInfo{inputs: []regMask{gpg, gpg, gpg}, outputs: []regMask{gp}}
159 gpload = regInfo{inputs: []regMask{gpspsbg}, outputs: []regMask{gp}}
160 gpstore = regInfo{inputs: []regMask{gpspsbg, gpg}}
161 gpstore0 = regInfo{inputs: []regMask{gpspsbg}}
162 gpstore2 = regInfo{inputs: []regMask{gpspsbg, gpg, gpg}}
163 gpxchg = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{gp}}
164 gpcas = regInfo{inputs: []regMask{gpspsbg, gpg, gpg}, outputs: []regMask{gp}}
165 fp01 = regInfo{inputs: nil, outputs: []regMask{fp}}
166 fp11 = regInfo{inputs: []regMask{fp}, outputs: []regMask{fp}}
167 fpgp = regInfo{inputs: []regMask{fp}, outputs: []regMask{gp}}
168 gpfp = regInfo{inputs: []regMask{gp}, outputs: []regMask{fp}}
169 fp21 = regInfo{inputs: []regMask{fp, fp}, outputs: []regMask{fp}}
170 fp31 = regInfo{inputs: []regMask{fp, fp, fp}, outputs: []regMask{fp}}
171 fp2flags = regInfo{inputs: []regMask{fp, fp}}
172 fp1flags = regInfo{inputs: []regMask{fp}}
173 fpload = regInfo{inputs: []regMask{gpspsbg}, outputs: []regMask{fp}}
174 fp2load = regInfo{inputs: []regMask{gpspsbg, gpg}, outputs: []regMask{fp}}
175 fpstore = regInfo{inputs: []regMask{gpspsbg, fp}}
176 fpstore2 = regInfo{inputs: []regMask{gpspsbg, gpg, fp}}
177 readflags = regInfo{inputs: nil, outputs: []regMask{gp}}
178 prefreg = regInfo{inputs: []regMask{gpspsbg}}
179 )
180 ops := []opData{
181
182 {name: "ADCSflags", argLength: 3, reg: gp2flags1flags, typ: "(UInt64,Flags)", asm: "ADCS", commutative: true},
183 {name: "ADCzerocarry", argLength: 1, reg: gp0flags1, typ: "UInt64", asm: "ADC"},
184 {name: "ADD", argLength: 2, reg: gp21, asm: "ADD", commutative: true},
185 {name: "ADDconst", argLength: 1, reg: gp11sp, asm: "ADD", aux: "Int64"},
186 {name: "ADDSconstflags", argLength: 1, reg: gp11flags, typ: "(UInt64,Flags)", asm: "ADDS", aux: "Int64"},
187 {name: "ADDSflags", argLength: 2, reg: gp21flags, typ: "(UInt64,Flags)", asm: "ADDS", commutative: true},
188 {name: "SUB", argLength: 2, reg: gp21, asm: "SUB"},
189 {name: "SUBconst", argLength: 1, reg: gp11, asm: "SUB", aux: "Int64"},
190 {name: "SBCSflags", argLength: 3, reg: gp2flags1flags, typ: "(UInt64,Flags)", asm: "SBCS"},
191 {name: "SUBSflags", argLength: 2, reg: gp21flags, typ: "(UInt64,Flags)", asm: "SUBS"},
192 {name: "MUL", argLength: 2, reg: gp21, asm: "MUL", commutative: true},
193 {name: "MULW", argLength: 2, reg: gp21, asm: "MULW", commutative: true},
194 {name: "MNEG", argLength: 2, reg: gp21, asm: "MNEG", commutative: true},
195 {name: "MNEGW", argLength: 2, reg: gp21, asm: "MNEGW", commutative: true},
196 {name: "MULH", argLength: 2, reg: gp21, asm: "SMULH", commutative: true},
197 {name: "UMULH", argLength: 2, reg: gp21, asm: "UMULH", commutative: true},
198 {name: "MULL", argLength: 2, reg: gp21, asm: "SMULL", commutative: true},
199 {name: "UMULL", argLength: 2, reg: gp21, asm: "UMULL", commutative: true},
200 {name: "DIV", argLength: 2, reg: gp21, asm: "SDIV"},
201 {name: "UDIV", argLength: 2, reg: gp21, asm: "UDIV"},
202 {name: "DIVW", argLength: 2, reg: gp21, asm: "SDIVW"},
203 {name: "UDIVW", argLength: 2, reg: gp21, asm: "UDIVW"},
204 {name: "MOD", argLength: 2, reg: gp21, asm: "REM"},
205 {name: "UMOD", argLength: 2, reg: gp21, asm: "UREM"},
206 {name: "MODW", argLength: 2, reg: gp21, asm: "REMW"},
207 {name: "UMODW", argLength: 2, reg: gp21, asm: "UREMW"},
208
209 {name: "FADDS", argLength: 2, reg: fp21, asm: "FADDS", commutative: true},
210 {name: "FADDD", argLength: 2, reg: fp21, asm: "FADDD", commutative: true},
211 {name: "FSUBS", argLength: 2, reg: fp21, asm: "FSUBS"},
212 {name: "FSUBD", argLength: 2, reg: fp21, asm: "FSUBD"},
213 {name: "FMULS", argLength: 2, reg: fp21, asm: "FMULS", commutative: true},
214 {name: "FMULD", argLength: 2, reg: fp21, asm: "FMULD", commutative: true},
215 {name: "FNMULS", argLength: 2, reg: fp21, asm: "FNMULS", commutative: true},
216 {name: "FNMULD", argLength: 2, reg: fp21, asm: "FNMULD", commutative: true},
217 {name: "FDIVS", argLength: 2, reg: fp21, asm: "FDIVS"},
218 {name: "FDIVD", argLength: 2, reg: fp21, asm: "FDIVD"},
219
220 {name: "AND", argLength: 2, reg: gp21, asm: "AND", commutative: true},
221 {name: "ANDconst", argLength: 1, reg: gp11, asm: "AND", aux: "Int64"},
222 {name: "OR", argLength: 2, reg: gp21, asm: "ORR", commutative: true},
223 {name: "ORconst", argLength: 1, reg: gp11, asm: "ORR", aux: "Int64"},
224 {name: "XOR", argLength: 2, reg: gp21, asm: "EOR", commutative: true},
225 {name: "XORconst", argLength: 1, reg: gp11, asm: "EOR", aux: "Int64"},
226 {name: "BIC", argLength: 2, reg: gp21, asm: "BIC"},
227 {name: "EON", argLength: 2, reg: gp21, asm: "EON"},
228 {name: "ORN", argLength: 2, reg: gp21, asm: "ORN"},
229
230 {name: "LoweredMuluhilo", argLength: 2, reg: gp22, resultNotInArgs: true},
231
232
233 {name: "MVN", argLength: 1, reg: gp11, asm: "MVN"},
234 {name: "NEG", argLength: 1, reg: gp11, asm: "NEG"},
235 {name: "NEGSflags", argLength: 1, reg: gp11flags, typ: "(UInt64,Flags)", asm: "NEGS"},
236 {name: "NGCzerocarry", argLength: 1, reg: gp0flags1, typ: "UInt64", asm: "NGC"},
237 {name: "FABSD", argLength: 1, reg: fp11, asm: "FABSD"},
238 {name: "FNEGS", argLength: 1, reg: fp11, asm: "FNEGS"},
239 {name: "FNEGD", argLength: 1, reg: fp11, asm: "FNEGD"},
240 {name: "FSQRTD", argLength: 1, reg: fp11, asm: "FSQRTD"},
241 {name: "FSQRTS", argLength: 1, reg: fp11, asm: "FSQRTS"},
242 {name: "REV", argLength: 1, reg: gp11, asm: "REV"},
243 {name: "REVW", argLength: 1, reg: gp11, asm: "REVW"},
244 {name: "REV16", argLength: 1, reg: gp11, asm: "REV16"},
245 {name: "REV16W", argLength: 1, reg: gp11, asm: "REV16W"},
246 {name: "RBIT", argLength: 1, reg: gp11, asm: "RBIT"},
247 {name: "RBITW", argLength: 1, reg: gp11, asm: "RBITW"},
248 {name: "CLZ", argLength: 1, reg: gp11, asm: "CLZ"},
249 {name: "CLZW", argLength: 1, reg: gp11, asm: "CLZW"},
250 {name: "VCNT", argLength: 1, reg: fp11, asm: "VCNT"},
251 {name: "VUADDLV", argLength: 1, reg: fp11, asm: "VUADDLV"},
252 {name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true, zeroWidth: true},
253 {name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true, zeroWidth: true},
254
255
256 {name: "FMADDS", argLength: 3, reg: fp31, asm: "FMADDS"},
257 {name: "FMADDD", argLength: 3, reg: fp31, asm: "FMADDD"},
258 {name: "FNMADDS", argLength: 3, reg: fp31, asm: "FNMADDS"},
259 {name: "FNMADDD", argLength: 3, reg: fp31, asm: "FNMADDD"},
260 {name: "FMSUBS", argLength: 3, reg: fp31, asm: "FMSUBS"},
261 {name: "FMSUBD", argLength: 3, reg: fp31, asm: "FMSUBD"},
262 {name: "FNMSUBS", argLength: 3, reg: fp31, asm: "FNMSUBS"},
263 {name: "FNMSUBD", argLength: 3, reg: fp31, asm: "FNMSUBD"},
264 {name: "MADD", argLength: 3, reg: gp31, asm: "MADD"},
265 {name: "MADDW", argLength: 3, reg: gp31, asm: "MADDW"},
266 {name: "MSUB", argLength: 3, reg: gp31, asm: "MSUB"},
267 {name: "MSUBW", argLength: 3, reg: gp31, asm: "MSUBW"},
268
269
270 {name: "SLL", argLength: 2, reg: gp21, asm: "LSL"},
271 {name: "SLLconst", argLength: 1, reg: gp11, asm: "LSL", aux: "Int64"},
272 {name: "SRL", argLength: 2, reg: gp21, asm: "LSR"},
273 {name: "SRLconst", argLength: 1, reg: gp11, asm: "LSR", aux: "Int64"},
274 {name: "SRA", argLength: 2, reg: gp21, asm: "ASR"},
275 {name: "SRAconst", argLength: 1, reg: gp11, asm: "ASR", aux: "Int64"},
276 {name: "ROR", argLength: 2, reg: gp21, asm: "ROR"},
277 {name: "RORW", argLength: 2, reg: gp21, asm: "RORW"},
278 {name: "RORconst", argLength: 1, reg: gp11, asm: "ROR", aux: "Int64"},
279 {name: "RORWconst", argLength: 1, reg: gp11, asm: "RORW", aux: "Int64"},
280 {name: "EXTRconst", argLength: 2, reg: gp21, asm: "EXTR", aux: "Int64"},
281 {name: "EXTRWconst", argLength: 2, reg: gp21, asm: "EXTRW", aux: "Int64"},
282
283
284 {name: "CMP", argLength: 2, reg: gp2flags, asm: "CMP", typ: "Flags"},
285 {name: "CMPconst", argLength: 1, reg: gp1flags, asm: "CMP", aux: "Int64", typ: "Flags"},
286 {name: "CMPW", argLength: 2, reg: gp2flags, asm: "CMPW", typ: "Flags"},
287 {name: "CMPWconst", argLength: 1, reg: gp1flags, asm: "CMPW", aux: "Int32", typ: "Flags"},
288 {name: "CMN", argLength: 2, reg: gp2flags, asm: "CMN", typ: "Flags", commutative: true},
289 {name: "CMNconst", argLength: 1, reg: gp1flags, asm: "CMN", aux: "Int64", typ: "Flags"},
290 {name: "CMNW", argLength: 2, reg: gp2flags, asm: "CMNW", typ: "Flags", commutative: true},
291 {name: "CMNWconst", argLength: 1, reg: gp1flags, asm: "CMNW", aux: "Int32", typ: "Flags"},
292 {name: "TST", argLength: 2, reg: gp2flags, asm: "TST", typ: "Flags", commutative: true},
293 {name: "TSTconst", argLength: 1, reg: gp1flags, asm: "TST", aux: "Int64", typ: "Flags"},
294 {name: "TSTW", argLength: 2, reg: gp2flags, asm: "TSTW", typ: "Flags", commutative: true},
295 {name: "TSTWconst", argLength: 1, reg: gp1flags, asm: "TSTW", aux: "Int32", typ: "Flags"},
296 {name: "FCMPS", argLength: 2, reg: fp2flags, asm: "FCMPS", typ: "Flags"},
297 {name: "FCMPD", argLength: 2, reg: fp2flags, asm: "FCMPD", typ: "Flags"},
298 {name: "FCMPS0", argLength: 1, reg: fp1flags, asm: "FCMPS", typ: "Flags"},
299 {name: "FCMPD0", argLength: 1, reg: fp1flags, asm: "FCMPD", typ: "Flags"},
300
301
302 {name: "MVNshiftLL", argLength: 1, reg: gp11, asm: "MVN", aux: "Int64"},
303 {name: "MVNshiftRL", argLength: 1, reg: gp11, asm: "MVN", aux: "Int64"},
304 {name: "MVNshiftRA", argLength: 1, reg: gp11, asm: "MVN", aux: "Int64"},
305 {name: "MVNshiftRO", argLength: 1, reg: gp11, asm: "MVN", aux: "Int64"},
306 {name: "NEGshiftLL", argLength: 1, reg: gp11, asm: "NEG", aux: "Int64"},
307 {name: "NEGshiftRL", argLength: 1, reg: gp11, asm: "NEG", aux: "Int64"},
308 {name: "NEGshiftRA", argLength: 1, reg: gp11, asm: "NEG", aux: "Int64"},
309 {name: "ADDshiftLL", argLength: 2, reg: gp21, asm: "ADD", aux: "Int64"},
310 {name: "ADDshiftRL", argLength: 2, reg: gp21, asm: "ADD", aux: "Int64"},
311 {name: "ADDshiftRA", argLength: 2, reg: gp21, asm: "ADD", aux: "Int64"},
312 {name: "SUBshiftLL", argLength: 2, reg: gp21, asm: "SUB", aux: "Int64"},
313 {name: "SUBshiftRL", argLength: 2, reg: gp21, asm: "SUB", aux: "Int64"},
314 {name: "SUBshiftRA", argLength: 2, reg: gp21, asm: "SUB", aux: "Int64"},
315 {name: "ANDshiftLL", argLength: 2, reg: gp21, asm: "AND", aux: "Int64"},
316 {name: "ANDshiftRL", argLength: 2, reg: gp21, asm: "AND", aux: "Int64"},
317 {name: "ANDshiftRA", argLength: 2, reg: gp21, asm: "AND", aux: "Int64"},
318 {name: "ANDshiftRO", argLength: 2, reg: gp21, asm: "AND", aux: "Int64"},
319 {name: "ORshiftLL", argLength: 2, reg: gp21, asm: "ORR", aux: "Int64"},
320 {name: "ORshiftRL", argLength: 2, reg: gp21, asm: "ORR", aux: "Int64"},
321 {name: "ORshiftRA", argLength: 2, reg: gp21, asm: "ORR", aux: "Int64"},
322 {name: "ORshiftRO", argLength: 2, reg: gp21, asm: "ORR", aux: "Int64"},
323 {name: "XORshiftLL", argLength: 2, reg: gp21, asm: "EOR", aux: "Int64"},
324 {name: "XORshiftRL", argLength: 2, reg: gp21, asm: "EOR", aux: "Int64"},
325 {name: "XORshiftRA", argLength: 2, reg: gp21, asm: "EOR", aux: "Int64"},
326 {name: "XORshiftRO", argLength: 2, reg: gp21, asm: "EOR", aux: "Int64"},
327 {name: "BICshiftLL", argLength: 2, reg: gp21, asm: "BIC", aux: "Int64"},
328 {name: "BICshiftRL", argLength: 2, reg: gp21, asm: "BIC", aux: "Int64"},
329 {name: "BICshiftRA", argLength: 2, reg: gp21, asm: "BIC", aux: "Int64"},
330 {name: "BICshiftRO", argLength: 2, reg: gp21, asm: "BIC", aux: "Int64"},
331 {name: "EONshiftLL", argLength: 2, reg: gp21, asm: "EON", aux: "Int64"},
332 {name: "EONshiftRL", argLength: 2, reg: gp21, asm: "EON", aux: "Int64"},
333 {name: "EONshiftRA", argLength: 2, reg: gp21, asm: "EON", aux: "Int64"},
334 {name: "EONshiftRO", argLength: 2, reg: gp21, asm: "EON", aux: "Int64"},
335 {name: "ORNshiftLL", argLength: 2, reg: gp21, asm: "ORN", aux: "Int64"},
336 {name: "ORNshiftRL", argLength: 2, reg: gp21, asm: "ORN", aux: "Int64"},
337 {name: "ORNshiftRA", argLength: 2, reg: gp21, asm: "ORN", aux: "Int64"},
338 {name: "ORNshiftRO", argLength: 2, reg: gp21, asm: "ORN", aux: "Int64"},
339 {name: "CMPshiftLL", argLength: 2, reg: gp2flags, asm: "CMP", aux: "Int64", typ: "Flags"},
340 {name: "CMPshiftRL", argLength: 2, reg: gp2flags, asm: "CMP", aux: "Int64", typ: "Flags"},
341 {name: "CMPshiftRA", argLength: 2, reg: gp2flags, asm: "CMP", aux: "Int64", typ: "Flags"},
342 {name: "CMNshiftLL", argLength: 2, reg: gp2flags, asm: "CMN", aux: "Int64", typ: "Flags"},
343 {name: "CMNshiftRL", argLength: 2, reg: gp2flags, asm: "CMN", aux: "Int64", typ: "Flags"},
344 {name: "CMNshiftRA", argLength: 2, reg: gp2flags, asm: "CMN", aux: "Int64", typ: "Flags"},
345 {name: "TSTshiftLL", argLength: 2, reg: gp2flags, asm: "TST", aux: "Int64", typ: "Flags"},
346 {name: "TSTshiftRL", argLength: 2, reg: gp2flags, asm: "TST", aux: "Int64", typ: "Flags"},
347 {name: "TSTshiftRA", argLength: 2, reg: gp2flags, asm: "TST", aux: "Int64", typ: "Flags"},
348 {name: "TSTshiftRO", argLength: 2, reg: gp2flags, asm: "TST", aux: "Int64", typ: "Flags"},
349
350
351
352
353 {name: "BFI", argLength: 2, reg: gp21nog, asm: "BFI", aux: "ARM64BitField", resultInArg0: true},
354
355 {name: "BFXIL", argLength: 2, reg: gp21nog, asm: "BFXIL", aux: "ARM64BitField", resultInArg0: true},
356
357 {name: "SBFIZ", argLength: 1, reg: gp11, asm: "SBFIZ", aux: "ARM64BitField"},
358
359 {name: "SBFX", argLength: 1, reg: gp11, asm: "SBFX", aux: "ARM64BitField"},
360
361 {name: "UBFIZ", argLength: 1, reg: gp11, asm: "UBFIZ", aux: "ARM64BitField"},
362
363 {name: "UBFX", argLength: 1, reg: gp11, asm: "UBFX", aux: "ARM64BitField"},
364
365
366 {name: "MOVDconst", argLength: 0, reg: gp01, aux: "Int64", asm: "MOVD", typ: "UInt64", rematerializeable: true},
367 {name: "FMOVSconst", argLength: 0, reg: fp01, aux: "Float64", asm: "FMOVS", typ: "Float32", rematerializeable: true},
368 {name: "FMOVDconst", argLength: 0, reg: fp01, aux: "Float64", asm: "FMOVD", typ: "Float64", rematerializeable: true},
369
370 {name: "MOVDaddr", argLength: 1, reg: regInfo{inputs: []regMask{buildReg("SP") | buildReg("SB")}, outputs: []regMask{gp}}, aux: "SymOff", asm: "MOVD", rematerializeable: true, symEffect: "Addr"},
371
372 {name: "MOVBload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVB", typ: "Int8", faultOnNilArg0: true, symEffect: "Read"},
373 {name: "MOVBUload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVBU", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"},
374 {name: "MOVHload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVH", typ: "Int16", faultOnNilArg0: true, symEffect: "Read"},
375 {name: "MOVHUload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVHU", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"},
376 {name: "MOVWload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVW", typ: "Int32", faultOnNilArg0: true, symEffect: "Read"},
377 {name: "MOVWUload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVWU", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"},
378 {name: "MOVDload", argLength: 2, reg: gpload, aux: "SymOff", asm: "MOVD", typ: "UInt64", faultOnNilArg0: true, symEffect: "Read"},
379 {name: "FMOVSload", argLength: 2, reg: fpload, aux: "SymOff", asm: "FMOVS", typ: "Float32", faultOnNilArg0: true, symEffect: "Read"},
380 {name: "FMOVDload", argLength: 2, reg: fpload, aux: "SymOff", asm: "FMOVD", typ: "Float64", faultOnNilArg0: true, symEffect: "Read"},
381
382
383 {name: "MOVDloadidx", argLength: 3, reg: gp2load, asm: "MOVD", typ: "UInt64"},
384 {name: "MOVWloadidx", argLength: 3, reg: gp2load, asm: "MOVW", typ: "Int32"},
385 {name: "MOVWUloadidx", argLength: 3, reg: gp2load, asm: "MOVWU", typ: "UInt32"},
386 {name: "MOVHloadidx", argLength: 3, reg: gp2load, asm: "MOVH", typ: "Int16"},
387 {name: "MOVHUloadidx", argLength: 3, reg: gp2load, asm: "MOVHU", typ: "UInt16"},
388 {name: "MOVBloadidx", argLength: 3, reg: gp2load, asm: "MOVB", typ: "Int8"},
389 {name: "MOVBUloadidx", argLength: 3, reg: gp2load, asm: "MOVBU", typ: "UInt8"},
390 {name: "FMOVSloadidx", argLength: 3, reg: fp2load, asm: "FMOVS", typ: "Float32"},
391 {name: "FMOVDloadidx", argLength: 3, reg: fp2load, asm: "FMOVD", typ: "Float64"},
392
393
394 {name: "MOVHloadidx2", argLength: 3, reg: gp2load, asm: "MOVH", typ: "Int16"},
395 {name: "MOVHUloadidx2", argLength: 3, reg: gp2load, asm: "MOVHU", typ: "UInt16"},
396 {name: "MOVWloadidx4", argLength: 3, reg: gp2load, asm: "MOVW", typ: "Int32"},
397 {name: "MOVWUloadidx4", argLength: 3, reg: gp2load, asm: "MOVWU", typ: "UInt32"},
398 {name: "MOVDloadidx8", argLength: 3, reg: gp2load, asm: "MOVD", typ: "UInt64"},
399 {name: "FMOVSloadidx4", argLength: 3, reg: fp2load, asm: "FMOVS", typ: "Float32"},
400 {name: "FMOVDloadidx8", argLength: 3, reg: fp2load, asm: "FMOVD", typ: "Float64"},
401
402 {name: "MOVBstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVB", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
403 {name: "MOVHstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVH", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
404 {name: "MOVWstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVW", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
405 {name: "MOVDstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVD", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
406 {name: "STP", argLength: 4, reg: gpstore2, aux: "SymOff", asm: "STP", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
407 {name: "FMOVSstore", argLength: 3, reg: fpstore, aux: "SymOff", asm: "FMOVS", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
408 {name: "FMOVDstore", argLength: 3, reg: fpstore, aux: "SymOff", asm: "FMOVD", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
409
410
411 {name: "MOVBstoreidx", argLength: 4, reg: gpstore2, asm: "MOVB", typ: "Mem"},
412 {name: "MOVHstoreidx", argLength: 4, reg: gpstore2, asm: "MOVH", typ: "Mem"},
413 {name: "MOVWstoreidx", argLength: 4, reg: gpstore2, asm: "MOVW", typ: "Mem"},
414 {name: "MOVDstoreidx", argLength: 4, reg: gpstore2, asm: "MOVD", typ: "Mem"},
415 {name: "FMOVSstoreidx", argLength: 4, reg: fpstore2, asm: "FMOVS", typ: "Mem"},
416 {name: "FMOVDstoreidx", argLength: 4, reg: fpstore2, asm: "FMOVD", typ: "Mem"},
417
418
419 {name: "MOVHstoreidx2", argLength: 4, reg: gpstore2, asm: "MOVH", typ: "Mem"},
420 {name: "MOVWstoreidx4", argLength: 4, reg: gpstore2, asm: "MOVW", typ: "Mem"},
421 {name: "MOVDstoreidx8", argLength: 4, reg: gpstore2, asm: "MOVD", typ: "Mem"},
422 {name: "FMOVSstoreidx4", argLength: 4, reg: fpstore2, asm: "FMOVS", typ: "Mem"},
423 {name: "FMOVDstoreidx8", argLength: 4, reg: fpstore2, asm: "FMOVD", typ: "Mem"},
424
425 {name: "MOVBstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVB", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
426 {name: "MOVHstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVH", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
427 {name: "MOVWstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVW", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
428 {name: "MOVDstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVD", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
429 {name: "MOVQstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "STP", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
430
431
432 {name: "MOVBstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVB", typ: "Mem"},
433 {name: "MOVHstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVH", typ: "Mem"},
434 {name: "MOVWstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVW", typ: "Mem"},
435 {name: "MOVDstorezeroidx", argLength: 3, reg: gpstore, asm: "MOVD", typ: "Mem"},
436
437
438 {name: "MOVHstorezeroidx2", argLength: 3, reg: gpstore, asm: "MOVH", typ: "Mem"},
439 {name: "MOVWstorezeroidx4", argLength: 3, reg: gpstore, asm: "MOVW", typ: "Mem"},
440 {name: "MOVDstorezeroidx8", argLength: 3, reg: gpstore, asm: "MOVD", typ: "Mem"},
441
442 {name: "FMOVDgpfp", argLength: 1, reg: gpfp, asm: "FMOVD"},
443 {name: "FMOVDfpgp", argLength: 1, reg: fpgp, asm: "FMOVD"},
444 {name: "FMOVSgpfp", argLength: 1, reg: gpfp, asm: "FMOVS"},
445 {name: "FMOVSfpgp", argLength: 1, reg: fpgp, asm: "FMOVS"},
446
447
448 {name: "MOVBreg", argLength: 1, reg: gp11, asm: "MOVB"},
449 {name: "MOVBUreg", argLength: 1, reg: gp11, asm: "MOVBU"},
450 {name: "MOVHreg", argLength: 1, reg: gp11, asm: "MOVH"},
451 {name: "MOVHUreg", argLength: 1, reg: gp11, asm: "MOVHU"},
452 {name: "MOVWreg", argLength: 1, reg: gp11, asm: "MOVW"},
453 {name: "MOVWUreg", argLength: 1, reg: gp11, asm: "MOVWU"},
454 {name: "MOVDreg", argLength: 1, reg: gp11, asm: "MOVD"},
455
456 {name: "MOVDnop", argLength: 1, reg: regInfo{inputs: []regMask{gp}, outputs: []regMask{gp}}, resultInArg0: true},
457
458 {name: "SCVTFWS", argLength: 1, reg: gpfp, asm: "SCVTFWS"},
459 {name: "SCVTFWD", argLength: 1, reg: gpfp, asm: "SCVTFWD"},
460 {name: "UCVTFWS", argLength: 1, reg: gpfp, asm: "UCVTFWS"},
461 {name: "UCVTFWD", argLength: 1, reg: gpfp, asm: "UCVTFWD"},
462 {name: "SCVTFS", argLength: 1, reg: gpfp, asm: "SCVTFS"},
463 {name: "SCVTFD", argLength: 1, reg: gpfp, asm: "SCVTFD"},
464 {name: "UCVTFS", argLength: 1, reg: gpfp, asm: "UCVTFS"},
465 {name: "UCVTFD", argLength: 1, reg: gpfp, asm: "UCVTFD"},
466 {name: "FCVTZSSW", argLength: 1, reg: fpgp, asm: "FCVTZSSW"},
467 {name: "FCVTZSDW", argLength: 1, reg: fpgp, asm: "FCVTZSDW"},
468 {name: "FCVTZUSW", argLength: 1, reg: fpgp, asm: "FCVTZUSW"},
469 {name: "FCVTZUDW", argLength: 1, reg: fpgp, asm: "FCVTZUDW"},
470 {name: "FCVTZSS", argLength: 1, reg: fpgp, asm: "FCVTZSS"},
471 {name: "FCVTZSD", argLength: 1, reg: fpgp, asm: "FCVTZSD"},
472 {name: "FCVTZUS", argLength: 1, reg: fpgp, asm: "FCVTZUS"},
473 {name: "FCVTZUD", argLength: 1, reg: fpgp, asm: "FCVTZUD"},
474 {name: "FCVTSD", argLength: 1, reg: fp11, asm: "FCVTSD"},
475 {name: "FCVTDS", argLength: 1, reg: fp11, asm: "FCVTDS"},
476
477
478 {name: "FRINTAD", argLength: 1, reg: fp11, asm: "FRINTAD"},
479 {name: "FRINTMD", argLength: 1, reg: fp11, asm: "FRINTMD"},
480 {name: "FRINTND", argLength: 1, reg: fp11, asm: "FRINTND"},
481 {name: "FRINTPD", argLength: 1, reg: fp11, asm: "FRINTPD"},
482 {name: "FRINTZD", argLength: 1, reg: fp11, asm: "FRINTZD"},
483
484
485
486 {name: "CSEL", argLength: 3, reg: gp2flags1, asm: "CSEL", aux: "CCop"},
487 {name: "CSEL0", argLength: 2, reg: gp1flags1, asm: "CSEL", aux: "CCop"},
488 {name: "CSINC", argLength: 3, reg: gp2flags1, asm: "CSINC", aux: "CCop"},
489 {name: "CSINV", argLength: 3, reg: gp2flags1, asm: "CSINV", aux: "CCop"},
490 {name: "CSNEG", argLength: 3, reg: gp2flags1, asm: "CSNEG", aux: "CCop"},
491 {name: "CSETM", argLength: 1, reg: readflags, asm: "CSETM", aux: "CCop"},
492
493
494 {name: "CALLstatic", argLength: -1, reg: regInfo{clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
495 {name: "CALLtail", argLength: -1, reg: regInfo{clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true, tailCall: true},
496 {name: "CALLclosure", argLength: -1, reg: regInfo{inputs: []regMask{gpsp, buildReg("R26"), 0}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
497 {name: "CALLinter", argLength: -1, reg: regInfo{inputs: []regMask{gp}, clobbers: callerSave}, aux: "CallOff", clobberFlags: true, call: true},
498
499
500 {name: "LoweredNilCheck", argLength: 2, reg: regInfo{inputs: []regMask{gpg}}, nilCheck: true, faultOnNilArg0: true},
501
502 {name: "Equal", argLength: 1, reg: readflags},
503 {name: "NotEqual", argLength: 1, reg: readflags},
504 {name: "LessThan", argLength: 1, reg: readflags},
505 {name: "LessEqual", argLength: 1, reg: readflags},
506 {name: "GreaterThan", argLength: 1, reg: readflags},
507 {name: "GreaterEqual", argLength: 1, reg: readflags},
508 {name: "LessThanU", argLength: 1, reg: readflags},
509 {name: "LessEqualU", argLength: 1, reg: readflags},
510 {name: "GreaterThanU", argLength: 1, reg: readflags},
511 {name: "GreaterEqualU", argLength: 1, reg: readflags},
512 {name: "LessThanF", argLength: 1, reg: readflags},
513 {name: "LessEqualF", argLength: 1, reg: readflags},
514 {name: "GreaterThanF", argLength: 1, reg: readflags},
515 {name: "GreaterEqualF", argLength: 1, reg: readflags},
516 {name: "NotLessThanF", argLength: 1, reg: readflags},
517 {name: "NotLessEqualF", argLength: 1, reg: readflags},
518 {name: "NotGreaterThanF", argLength: 1, reg: readflags},
519 {name: "NotGreaterEqualF", argLength: 1, reg: readflags},
520
521
522
523
524
525
526
527 {
528 name: "DUFFZERO",
529 aux: "Int64",
530 argLength: 2,
531 reg: regInfo{
532 inputs: []regMask{buildReg("R20")},
533 clobbers: buildReg("R16 R17 R20 R30"),
534 },
535 faultOnNilArg0: true,
536 unsafePoint: true,
537 },
538
539
540
541
542
543
544
545
546
547
548
549 {
550 name: "LoweredZero",
551 argLength: 3,
552 reg: regInfo{
553 inputs: []regMask{buildReg("R16"), gp},
554 clobbers: buildReg("R16"),
555 },
556 clobberFlags: true,
557 faultOnNilArg0: true,
558 },
559
560
561
562
563
564
565
566
567
568 {
569 name: "DUFFCOPY",
570 aux: "Int64",
571 argLength: 3,
572 reg: regInfo{
573 inputs: []regMask{buildReg("R21"), buildReg("R20")},
574 clobbers: buildReg("R16 R17 R20 R21 R26 R30"),
575 },
576 faultOnNilArg0: true,
577 faultOnNilArg1: true,
578 unsafePoint: true,
579 },
580
581
582
583
584
585
586
587
588
589
590
591
592
593 {
594 name: "LoweredMove",
595 argLength: 4,
596 reg: regInfo{
597 inputs: []regMask{buildReg("R17"), buildReg("R16"), gp},
598 clobbers: buildReg("R16 R17"),
599 },
600 clobberFlags: true,
601 faultOnNilArg0: true,
602 faultOnNilArg1: true,
603 },
604
605
606
607
608 {name: "LoweredGetClosurePtr", reg: regInfo{outputs: []regMask{buildReg("R26")}}, zeroWidth: true},
609
610
611 {name: "LoweredGetCallerSP", reg: gp01, rematerializeable: true},
612
613
614
615
616
617 {name: "LoweredGetCallerPC", reg: gp01, rematerializeable: true},
618
619
620
621
622
623
624 {name: "FlagConstant", aux: "FlagConstant"},
625
626
627
628 {name: "InvertFlags", argLength: 1},
629
630
631
632
633 {name: "LDAR", argLength: 2, reg: gpload, asm: "LDAR", faultOnNilArg0: true},
634 {name: "LDARB", argLength: 2, reg: gpload, asm: "LDARB", faultOnNilArg0: true},
635 {name: "LDARW", argLength: 2, reg: gpload, asm: "LDARW", faultOnNilArg0: true},
636
637
638
639 {name: "STLRB", argLength: 3, reg: gpstore, asm: "STLRB", faultOnNilArg0: true, hasSideEffects: true},
640 {name: "STLR", argLength: 3, reg: gpstore, asm: "STLR", faultOnNilArg0: true, hasSideEffects: true},
641 {name: "STLRW", argLength: 3, reg: gpstore, asm: "STLRW", faultOnNilArg0: true, hasSideEffects: true},
642
643
644
645
646
647
648 {name: "LoweredAtomicExchange64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
649 {name: "LoweredAtomicExchange32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
650
651
652
653
654 {name: "LoweredAtomicExchange64Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
655 {name: "LoweredAtomicExchange32Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
656
657
658
659
660
661
662
663 {name: "LoweredAtomicAdd64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
664 {name: "LoweredAtomicAdd32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
665
666
667
668
669
670 {name: "LoweredAtomicAdd64Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
671 {name: "LoweredAtomicAdd32Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687 {name: "LoweredAtomicCas64", argLength: 4, reg: gpcas, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
688 {name: "LoweredAtomicCas32", argLength: 4, reg: gpcas, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
689
690
691
692
693
694
695
696
697
698
699
700
701
702 {name: "LoweredAtomicCas64Variant", argLength: 4, reg: gpcas, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
703 {name: "LoweredAtomicCas32Variant", argLength: 4, reg: gpcas, resultNotInArgs: true, clobberFlags: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
704
705
706
707
708
709
710
711 {name: "LoweredAtomicAnd8", argLength: 3, reg: gpxchg, resultNotInArgs: true, asm: "AND", typ: "(UInt8,Mem)", faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
712 {name: "LoweredAtomicAnd32", argLength: 3, reg: gpxchg, resultNotInArgs: true, asm: "AND", typ: "(UInt32,Mem)", faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
713 {name: "LoweredAtomicOr8", argLength: 3, reg: gpxchg, resultNotInArgs: true, asm: "ORR", typ: "(UInt8,Mem)", faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
714 {name: "LoweredAtomicOr32", argLength: 3, reg: gpxchg, resultNotInArgs: true, asm: "ORR", typ: "(UInt32,Mem)", faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
715
716
717
718
719
720
721
722
723
724
725 {name: "LoweredAtomicAnd8Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, typ: "(UInt8,Mem)", faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
726 {name: "LoweredAtomicAnd32Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, typ: "(UInt32,Mem)", faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
727 {name: "LoweredAtomicOr8Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, typ: "(UInt8,Mem)", faultOnNilArg0: true, hasSideEffects: true},
728 {name: "LoweredAtomicOr32Variant", argLength: 3, reg: gpxchg, resultNotInArgs: true, typ: "(UInt32,Mem)", faultOnNilArg0: true, hasSideEffects: true},
729
730
731
732
733
734 {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("R2"), buildReg("R3")}, clobbers: (callerSave &^ gpg) | buildReg("R16 R17 R30")}, clobberFlags: true, aux: "Sym", symEffect: "None"},
735
736
737
738
739 {name: "LoweredPanicBoundsA", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r2, r3}}, typ: "Mem", call: true},
740 {name: "LoweredPanicBoundsB", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r1, r2}}, typ: "Mem", call: true},
741 {name: "LoweredPanicBoundsC", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{r0, r1}}, typ: "Mem", call: true},
742
743
744
745 {name: "PRFM", argLength: 2, aux: "Int64", reg: prefreg, asm: "PRFM", hasSideEffects: true},
746
747
748 {name: "DMB", argLength: 1, aux: "Int64", asm: "DMB", hasSideEffects: true},
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: "ULT", controls: 1},
759 {name: "ULE", controls: 1},
760 {name: "UGT", controls: 1},
761 {name: "UGE", controls: 1},
762 {name: "Z", controls: 1},
763 {name: "NZ", controls: 1},
764 {name: "ZW", controls: 1},
765 {name: "NZW", controls: 1},
766 {name: "TBZ", controls: 1, aux: "Int64"},
767 {name: "TBNZ", controls: 1, aux: "Int64"},
768 {name: "FLT", controls: 1},
769 {name: "FLE", controls: 1},
770 {name: "FGT", controls: 1},
771 {name: "FGE", controls: 1},
772 {name: "LTnoov", controls: 1},
773 {name: "LEnoov", controls: 1},
774 {name: "GTnoov", controls: 1},
775 {name: "GEnoov", controls: 1},
776 }
777
778 archs = append(archs, arch{
779 name: "ARM64",
780 pkg: "cmd/internal/obj/arm64",
781 genfile: "../../arm64/ssa.go",
782 ops: ops,
783 blocks: blocks,
784 regnames: regNamesARM64,
785 ParamIntRegNames: "R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15",
786 ParamFloatRegNames: "F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15",
787 gpregmask: gp,
788 fpregmask: fp,
789 framepointerreg: -1,
790 linkreg: int8(num["R30"]),
791 })
792 }
793
View as plain text