From 82fef98793b6eed69ffd818a9ac21106ed0dd798 Mon Sep 17 00:00:00 2001 From: Syed Hassan Ul haq <113203732+SyedHassanUlHaq@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:48:48 +0500 Subject: [PATCH] Integrated support for Zvkned, Zvknha, Zvksed and Zvksh (#46) * [GSOC] added configs for Zvkned * [GSOC] implemented Generator for VdVs2Uimm format * [GSOC] added zvkned in prefix * [GSOC] added configs for Zvksed * [GSOC] modified generator to support zvksed * [GSOC] added configs for Zvknha * [GSOC] modified generator to support zvknha * [GSOC] added configs for zvksh * [GSOC] modified generator to support Zvksh * [GSOC] fixed naming conventions --- Makefile | 2 +- Makefrag | 12 ++++++ configs/vaesdf.vs.toml | 19 +++++++++ configs/vaesdf.vv.toml | 19 +++++++++ configs/vaesdm.vs.toml | 19 +++++++++ configs/vaesdm.vv.toml | 19 +++++++++ configs/vaesef.vs.toml | 19 +++++++++ configs/vaesef.vv.toml | 19 +++++++++ configs/vaesem.vs.toml | 19 +++++++++ configs/vaesem.vv.toml | 19 +++++++++ configs/vaeskf1.vi.toml | 19 +++++++++ configs/vaeskf2.vi.toml | 19 +++++++++ configs/vaesz.vs.toml | 19 +++++++++ configs/vsha2ch.vv.toml | 19 +++++++++ configs/vsha2cl.vv.toml | 19 +++++++++ configs/vsha2ms.vv.toml | 19 +++++++++ configs/vsm3c.vi.toml | 19 +++++++++ configs/vsm3me.vv.toml | 19 +++++++++ configs/vsm4k.vi.toml | 19 +++++++++ configs/vsm4r.vs.toml | 19 +++++++++ configs/vsm4r.vv.toml | 19 +++++++++ generator/insn.go | 4 ++ generator/insn_vdvs2.go | 8 ++-- generator/insn_vdvs2uimm.go | 84 +++++++++++++++++++++++++++++++++++++ generator/insn_vdvs2vs1.go | 14 ++++--- 25 files changed, 475 insertions(+), 10 deletions(-) create mode 100644 configs/vaesdf.vs.toml create mode 100644 configs/vaesdf.vv.toml create mode 100644 configs/vaesdm.vs.toml create mode 100644 configs/vaesdm.vv.toml create mode 100644 configs/vaesef.vs.toml create mode 100644 configs/vaesef.vv.toml create mode 100644 configs/vaesem.vs.toml create mode 100644 configs/vaesem.vv.toml create mode 100644 configs/vaeskf1.vi.toml create mode 100644 configs/vaeskf2.vi.toml create mode 100644 configs/vaesz.vs.toml create mode 100644 configs/vsha2ch.vv.toml create mode 100644 configs/vsha2cl.vv.toml create mode 100644 configs/vsha2ms.vv.toml create mode 100644 configs/vsm3c.vi.toml create mode 100644 configs/vsm3me.vv.toml create mode 100644 configs/vsm4k.vi.toml create mode 100644 configs/vsm4r.vs.toml create mode 100644 configs/vsm4r.vv.toml create mode 100644 generator/insn_vdvs2uimm.go diff --git a/Makefile b/Makefile index 67c9056..fbe60cb 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ CONFIGS = configs/ SPIKE = spike PATCHER_SPIKE = build/pspike -MARCH = rv${XLEN}gcv_zvbb_zvbc_zvkg +MARCH = rv${XLEN}gcv_zvbb_zvbc_zvkg_zvkned_zvknha_zvksed_zvksh MABI = lp64d ifeq ($(XLEN), 32) diff --git a/Makefrag b/Makefrag index 62347e9..ec06cf5 100644 --- a/Makefrag +++ b/Makefrag @@ -105,6 +105,10 @@ tests = \ vadd_vx-5 \ vadd_vx-6 \ vadd_vx-7 \ + vaeskf1_vi-0 \ + vaeskf1_vi-1 \ + vaeskf2_vi-0 \ + vaeskf2_vi-1 \ vand_vi-0 \ vand_vi-1 \ vand_vi-2 \ @@ -1265,6 +1269,9 @@ tests = \ vsext_vf2-1 \ vsext_vf4-0 \ vsext_vf8-0 \ + vsha2ch_vv-0 \ + vsha2cl_vv-0 \ + vsha2ms_vv-0 \ vslide1down_vx-0 \ vslide1down_vx-1 \ vslide1down_vx-2 \ @@ -1323,6 +1330,11 @@ tests = \ vsll_vx-5 \ vsll_vx-6 \ vsll_vx-7 \ + vsm3c_vi-0 \ + vsm3c_vi-1 \ + vsm3me_vv-0 \ + vsm4k_vi-0 \ + vsm4k_vi-1 \ vsm_v-0 \ vsmul_vv-0 \ vsmul_vv-1 \ diff --git a/configs/vaesdf.vs.toml b/configs/vaesdf.vs.toml new file mode 100644 index 0000000..e72809f --- /dev/null +++ b/configs/vaesdf.vs.toml @@ -0,0 +1,19 @@ +name = "vaesdf.vs" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesdf.vv.toml b/configs/vaesdf.vv.toml new file mode 100644 index 0000000..600b61b --- /dev/null +++ b/configs/vaesdf.vv.toml @@ -0,0 +1,19 @@ +name = "vaesdf.vv" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesdm.vs.toml b/configs/vaesdm.vs.toml new file mode 100644 index 0000000..47acfbb --- /dev/null +++ b/configs/vaesdm.vs.toml @@ -0,0 +1,19 @@ +name = "vaesdm.vs" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesdm.vv.toml b/configs/vaesdm.vv.toml new file mode 100644 index 0000000..a90d2fe --- /dev/null +++ b/configs/vaesdm.vv.toml @@ -0,0 +1,19 @@ +name = "vaesdm.vv" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesef.vs.toml b/configs/vaesef.vs.toml new file mode 100644 index 0000000..b0eb4fd --- /dev/null +++ b/configs/vaesef.vs.toml @@ -0,0 +1,19 @@ +name = "vaesef.vs" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesef.vv.toml b/configs/vaesef.vv.toml new file mode 100644 index 0000000..4377125 --- /dev/null +++ b/configs/vaesef.vv.toml @@ -0,0 +1,19 @@ +name = "vaesef.vv" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesem.vs.toml b/configs/vaesem.vs.toml new file mode 100644 index 0000000..89bc9b1 --- /dev/null +++ b/configs/vaesem.vs.toml @@ -0,0 +1,19 @@ +name = "vaesem.vs" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesem.vv.toml b/configs/vaesem.vv.toml new file mode 100644 index 0000000..a5e164f --- /dev/null +++ b/configs/vaesem.vv.toml @@ -0,0 +1,19 @@ +name = "vaesem.vv" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaeskf1.vi.toml b/configs/vaeskf1.vi.toml new file mode 100644 index 0000000..cc9bb57 --- /dev/null +++ b/configs/vaeskf1.vi.toml @@ -0,0 +1,19 @@ +name = "vaeskf1.vi" +format = "vd,vs2,uimm" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaeskf2.vi.toml b/configs/vaeskf2.vi.toml new file mode 100644 index 0000000..f841d52 --- /dev/null +++ b/configs/vaeskf2.vi.toml @@ -0,0 +1,19 @@ +name = "vaeskf2.vi" +format = "vd,vs2,uimm" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vaesz.vs.toml b/configs/vaesz.vs.toml new file mode 100644 index 0000000..5bee0ba --- /dev/null +++ b/configs/vaesz.vs.toml @@ -0,0 +1,19 @@ +name = "vaesz.vs" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsha2ch.vv.toml b/configs/vsha2ch.vv.toml new file mode 100644 index 0000000..8e419c9 --- /dev/null +++ b/configs/vsha2ch.vv.toml @@ -0,0 +1,19 @@ +name = "vsha2ch.vv" +format = "vd,vs2,vs1" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsha2cl.vv.toml b/configs/vsha2cl.vv.toml new file mode 100644 index 0000000..ade7121 --- /dev/null +++ b/configs/vsha2cl.vv.toml @@ -0,0 +1,19 @@ +name = "vsha2cl.vv" +format = "vd,vs2,vs1" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsha2ms.vv.toml b/configs/vsha2ms.vv.toml new file mode 100644 index 0000000..d5ac3a4 --- /dev/null +++ b/configs/vsha2ms.vv.toml @@ -0,0 +1,19 @@ +name = "vsha2ms.vv" +format = "vd,vs2,vs1" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsm3c.vi.toml b/configs/vsm3c.vi.toml new file mode 100644 index 0000000..31b4064 --- /dev/null +++ b/configs/vsm3c.vi.toml @@ -0,0 +1,19 @@ +name = "vsm3c.vi" +format = "vd,vs2,uimm" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsm3me.vv.toml b/configs/vsm3me.vv.toml new file mode 100644 index 0000000..ac2899a --- /dev/null +++ b/configs/vsm3me.vv.toml @@ -0,0 +1,19 @@ +name = "vsm3me.vv" +format = "vd,vs2,vs1" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsm4k.vi.toml b/configs/vsm4k.vi.toml new file mode 100644 index 0000000..26dc46f --- /dev/null +++ b/configs/vsm4k.vi.toml @@ -0,0 +1,19 @@ +name = "vsm4k.vi" +format = "vd,vs2,uimm" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsm4r.vs.toml b/configs/vsm4r.vs.toml new file mode 100644 index 0000000..1754aba --- /dev/null +++ b/configs/vsm4r.vs.toml @@ -0,0 +1,19 @@ +name = "vsm4r.vs" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/configs/vsm4r.vv.toml b/configs/vsm4r.vv.toml new file mode 100644 index 0000000..fb2d1a3 --- /dev/null +++ b/configs/vsm4r.vv.toml @@ -0,0 +1,19 @@ +name = "vsm4r.vv" +format = "vd,vs2" + +[tests] +base = [ + [0x0, 0x0], + [0x1, 0x2], + [0x3, 0xf] +] + +sew32 = [ + [0xfffffff8, 0x00000000], + [0xffffff80, 0xfffffff8], + [0x00007fff, 0x00000000], + [0x00007fff, 0x000007ff], + [0x00007fff, 0x00000001], + [0xffffffff, 0x00000000], + [0xffffffff, 0xffffffff] +] diff --git a/generator/insn.go b/generator/insn.go index dccaf6d..51af6cd 100644 --- a/generator/insn.go +++ b/generator/insn.go @@ -83,6 +83,7 @@ const ( insnFormatVdVs2Imm insnFormat = "vd,vs2,imm" insnFormatVdVs2ImmV0 insnFormat = "vd,vs2,imm,v0" insnFormatVdVs2ImmVm insnFormat = "vd,vs2,imm,vm" + insnFormatVdVs2Uimm insnFormat = "vd,vs2,uimm" insnFormatVdVs2UimmVm insnFormat = "vd,vs2,uimm,vm" insnFormatVdVs1Vs2Vm insnFormat = "vd,vs1,vs2,vm" insnFormatVdRs1Vs2Vm insnFormat = "vd,rs1,vs2,vm" @@ -124,6 +125,7 @@ var formats = map[insnFormat]struct{}{ insnFormatVdVs2Imm: {}, insnFormatVdVs2ImmV0: {}, insnFormatVdVs2ImmVm: {}, + insnFormatVdVs2Uimm: {}, insnFormatVdVs2UimmVm: {}, insnFormatVdVs1Vs2Vm: {}, insnFormatVdRs1Vs2Vm: {}, @@ -189,6 +191,8 @@ func (i *Insn) genCodeCombinations(pos int) []string { return i.genCodeVdVs2ImmV0(pos) case insnFormatVdVs2ImmVm: return i.genCodeVdVs2ImmVm(pos) + case insnFormatVdVs2Uimm: + return i.genCodeVdVs2Uimm(pos) case insnFormatVdVs2UimmVm: return i.genCodeVdVs2UimmVm(pos) case insnFormatVdFs1Vs2Vm: diff --git a/generator/insn_vdvs2.go b/generator/insn_vdvs2.go index b3da463..398115d 100644 --- a/generator/insn_vdvs2.go +++ b/generator/insn_vdvs2.go @@ -9,8 +9,8 @@ import ( ) func (i *Insn) genCodeVdVs2(pos int) []string { - zvkg_insn := strings.HasPrefix(i.Name, "vg") - sews := iff(zvkg_insn, []SEW{32}, allSEWs) + sew32OnlyInsn := strings.HasPrefix(i.Name, "vg") || strings.HasPrefix(i.Name, "vsm4") + sews := iff(sew32OnlyInsn, []SEW{32}, allSEWs) var nr int var err error @@ -26,7 +26,7 @@ func (i *Insn) genCodeVdVs2(pos int) []string { res := make([]string, 0, len(combinations)) for _, c := range combinations[pos:] { - if zvkg_insn && c.Vl % 4 != 0 { + if sew32OnlyInsn && c.Vl % 4 != 0 { c.Vl = (c.Vl + 3) / 4 * 4 } @@ -34,7 +34,7 @@ func (i *Insn) genCodeVdVs2(pos int) []string { builder.WriteString(c.initialize()) var vd, vs2 int - if (zvkg_insn){ + if (sew32OnlyInsn){ vd = int(c.LMUL1) vs2 = 3 * int(c.LMUL1) }else{ diff --git a/generator/insn_vdvs2uimm.go b/generator/insn_vdvs2uimm.go new file mode 100644 index 0000000..716ea19 --- /dev/null +++ b/generator/insn_vdvs2uimm.go @@ -0,0 +1,84 @@ +package generator + +import ( + "fmt" + "math" + "strings" +) + +func (i *Insn) genCodeVdVs2Uimm(pos int) []string { + vsm3Insn := strings.HasPrefix(i.Name, "vsm3") + sew32OnlyInsn := strings.HasPrefix(i.Name, "vaes") || strings.HasPrefix(i.Name, "vsm4") + sews := iff(sew32OnlyInsn || vsm3Insn, []SEW{32}, allSEWs) + vs2Size := 1 + vdSize := 1 + + combinations := i.combinations( + iff(vsm3Insn, []LMUL {1, 2, 4, 8}, allLMULs), + sews, + []bool{false, true}, + i.vxrms(), + ) + res := make([]string, 0, len(combinations)) + + for _, c := range combinations[pos:] { + if sew32OnlyInsn && c.Vl % 4 != 0 { + c.Vl = (c.Vl + 3) &^ 3 + } + if vsm3Insn { + c.Vl = (c.Vl + 7) &^ 7 + } + builder := strings.Builder{} + builder.WriteString(c.initialize()) + + builder.WriteString(i.gWriteRandomData(LMUL(1))) + builder.WriteString(i.gLoadDataIntoRegisterGroup(0, LMUL(1), SEW(32))) + + vdEMUL1 := LMUL(math.Max(float64(int(c.LMUL)*vdSize), 1)) + vs2EMUL1 := LMUL(math.Max(float64(int(c.LMUL)*vs2Size), 1)) + vdEEW := c.SEW * SEW(vdSize) + vs2EEW := c.SEW * SEW(vs2Size) + if vdEEW > SEW(i.Option.XLEN) || vs2EEW > SEW(i.Option.XLEN) { + res = append(res, "") + continue + } + + vd := int(vdEMUL1) + vs2 := vd * 2 + + builder.WriteString(i.gWriteRandomData(c.LMUL1)) + builder.WriteString(i.gLoadDataIntoRegisterGroup(vd, c.LMUL1, SEW(8))) + + builder.WriteString(i.gWriteIntegerTestData(vs2EMUL1, vs2EEW, 1)) + builder.WriteString(i.gLoadDataIntoRegisterGroup(vs2, vs2EMUL1, vs2EEW)) + + cases := i.integerTestCases(c.SEW) + for a := 0; a < len(cases); a++ { + builder.WriteString("# -------------- TEST BEGIN --------------\n") + builder.WriteString(i.gVsetvli(c.Vl, c.SEW, c.LMUL)) + switch c.SEW { + case 8: + builder.WriteString(fmt.Sprintf("%s v%d, v%d, %d\n", + i.Name, vd, vs2, convNum[uint8](cases[a][0]) % 32)) + case 16: + builder.WriteString(fmt.Sprintf("%s v%d, v%d, %d\n", + i.Name, vd, vs2, convNum[uint16](cases[a][0]) % 32)) + case 32: + builder.WriteString(fmt.Sprintf("%s v%d, v%d, %d\n", + i.Name, vd, vs2, convNum[uint32](cases[a][0]) % 32)) + case 64: + builder.WriteString(fmt.Sprintf("%s v%d, v%d, %d\n", + i.Name, vd, vs2, convNum[uint64](cases[a][0]) % 32)) + } + builder.WriteString("# -------------- TEST END --------------\n") + + builder.WriteString(i.gResultDataAddr()) + builder.WriteString(i.gStoreRegisterGroupIntoResultData(vd, c.LMUL1, c.SEW)) + builder.WriteString(i.gMagicInsn(vd, c.LMUL1)) + } + + res = append(res, builder.String()) + } + + return res +} diff --git a/generator/insn_vdvs2vs1.go b/generator/insn_vdvs2vs1.go index 0ba8be6..5d08106 100644 --- a/generator/insn_vdvs2vs1.go +++ b/generator/insn_vdvs2vs1.go @@ -6,18 +6,22 @@ import ( ) func (i *Insn) genCodeVdVs2Vs1(pos int) []string { - zvkg_insn := strings.HasPrefix(i.Name, "vg") - sews := iff(zvkg_insn, []SEW{32}, allSEWs) + vsm3Insn := strings.HasPrefix(i.Name, "vsm3") + sew32OnlyInsn := strings.HasPrefix(i.Name, "vg") || strings.HasPrefix(i.Name, "vsha") + sews := iff(sew32OnlyInsn || vsm3Insn, []SEW{32}, allSEWs) combinations := i.combinations( - allLMULs, + iff(vsm3Insn, []LMUL {1, 2, 4, 8}, allLMULs), sews, []bool{false}, i.vxrms(), ) res := make([]string, 0, len(combinations)) for _, c := range combinations[pos:] { - if zvkg_insn && c.Vl % 4 != 0 { - c.Vl = (c.Vl + 3) / 4 * 4 + if sew32OnlyInsn && c.Vl % 4 != 0 { + c.Vl = (c.Vl + 3) &^ 3 + } + if vsm3Insn { + c.Vl = (c.Vl + 7) &^ 7 } builder := strings.Builder{} builder.WriteString(c.initialize())