/
insn_vs3rs1m.go
43 lines (34 loc) · 1.15 KB
/
insn_vs3rs1m.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package generator
import (
"fmt"
"regexp"
"strconv"
"strings"
)
func (i *Insn) genCodeVs3Rs1m(pos int) []string {
s := regexp.MustCompile(`vs(\d)r\.v`)
subs := s.FindStringSubmatch(i.Name)
lmuls := []LMUL{1}
if len(subs) == 2 {
nfields, _ := strconv.Atoi(subs[1])
lmuls = []LMUL{LMUL(nfields)}
}
combinations := i.combinations(lmuls, []SEW{8}, []bool{false}, i.vxrms())
res := make([]string, 0, len(combinations))
for _, c := range combinations[pos:] {
builder := strings.Builder{}
builder.WriteString(c.initialize())
vs3 := int(c.LMUL1)
builder.WriteString(i.gWriteIntegerTestData(c.LMUL1, c.SEW, 0))
builder.WriteString(i.gLoadDataIntoRegisterGroup(vs3, c.LMUL1, c.SEW))
builder.WriteString(i.gResultDataAddr())
builder.WriteString("# -------------- TEST BEGIN --------------\n")
builder.WriteString(i.gVsetvli(c.Vl, c.SEW, c.LMUL))
builder.WriteString(fmt.Sprintf("%s v%d, (a0)\n", i.Name, vs3))
builder.WriteString("# -------------- TEST END --------------\n")
builder.WriteString(i.gLoadDataIntoRegisterGroup(vs3, c.LMUL1, c.SEW))
builder.WriteString(i.gMagicInsn(vs3))
res = append(res, builder.String())
}
return res
}