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: "AND", argLength: 2, reg: gp21, asm: "AND", commutative: true},
225 {name: "ANDI", argLength: 1, reg: gp11, asm: "ANDI", aux: "Int64"},
226 {name: "NOT", argLength: 1, reg: gp11, asm: "NOT"},
227 {name: "OR", argLength: 2, reg: gp21, asm: "OR", commutative: true},
228 {name: "ORI", argLength: 1, reg: gp11, asm: "ORI", aux: "Int64"},
229 {name: "ROL", argLength: 2, reg: gp21, asm: "ROL"},
230 {name: "ROLW", argLength: 2, reg: gp21, asm: "ROLW"},
231 {name: "ROR", argLength: 2, reg: gp21, asm: "ROR"},
232 {name: "RORI", argLength: 1, reg: gp11, asm: "RORI", aux: "Int64"},
233 {name: "RORIW", argLength: 1, reg: gp11, asm: "RORIW", aux: "Int64"},
234 {name: "RORW", argLength: 2, reg: gp21, asm: "RORW"},
235 {name: "XOR", argLength: 2, reg: gp21, asm: "XOR", commutative: true},
236 {name: "XORI", argLength: 1, reg: gp11, asm: "XORI", aux: "Int64"},
237
238
239 {name: "SEQZ", argLength: 1, reg: gp11, asm: "SEQZ"},
240 {name: "SNEZ", argLength: 1, reg: gp11, asm: "SNEZ"},
241 {name: "SLT", argLength: 2, reg: gp21, asm: "SLT"},
242 {name: "SLTI", argLength: 1, reg: gp11, asm: "SLTI", aux: "Int64"},
243 {name: "SLTU", argLength: 2, reg: gp21, asm: "SLTU"},
244 {name: "SLTIU", argLength: 1, reg: gp11, asm: "SLTIU", aux: "Int64"},
245
246
247 {name: "LoweredRound32F", argLength: 1, reg: fp11, resultInArg0: true},
248 {name: "LoweredRound64F", argLength: 1, reg: fp11, resultInArg0: true},
249
250
251 {name: "CALLstatic", argLength: -1, reg: call, aux: "CallOff", call: true},
252 {name: "CALLtail", argLength: -1, reg: call, aux: "CallOff", call: true, tailCall: true},
253 {name: "CALLclosure", argLength: -1, reg: callClosure, aux: "CallOff", call: true},
254 {name: "CALLinter", argLength: -1, reg: callInter, aux: "CallOff", call: true},
255
256
257
258
259
260
261
262 {
263 name: "DUFFZERO",
264 aux: "Int64",
265 argLength: 2,
266 reg: regInfo{
267 inputs: []regMask{regNamed["X25"]},
268 clobbers: regNamed["X1"] | regNamed["X25"],
269 },
270 typ: "Mem",
271 faultOnNilArg0: true,
272 },
273
274
275
276
277
278
279
280
281 {
282 name: "DUFFCOPY",
283 aux: "Int64",
284 argLength: 3,
285 reg: regInfo{
286 inputs: []regMask{regNamed["X25"], regNamed["X24"]},
287 clobbers: regNamed["X1"] | regNamed["X24"] | regNamed["X25"],
288 },
289 typ: "Mem",
290 faultOnNilArg0: true,
291 faultOnNilArg1: true,
292 },
293
294
295
296
297
298
299
300
301
302
303
304
305 {
306 name: "LoweredZero",
307 aux: "Int64",
308 argLength: 3,
309 reg: regInfo{
310 inputs: []regMask{regNamed["X5"], gpMask},
311 clobbers: regNamed["X5"],
312 },
313 typ: "Mem",
314 faultOnNilArg0: true,
315 },
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330 {
331 name: "LoweredMove",
332 aux: "Int64",
333 argLength: 4,
334 reg: regInfo{
335 inputs: []regMask{regNamed["X5"], regNamed["X6"], gpMask &^ regNamed["X7"]},
336 clobbers: regNamed["X5"] | regNamed["X6"] | regNamed["X7"],
337 },
338 typ: "Mem",
339 faultOnNilArg0: true,
340 faultOnNilArg1: true,
341 },
342
343
344
345
346 {name: "LoweredAtomicLoad8", argLength: 2, reg: gpload, faultOnNilArg0: true},
347 {name: "LoweredAtomicLoad32", argLength: 2, reg: gpload, faultOnNilArg0: true},
348 {name: "LoweredAtomicLoad64", argLength: 2, reg: gpload, faultOnNilArg0: true},
349
350
351
352 {name: "LoweredAtomicStore8", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
353 {name: "LoweredAtomicStore32", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
354 {name: "LoweredAtomicStore64", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
355
356
357
358 {name: "LoweredAtomicExchange32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
359 {name: "LoweredAtomicExchange64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true},
360
361
362
363 {name: "LoweredAtomicAdd32", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
364 {name: "LoweredAtomicAdd64", argLength: 3, reg: gpxchg, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380 {name: "LoweredAtomicCas32", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
381 {name: "LoweredAtomicCas64", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
382
383
384
385 {name: "LoweredAtomicAnd32", argLength: 3, reg: gpatomic, asm: "AMOANDW", faultOnNilArg0: true, hasSideEffects: true},
386 {name: "LoweredAtomicOr32", argLength: 3, reg: gpatomic, asm: "AMOORW", faultOnNilArg0: true, hasSideEffects: true},
387
388
389 {name: "LoweredNilCheck", argLength: 2, faultOnNilArg0: true, nilCheck: true, reg: regInfo{inputs: []regMask{gpspMask}}},
390 {name: "LoweredGetClosurePtr", reg: regInfo{outputs: []regMask{regCtxt}}},
391
392
393 {name: "LoweredGetCallerSP", argLength: 1, reg: gp01, rematerializeable: true},
394
395
396
397
398
399 {name: "LoweredGetCallerPC", reg: gp01, rematerializeable: true},
400
401
402
403
404
405
406 {name: "LoweredWB", argLength: 1, reg: regInfo{clobbers: (callerSave &^ (gpMask | regNamed["g"])) | regNamed["X1"], outputs: []regMask{regNamed["X24"]}}, clobberFlags: true, aux: "Int64"},
407
408
409 {name: "LoweredPubBarrier", argLength: 1, asm: "FENCE", hasSideEffects: true},
410
411
412
413
414 {name: "LoweredPanicBoundsA", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{regNamed["X7"], regNamed["X28"]}}, typ: "Mem", call: true},
415 {name: "LoweredPanicBoundsB", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{regNamed["X6"], regNamed["X7"]}}, typ: "Mem", call: true},
416 {name: "LoweredPanicBoundsC", argLength: 3, aux: "Int64", reg: regInfo{inputs: []regMask{regNamed["X5"], regNamed["X6"]}}, typ: "Mem", call: true},
417
418
419 {name: "FADDS", argLength: 2, reg: fp21, asm: "FADDS", commutative: true, typ: "Float32"},
420 {name: "FSUBS", argLength: 2, reg: fp21, asm: "FSUBS", commutative: false, typ: "Float32"},
421 {name: "FMULS", argLength: 2, reg: fp21, asm: "FMULS", commutative: true, typ: "Float32"},
422 {name: "FDIVS", argLength: 2, reg: fp21, asm: "FDIVS", commutative: false, typ: "Float32"},
423 {name: "FMADDS", argLength: 3, reg: fp31, asm: "FMADDS", commutative: true, typ: "Float32"},
424 {name: "FMSUBS", argLength: 3, reg: fp31, asm: "FMSUBS", commutative: true, typ: "Float32"},
425 {name: "FNMADDS", argLength: 3, reg: fp31, asm: "FNMADDS", commutative: true, typ: "Float32"},
426 {name: "FNMSUBS", argLength: 3, reg: fp31, asm: "FNMSUBS", commutative: true, typ: "Float32"},
427 {name: "FSQRTS", argLength: 1, reg: fp11, asm: "FSQRTS", typ: "Float32"},
428 {name: "FNEGS", argLength: 1, reg: fp11, asm: "FNEGS", typ: "Float32"},
429 {name: "FMVSX", argLength: 1, reg: gpfp, asm: "FMVSX", typ: "Float32"},
430 {name: "FCVTSW", argLength: 1, reg: gpfp, asm: "FCVTSW", typ: "Float32"},
431 {name: "FCVTSL", argLength: 1, reg: gpfp, asm: "FCVTSL", typ: "Float32"},
432 {name: "FCVTWS", argLength: 1, reg: fpgp, asm: "FCVTWS", typ: "Int32"},
433 {name: "FCVTLS", argLength: 1, reg: fpgp, asm: "FCVTLS", typ: "Int64"},
434 {name: "FMOVWload", argLength: 2, reg: fpload, asm: "MOVF", aux: "SymOff", typ: "Float32", faultOnNilArg0: true, symEffect: "Read"},
435 {name: "FMOVWstore", argLength: 3, reg: fpstore, asm: "MOVF", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
436 {name: "FEQS", argLength: 2, reg: fp2gp, asm: "FEQS", commutative: true},
437 {name: "FNES", argLength: 2, reg: fp2gp, asm: "FNES", commutative: true},
438 {name: "FLTS", argLength: 2, reg: fp2gp, asm: "FLTS"},
439 {name: "FLES", argLength: 2, reg: fp2gp, asm: "FLES"},
440 {name: "LoweredFMAXS", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMAXS", commutative: true, typ: "Float32"},
441 {name: "LoweredFMINS", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMINS", commutative: true, typ: "Float32"},
442
443
444 {name: "FADDD", argLength: 2, reg: fp21, asm: "FADDD", commutative: true, typ: "Float64"},
445 {name: "FSUBD", argLength: 2, reg: fp21, asm: "FSUBD", commutative: false, typ: "Float64"},
446 {name: "FMULD", argLength: 2, reg: fp21, asm: "FMULD", commutative: true, typ: "Float64"},
447 {name: "FDIVD", argLength: 2, reg: fp21, asm: "FDIVD", commutative: false, typ: "Float64"},
448 {name: "FMADDD", argLength: 3, reg: fp31, asm: "FMADDD", commutative: true, typ: "Float64"},
449 {name: "FMSUBD", argLength: 3, reg: fp31, asm: "FMSUBD", commutative: true, typ: "Float64"},
450 {name: "FNMADDD", argLength: 3, reg: fp31, asm: "FNMADDD", commutative: true, typ: "Float64"},
451 {name: "FNMSUBD", argLength: 3, reg: fp31, asm: "FNMSUBD", commutative: true, typ: "Float64"},
452 {name: "FSQRTD", argLength: 1, reg: fp11, asm: "FSQRTD", typ: "Float64"},
453 {name: "FNEGD", argLength: 1, reg: fp11, asm: "FNEGD", typ: "Float64"},
454 {name: "FABSD", argLength: 1, reg: fp11, asm: "FABSD", typ: "Float64"},
455 {name: "FSGNJD", argLength: 2, reg: fp21, asm: "FSGNJD", typ: "Float64"},
456 {name: "FMVDX", argLength: 1, reg: gpfp, asm: "FMVDX", typ: "Float64"},
457 {name: "FCVTDW", argLength: 1, reg: gpfp, asm: "FCVTDW", typ: "Float64"},
458 {name: "FCVTDL", argLength: 1, reg: gpfp, asm: "FCVTDL", typ: "Float64"},
459 {name: "FCVTWD", argLength: 1, reg: fpgp, asm: "FCVTWD", typ: "Int32"},
460 {name: "FCVTLD", argLength: 1, reg: fpgp, asm: "FCVTLD", typ: "Int64"},
461 {name: "FCVTDS", argLength: 1, reg: fp11, asm: "FCVTDS", typ: "Float64"},
462 {name: "FCVTSD", argLength: 1, reg: fp11, asm: "FCVTSD", typ: "Float32"},
463 {name: "FMOVDload", argLength: 2, reg: fpload, asm: "MOVD", aux: "SymOff", typ: "Float64", faultOnNilArg0: true, symEffect: "Read"},
464 {name: "FMOVDstore", argLength: 3, reg: fpstore, asm: "MOVD", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"},
465 {name: "FEQD", argLength: 2, reg: fp2gp, asm: "FEQD", commutative: true},
466 {name: "FNED", argLength: 2, reg: fp2gp, asm: "FNED", commutative: true},
467 {name: "FLTD", argLength: 2, reg: fp2gp, asm: "FLTD"},
468 {name: "FLED", argLength: 2, reg: fp2gp, asm: "FLED"},
469 {name: "LoweredFMIND", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMIND", commutative: true, typ: "Float64"},
470 {name: "LoweredFMAXD", argLength: 2, reg: fp21, resultNotInArgs: true, asm: "FMAXD", commutative: true, typ: "Float64"},
471 }
472
473 RISCV64blocks := []blockData{
474 {name: "BEQ", controls: 2},
475 {name: "BNE", controls: 2},
476 {name: "BLT", controls: 2},
477 {name: "BGE", controls: 2},
478 {name: "BLTU", controls: 2},
479 {name: "BGEU", controls: 2},
480
481 {name: "BEQZ", controls: 1},
482 {name: "BNEZ", controls: 1},
483 {name: "BLEZ", controls: 1},
484 {name: "BGEZ", controls: 1},
485 {name: "BLTZ", controls: 1},
486 {name: "BGTZ", controls: 1},
487 }
488
489 archs = append(archs, arch{
490 name: "RISCV64",
491 pkg: "cmd/internal/obj/riscv",
492 genfile: "../../riscv64/ssa.go",
493 ops: RISCV64ops,
494 blocks: RISCV64blocks,
495 regnames: regNamesRISCV64,
496 gpregmask: gpMask,
497 fpregmask: fpMask,
498 framepointerreg: -1,
499
500 ParamIntRegNames: "X10 X11 X12 X13 X14 X15 X16 X17 X8 X9 X18 X19 X20 X21 X22 X23",
501
502 ParamFloatRegNames: "F10 F11 F12 F13 F14 F15 F16 F17 F8 F9 F18 F19 F20 F21 F22 F23",
503 })
504 }
505
View as plain text