1
2
3
4
5 package main
6
7 import (
8 "fmt"
9 )
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 const (
25 riscv64REG_G = 27
26 riscv64REG_CTXT = 26
27 riscv64REG_LR = 1
28 riscv64REG_SP = 2
29 riscv64REG_GP = 3
30 riscv64REG_TP = 4
31 riscv64REG_TMP = 31
32 riscv64REG_ZERO = 0
33 )
34
35 func riscv64RegName(r int) string {
36 switch {
37 case r == riscv64REG_G:
38 return "g"
39 case r == riscv64REG_SP:
40 return "SP"
41 case 0 <= r && r <= 31:
42 return fmt.Sprintf("X%d", r)
43 case 32 <= r && r <= 63:
44 return fmt.Sprintf("F%d", r-32)
45 default:
46 panic(fmt.Sprintf("unknown register %d", r))
47 }
48 }
49
50 func init() {
51 var regNamesRISCV64 []string
52 var gpMask, fpMask, gpgMask, gpspMask, gpspsbMask, gpspsbgMask regMask
53 regNamed := make(map[string]regMask)
54
55
56
57
58
59 addreg := func(r int, name string) regMask {
60 mask := regMask(1) << uint(len(regNamesRISCV64))
61 if name == "" {
62 name = riscv64RegName(r)
63 }
64 regNamesRISCV64 = append(regNamesRISCV64, name)
65 regNamed[name] = mask
66 return mask
67 }
68
69
70 for r := 0; r <= 31; r++ {
71 if r == riscv64REG_LR {
72
73
74 continue
75 }
76
77 mask := addreg(r, "")
78
79
80 switch r {
81
82 case riscv64REG_ZERO, riscv64REG_GP, riscv64REG_TP, riscv64REG_TMP:
83 case riscv64REG_G:
84 gpgMask |= mask
85 gpspsbgMask |= mask
86 case riscv64REG_SP:
87 gpspMask |= mask
88 gpspsbMask |= mask
89 gpspsbgMask |= mask
90 default:
91 gpMask |= mask
92 gpgMask |= mask
93 gpspMask |= mask
94 gpspsbMask |= mask
95 gpspsbgMask |= mask
96 }
97 }
98
99
100 for r := 32; r <= 63; r++ {
101 mask := addreg(r, "")
102 fpMask |= mask
103 }
104
105
106 mask := addreg(-1, "SB")
107 gpspsbMask |= mask
108 gpspsbgMask |= mask
109
110 if len(regNamesRISCV64) > 64 {
111
112 panic("Too many RISCV64 registers")
113 }
114
115 regCtxt := regNamed["X26"]
116 callerSave := gpMask | fpMask | regNamed["g"]
117
118 var (
119 gpstore = regInfo{inputs: []regMask{gpspsbMask, gpspMask, 0}}
120 gpstore0 = regInfo{inputs: []regMask{gpspsbMask}}
121 gp01 = regInfo{outputs: []regMask{gpMask}}
122 gp11 = regInfo{inputs: []regMask{gpMask}, outputs: []regMask{gpMask}}
123 gp21 = regInfo{inputs: []regMask{gpMask, gpMask}, outputs: []regMask{gpMask}}
124 gp22 = regInfo{inputs: []regMask{gpMask, gpMask}, outputs: []regMask{gpMask, gpMask}}
125 gpload = regInfo{inputs: []regMask{gpspsbMask, 0}, outputs: []regMask{gpMask}}
126 gp11sb = regInfo{inputs: []regMask{gpspsbMask}, outputs: []regMask{gpMask}}
127 gpxchg = regInfo{inputs: []regMask{gpspsbgMask, gpgMask}, outputs: []regMask{gpMask}}
128 gpcas = regInfo{inputs: []regMask{gpspsbgMask, gpgMask, gpgMask}, outputs: []regMask{gpMask}}
129 gpatomic = regInfo{inputs: []regMask{gpspsbgMask, gpgMask}}
130
131 fp11 = regInfo{inputs: []regMask{fpMask}, outputs: []regMask{fpMask}}
132 fp21 = regInfo{inputs: []regMask{fpMask, fpMask}, outputs: []regMask{fpMask}}
133 fp31 = regInfo{inputs: []regMask{fpMask, fpMask, fpMask}, outputs: []regMask{fpMask}}
134 gpfp = regInfo{inputs: []regMask{gpMask}, outputs: []regMask{fpMask}}
135 fpgp = regInfo{inputs: []regMask{fpMask}, outputs: []regMask{gpMask}}
136 fpstore = regInfo{inputs: []regMask{gpspsbMask, fpMask, 0}}
137 fpload = regInfo{inputs: []regMask{gpspsbMask, 0}, outputs: []regMask{fpMask}}
138 fp2gp = regInfo{inputs: []regMask{fpMask, fpMask}, outputs: []regMask{gpMask}}
139
140 call = regInfo{clobbers: callerSave}
141 callClosure = regInfo{inputs: []regMask{gpspMask, regCtxt, 0}, clobbers: callerSave}
142 callInter = regInfo{inputs: []regMask{gpMask}, clobbers: callerSave}
143 )
144
145 RISCV64ops := []opData{
146 {name: "ADD", argLength: 2, reg: gp21, asm: "ADD", commutative: true},
147 {name: "ADDI", argLength: 1, reg: gp11sb, asm: "ADDI", aux: "Int64"},
148 {name: "ADDIW", argLength: 1, reg: gp11, asm: "ADDIW", aux: "Int64"},
149 {name: "NEG", argLength: 1, reg: gp11, asm: "NEG"},
150 {name: "NEGW", argLength: 1, reg: gp11, asm: "NEGW"},
151 {name: "SUB", argLength: 2, reg: gp21, asm: "SUB"},
152 {name: "SUBW", argLength: 2, reg: gp21, asm: "SUBW"},
153
154
155
156 {name: "MUL", argLength: 2, reg: gp21, asm: "MUL", commutative: true, typ: "Int64"},
157 {name: "MULW", argLength: 2, reg: gp21, asm: "MULW", commutative: true, typ: "Int32"},
158 {name: "MULH", argLength: 2, reg: gp21, asm: "MULH", commutative: true, typ: "Int64"},
159 {name: "MULHU", argLength: 2, reg: gp21, asm: "MULHU", commutative: true, typ: "UInt64"},
160 {name: "LoweredMuluhilo", argLength: 2, reg: gp22, resultNotInArgs: true},
161 {name: "LoweredMuluover", argLength: 2, reg: gp22, resultNotInArgs: true},
162
163 {name: "DIV", argLength: 2, reg: gp21, asm: "DIV", typ: "Int64"},
164 {name: "DIVU", argLength: 2, reg: gp21, asm: "DIVU", typ: "UInt64"},
165 {name: "DIVW", argLength: 2, reg: gp21, asm: "DIVW", typ: "Int32"},
166 {name: "DIVUW", argLength: 2, reg: gp21, asm: "DIVUW", typ: "UInt32"},
167 {name: "REM", argLength: 2, reg: gp21, asm: "REM", typ: "Int64"},
168 {name: "REMU", argLength: 2, reg: gp21, asm: "REMU", typ: "UInt64"},
169 {name: "REMW", argLength: 2, reg: gp21, asm: "REMW", typ: "Int32"},
170 {name: "REMUW", argLength: 2, reg: gp21, asm: "REMUW", typ: "UInt32"},
171
172 {name: "MOVaddr", argLength: 1, reg: gp11sb, asm: "MOV", aux: "SymOff", rematerializeable: true, symEffect: "Addr"},
173
174
175 {name: "MOVDconst", reg: gp01, asm: "MOV", typ: "UInt64", aux: "Int64", rematerializeable: true},
176
177
178 {name: "MOVBload", argLength: 2, reg: gpload, asm: "MOVB", aux: "SymOff", typ: "Int8", faultOnNilArg0: true, symEffect: "Read"},
179 {name: "MOVHload", argLength: 2, reg: gpload, asm: "MOVH", aux: "SymOff", typ: "Int16", faultOnNilArg0: true, symEffect: "Read"},
180 {name: "MOVWload", argLength: 2, reg: gpload, asm: "MOVW", aux: "SymOff", typ: "Int32", faultOnNilArg0: true, symEffect: "Read"},
181 {name: "MOVDload", argLength: 2, reg: gpload, asm: "MOV", aux: "SymOff", typ: "Int64", faultOnNilArg0: true, symEffect: "Read"},
182 {name: "MOVBUload", argLength: 2, reg: gpload, asm: "MOVBU", aux: "SymOff", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"},
183 {name: "MOVHUload", argLength: 2, reg: gpload, asm: "MOVHU", aux: "SymOff", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"},
184 {name: "MOVWUload", argLength: 2, reg: gpload, asm: "MOVWU", aux: "SymOff", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"},
185
186
187 {name: "MOVBstore", argLength: 3, reg: gpstore, asm: "MOVB", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
188 {name: "MOVHstore", argLength: 3, reg: gpstore, asm: "MOVH", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
189 {name: "MOVWstore", argLength: 3, reg: gpstore, asm: "MOVW", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
190 {name: "MOVDstore", argLength: 3, reg: gpstore, asm: "MOV", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
191
192
193 {name: "MOVBstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVB", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
194 {name: "MOVHstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVH", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
195 {name: "MOVWstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVW", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
196 {name: "MOVDstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOV", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
197
198
199 {name: "MOVBreg", argLength: 1, reg: gp11, asm: "MOVB"},
200 {name: "MOVHreg", argLength: 1, reg: gp11, asm: "MOVH"},
201 {name: "MOVWreg", argLength: 1, reg: gp11, asm: "MOVW"},
202 {name: "MOVDreg", argLength: 1, reg: gp11, asm: "MOV"},
203 {name: "MOVBUreg", argLength: 1, reg: gp11, asm: "MOVBU"},
204 {name: "MOVHUreg", argLength: 1, reg: gp11, asm: "MOVHU"},
205 {name: "MOVWUreg", argLength: 1, reg: gp11, asm: "MOVWU"},
206
207 {name: "MOVDnop", argLength: 1, reg: regInfo{inputs: []regMask{gpMask}, outputs: []regMask{gpMask}}, resultInArg0: true},
208
209
210 {name: "SLL", argLength: 2, reg: gp21, asm: "SLL"},
211 {name: "SLLW", argLength: 2, reg: gp21, asm: "SLLW"},
212 {name: "SRA", argLength: 2, reg: gp21, asm: "SRA"},
213 {name: "SRAW", argLength: 2, reg: gp21, asm: "SRAW"},
214 {name: "SRL", argLength: 2, reg: gp21, asm: "SRL"},
215 {name: "SRLW", argLength: 2, reg: gp21, asm: "SRLW"},
216 {name: "SLLI", argLength: 1, reg: gp11, asm: "SLLI", aux: "Int64"},
217 {name: "SLLIW", argLength: 1, reg: gp11, asm: "SLLIW", aux: "Int64"},
218 {name: "SRAI", argLength: 1, reg: gp11, asm: "SRAI", aux: "Int64"},
219 {name: "SRAIW", argLength: 1, reg: gp11, asm: "SRAIW", aux: "Int64"},
220 {name: "SRLI", argLength: 1, reg: gp11, asm: "SRLI", aux: "Int64"},
221 {name: "SRLIW", argLength: 1, reg: gp11, asm: "SRLIW", aux: "Int64"},
222
223
224 {name: "SH1ADD", argLength: 2, reg: gp21, asm: "SH1ADD"},
225 {name: "SH2ADD", argLength: 2, reg: gp21, asm: "SH2ADD"},
226 {name: "SH3ADD", argLength: 2, reg: gp21, asm: "SH3ADD"},
227
228
229 {name: "AND", argLength: 2, reg: gp21, asm: "AND", commutative: true},
230 {name: "ANDN", argLength: 2, reg: gp21, asm: "ANDN"},
231 {name: "ANDI", argLength: 1, reg: gp11, asm: "ANDI", aux: "Int64"},
232 {name: "NOT", argLength: 1, reg: gp11, asm: "NOT"},
233 {name: "OR", argLength: 2, reg: gp21, asm: "OR", commutative: true},
234 {name: "ORN", argLength: 2, reg: gp21, asm: "ORN"},
235 {name: "ORI", argLength: 1, reg: gp11, asm: "ORI", aux: "Int64"},
236 {name: "ROL", argLength: 2, reg: gp21, asm: "ROL"},
237 {name: "ROLW", argLength: 2, reg: gp21, asm: "ROLW"},
238 {name: "ROR", argLength: 2, reg: gp21, asm: "ROR"},
239 {name: "RORI", argLength: 1, reg: gp11, asm: "RORI", aux: "Int64"},
240 {name: "RORIW", argLength: 1, reg: gp11, asm: "RORIW", aux: "Int64"},
241 {name: "RORW", argLength: 2, reg: gp21, asm: "RORW"},
242 {name: "XNOR", argLength: 2, reg: gp21, asm: "XNOR", commutative: true},
243 {name: "XOR", argLength: 2, reg: gp21, asm: "XOR", commutative: true},
244 {name: "XORI", argLength: 1, reg: gp11, asm: "XORI", aux: "Int64"},
245
246
247 {name: "MIN", argLength: 2, reg: gp21, asm: "MIN", commutative: true},
248 {name: "MAX", argLength: 2, reg: gp21, asm: "MAX", commutative: true},
249 {name: "MINU", argLength: 2, reg: gp21, asm: "MINU", commutative: true},
250 {name: "MAXU", argLength: 2, reg: gp21, asm: "MAXU", commutative: true},
251
252
253 {name: "SEQZ", argLength: 1, reg: gp11, asm: "SEQZ"},
254 {name: "SNEZ", argLength: 1, reg: gp11, asm: "SNEZ"},
255 {name: "SLT", argLength: 2, reg: gp21, asm: "SLT"},
256 {name: "SLTI", argLength: 1, reg: gp11, asm: "SLTI", aux: "Int64"},
257 {name: "SLTU", argLength: 2, reg: gp21, asm: "SLTU"},
258 {name: "SLTIU", argLength: 1, reg: gp11, asm: "SLTIU", aux: "Int64"},
259
260
261 {name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true},
262 {name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true},
263
264
265 {name: "CALLstatic", argLength: -1, reg: call, aux: "CallOff", call: true},
266 {name: "CALLtail", argLength: -1, reg: call, aux: "CallOff", call: true, tailCall: true},
267 {name: "CALLclosure", argLength: -1, reg: callClosure, aux: "CallOff", call: true},
268 {name: "CALLinter", argLength: -1, reg: callInter, aux: "CallOff", call: true},
269
270
271
272
273
274
275
276 {
277 name: "DUFFZERO",
278 aux: "Int64",
279 argLength: 2,
280 reg: regInfo{
281 inputs: []regMask{regNamed["X25"]},
282 clobbers: regNamed["X1"] | regNamed["X25"],
283 },
284 typ: "Mem",
285 faultOnNilArg0: true,
286 },
287
288
289
290
291
292
293
294
295 {
296 name: "DUFFCOPY",
297 aux: "Int64",
298 argLength: 3,
299 reg: regInfo{
300 inputs: []regMask{regNamed["X25"], regNamed["X24"]},
301 clobbers: regNamed["X1"] | regNamed["X24"] | regNamed["X25"],
302 },
303 typ: "Mem",
304 faultOnNilArg0: true,
305 faultOnNilArg1: true,
306 },
307
308
309
310
311
312
313
314
315
316
317
318
319 {
320 name: "LoweredZero",
321 aux: "Int64",
322 argLength: 3,
323 reg: regInfo{
324 inputs: []regMask{regNamed["X5"], gpMask},
325 clobbers: regNamed["X5"],
326 },
327 typ: "Mem",
328 faultOnNilArg0: true,
329 },
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344 {
345 name: "LoweredMove",
346 aux: "Int64",
347 argLength: 4,
348 reg: regInfo{
349 inputs: []regMask{regNamed["X5"], regNamed["X6"], gpMask &^ regNamed["X7"]},
350 clobbers: regNamed["X5"] | regNamed["X6"] | regNamed["X7"],
351 },
352 typ: "Mem",
353 faultOnNilArg0: true,
354 faultOnNilArg1: true,
355 },
356
357
358
359
360 {name: "LoweredAtomicLoad8", argLength: 2, reg: gpload, faultOnNilArg0: true},
361 {name: "LoweredAtomicLoad32", argLength: 2, reg: gpload, faultOnNilArg0: true},
362 {name: "LoweredAtomicLoad64", argLength: 2, reg: gpload, faultOnNilArg0: true},
363
364
365
366 {name: "LoweredAtomicStore8", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
367 {name: "LoweredAtomicStore32", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
368 {name: "LoweredAtomicStore64", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
369
370
371
372 {name: "LoweredAtomicExchange32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
373 {name: "LoweredAtomicExchange64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
374
375
376
377 {name: "LoweredAtomicAdd32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
378 {name: "LoweredAtomicAdd64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394 {name: "LoweredAtomicCas32", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
395 {name: "LoweredAtomicCas64", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
396
397
398
399 {name: "LoweredAtomicAnd32", argLength: 3, reg: gpatomic, asm: "AMOANDW", faultOnNilArg0: true, hasSideEffects: true},
400 {name: "LoweredAtomicOr32", argLength: 3, reg: gpatomic, asm: "AMOORW", faultOnNilArg0: true, hasSideEffects: true},
401
402
403 {name: "LoweredNilCheck", argLength: 2, faultOnNilArg0: true, nilCheck: true, reg: regInfo{inputs: []regMask{gpspMask}}},
404 {name: "LoweredGetClosurePtr", reg: regInfo{outputs: []regMask{regCtxt}}},
405
406
407 {name: "LoweredGetCallerSP", argLength: 1, reg: gp01, rematerializeable: true},
408
409
410
411
412
413 {name: "LoweredGetCallerPC", reg: gp01, rematerializeable: true},
414
415
416
417
418
419
420 {name: "LoweredWB", argLength: 1, reg: regInfo{clobbers: (callerSave &^ (gpMask | regNamed["g"])) | regNamed["X1"], outputs: []regMask{regNamed["X24"]}}, clobberFlags: true, aux: "Int64"},
421
422
423 {name: "LoweredPubBarrier", argLength: 1, asm: "FENCE", hasSideEffects: true},
424
425
426
427
428 {name: "LoweredPanicBoundsA", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{regNamed["X7"], regNamed["X28"]}}, typ: "Mem", call: true},
429 {name: "LoweredPanicBoundsB", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{regNamed["X6"], regNamed["X7"]}}, typ: "Mem", call: true},
430 {name: "LoweredPanicBoundsC", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{regNamed["X5"], regNamed["X6"]}}, typ: "Mem", call: true},
431
432
433 {name: "FADDS", argLength: 2, reg: fp21, asm: "FADDS", commutative: true, typ: "Float32"},
434 {name: "FSUBS", argLength: 2, reg: fp21, asm: "FSUBS", commutative: false, typ: "Float32"},
435 {name: "FMULS", argLength: 2, reg: fp21, asm: "FMULS", commutative: true, typ: "Float32"},
436 {name: "FDIVS", argLength: 2, reg: fp21, asm: "FDIVS", commutative: false, typ: "Float32"},
437 {name: "FMADDS", argLength: 3, reg: fp31, asm: "FMADDS", commutative: true, typ: "Float32"},
438 {name: "FMSUBS", argLength: 3, reg: fp31, asm: "FMSUBS", commutative: true, typ: "Float32"},
439 {name: "FNMADDS", argLength: 3, reg: fp31, asm: "FNMADDS", commutative: true, typ: "Float32"},
440 {name: "FNMSUBS", argLength: 3, reg: fp31, asm: "FNMSUBS", commutative: true, typ: "Float32"},
441 {name: "FSQRTS", argLength: 1, reg: fp11, asm: "FSQRTS", typ: "Float32"},
442 {name: "FNEGS", argLength: 1, reg: fp11, asm: "FNEGS", typ: "Float32"},
443 {name: "FMVSX", argLength: 1, reg: gpfp, asm: "FMVSX", typ: "Float32"},
444 {name: "FCVTSW", argLength: 1, reg: gpfp, asm: "FCVTSW", typ: "Float32"},
445 {name: "FCVTSL", argLength: 1, reg: gpfp, asm: "FCVTSL", typ: "Float32"},
446 {name: "FCVTWS", argLength: 1, reg: fpgp, asm: "FCVTWS", typ: "Int32"},
447 {name: "FCVTLS", argLength: 1, reg: fpgp, asm: "FCVTLS", typ: "Int64"},
448 {name: "FMOVWload", argLength: 2, reg: fpload, asm: "MOVF", aux: "SymOff", typ: "Float32", faultOnNilArg0: true, symEffect: "Read"},
449 {name: "FMOVWstore", argLength: 3, reg: fpstore, asm: "MOVF", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
450 {name: "FEQS", argLength: 2, reg: fp2gp, asm: "FEQS", commutative: true},
451 {name: "FNES", argLength: 2, reg: fp2gp, asm: "FNES", commutative: true},
452 {name: "FLTS", argLength: 2, reg: fp2gp, asm: "FLTS"},
453 {name: "FLES", argLength: 2, reg: fp2gp, asm: "FLES"},
454 {name: "LoweredFMAXS", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMAXS", commutative: true, typ: "Float32"},
455 {name: "LoweredFMINS", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMINS", commutative: true, typ: "Float32"},
456
457
458 {name: "FADDD", argLength: 2, reg: fp21, asm: "FADDD", commutative: true, typ: "Float64"},
459 {name: "FSUBD", argLength: 2, reg: fp21, asm: "FSUBD", commutative: false, typ: "Float64"},
460 {name: "FMULD", argLength: 2, reg: fp21, asm: "FMULD", commutative: true, typ: "Float64"},
461 {name: "FDIVD", argLength: 2, reg: fp21, asm: "FDIVD", commutative: false, typ: "Float64"},
462 {name: "FMADDD", argLength: 3, reg: fp31, asm: "FMADDD", commutative: true, typ: "Float64"},
463 {name: "FMSUBD", argLength: 3, reg: fp31, asm: "FMSUBD", commutative: true, typ: "Float64"},
464 {name: "FNMADDD", argLength: 3, reg: fp31, asm: "FNMADDD", commutative: true, typ: "Float64"},
465 {name: "FNMSUBD", argLength: 3, reg: fp31, asm: "FNMSUBD", commutative: true, typ: "Float64"},
466 {name: "FSQRTD", argLength: 1, reg: fp11, asm: "FSQRTD", typ: "Float64"},
467 {name: "FNEGD", argLength: 1, reg: fp11, asm: "FNEGD", typ: "Float64"},
468 {name: "FABSD", argLength: 1, reg: fp11, asm: "FABSD", typ: "Float64"},
469 {name: "FSGNJD", argLength: 2, reg: fp21, asm: "FSGNJD", typ: "Float64"},
470 {name: "FMVDX", argLength: 1, reg: gpfp, asm: "FMVDX", typ: "Float64"},
471 {name: "FCVTDW", argLength: 1, reg: gpfp, asm: "FCVTDW", typ: "Float64"},
472 {name: "FCVTDL", argLength: 1, reg: gpfp, asm: "FCVTDL", typ: "Float64"},
473 {name: "FCVTWD", argLength: 1, reg: fpgp, asm: "FCVTWD", typ: "Int32"},
474 {name: "FCVTLD", argLength: 1, reg: fpgp, asm: "FCVTLD", typ: "Int64"},
475 {name: "FCVTDS", argLength: 1, reg: fp11, asm: "FCVTDS", typ: "Float64"},
476 {name: "FCVTSD", argLength: 1, reg: fp11, asm: "FCVTSD", typ: "Float32"},
477 {name: "FMOVDload", argLength: 2, reg: fpload, asm: "MOVD", aux: "SymOff", typ: "Float64", faultOnNilArg0: true, symEffect: "Read"},
478 {name: "FMOVDstore", argLength: 3, reg: fpstore, asm: "MOVD", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
479 {name: "FEQD", argLength: 2, reg: fp2gp, asm: "FEQD", commutative: true},
480 {name: "FNED", argLength: 2, reg: fp2gp, asm: "FNED", commutative: true},
481 {name: "FLTD", argLength: 2, reg: fp2gp, asm: "FLTD"},
482 {name: "FLED", argLength: 2, reg: fp2gp, asm: "FLED"},
483 {name: "LoweredFMIND", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMIND", commutative: true, typ: "Float64"},
484 {name: "LoweredFMAXD", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMAXD", commutative: true, typ: "Float64"},
485 }
486
487 RISCV64blocks := []blockData{
488 {name: "BEQ", controls: 2},
489 {name: "BNE", controls: 2},
490 {name: "BLT", controls: 2},
491 {name: "BGE", controls: 2},
492 {name: "BLTU", controls: 2},
493 {name: "BGEU", controls: 2},
494
495 {name: "BEQZ", controls: 1},
496 {name: "BNEZ", controls: 1},
497 {name: "BLEZ", controls: 1},
498 {name: "BGEZ", controls: 1},
499 {name: "BLTZ", controls: 1},
500 {name: "BGTZ", controls: 1},
501 }
502
503 archs = append(archs, arch{
504 name: "RISCV64",
505 pkg: "cmd/internal/obj/riscv",
506 genfile: "../../riscv64/ssa.go",
507 ops: RISCV64ops,
508 blocks: RISCV64blocks,
509 regnames: regNamesRISCV64,
510 gpregmask: gpMask,
511 fpregmask: fpMask,
512 framepointerreg: -1,
513
514 ParamIntRegNames: "X10 X11 X12 X13 X14 X15 X16 X17 X8 X9 X18 X19 X20 X21 X22 X23",
515
516 ParamFloatRegNames: "F10 F11 F12 F13 F14 F15 F16 F17 F8 F9 F18 F19 F20 F21 F22 F23",
517 })
518 }
519
View as plain text