1
The following changes since commit c95bd5ff1660883d15ad6e0005e4c8571604f51a:
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
Merge remote-tracking branch 'remotes/philmd/tags/mips-fixes-20210322' into staging (2021-03-22 14:26:13 +0000)
3
The following changes since commit 9cc1bf1ebca550f8d90f967ccd2b6d2e00e81387:
4
5
Merge tag 'pull-xen-20220609' of https://xenbits.xen.org/git-http/people/aperard/qemu-dm into staging (2022-06-09 08:25:17 -0700)
4
6
5
are available in the Git repository at:
7
are available in the Git repository at:
6
8
7
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20210322-2
9
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20220610
8
10
9
for you to fetch changes up to 9a27f69bd668d9d71674407badc412ce1231c7d5:
11
for you to fetch changes up to 07314158f6aa4d2589520c194a7531b9364a8d54:
10
12
11
target/riscv: Prevent lost illegal instruction exceptions (2021-03-22 21:54:40 -0400)
13
target/riscv: trans_rvv: Avoid assert for RV32 and e64 (2022-06-10 09:42:12 +1000)
12
14
13
----------------------------------------------------------------
15
----------------------------------------------------------------
14
RISC-V PR for 6.0
16
Fourth RISC-V PR for QEMU 7.1
15
17
16
This PR includes:
18
* Update MAINTAINERS
17
- Fix for vector CSR access
19
* Add support for Zmmul extension
18
- Improvements to the Ibex UART device
20
* Fixup FDT errors when supplying device tree from the command line for virt machine
19
- PMP improvements and bug fixes
21
* Avoid overflowing the addr_config buffer in the SiFive PLIC
20
- Hypervisor extension bug fixes
22
* Support -device loader addresses above 2GB
21
- ramfb support for the virt machine
23
* Correctly wake from WFI on VS-level external interrupts
22
- Fast read support for SST flash
24
* Fixes for RV128 support
23
- Improvements to the microchip_pfsoc machine
25
* Support Vector extension tail agnostic setting elements' bits to all 1s
26
* Don't expose the CPU properties on named CPUs
27
* Fix vector extension assert for RV32
24
28
25
----------------------------------------------------------------
29
----------------------------------------------------------------
26
Alexander Wagner (1):
30
Alistair Francis (4):
27
hw/char: disable ibex uart receive if the buffer is full
31
MAINTAINERS: Cover hw/core/uboot_image.h within Generic Loader section
32
hw/intc: sifive_plic: Avoid overflowing the addr_config buffer
33
target/riscv: Don't expose the CPU properties on names CPUs
34
target/riscv: trans_rvv: Avoid assert for RV32 and e64
28
35
29
Asherah Connor (2):
36
Andrew Bresticker (1):
30
hw/riscv: Add fw_cfg support to virt
37
target/riscv: Wake on VS-level external interrupts
31
hw/riscv: allow ramfb on virt
32
38
33
Bin Meng (3):
39
Atish Patra (1):
34
hw/block: m25p80: Support fast read for SST flashes
40
hw/riscv: virt: Generate fw_cfg DT node correctly
35
hw/riscv: microchip_pfsoc: Map EMMC/SD mux register
36
docs/system: riscv: Add documentation for 'microchip-icicle-kit' machine
37
41
38
Frank Chang (1):
42
Frédéric Pétrot (1):
39
target/riscv: fix vs() to return proper error code
43
target/riscv/debug.c: keep experimental rv128 support working
40
44
41
Georg Kotheimer (6):
45
Jamie Iles (1):
42
target/riscv: Adjust privilege level for HLV(X)/HSV instructions
46
hw/core/loader: return image sizes as ssize_t
43
target/riscv: Make VSTIP and VSEIP read-only in hip
44
target/riscv: Use background registers also for MSTATUS_MPV
45
target/riscv: Fix read and write accesses to vsip and vsie
46
target/riscv: Add proper two-stage lookup exception detection
47
target/riscv: Prevent lost illegal instruction exceptions
48
47
49
Jim Shu (3):
48
Weiwei Li (1):
50
target/riscv: propagate PMP permission to TLB page
49
target/riscv: add support for zmmul extension v0.1
51
target/riscv: add log of PMP permission checking
52
target/riscv: flush TLB pages if PMP permission has been changed
53
50
54
docs/system/riscv/microchip-icicle-kit.rst | 89 ++++++++++++++
51
eopXD (16):
55
docs/system/target-riscv.rst | 1 +
52
target/riscv: rvv: Prune redundant ESZ, DSZ parameter passed
56
include/hw/char/ibex_uart.h | 4 +
53
target/riscv: rvv: Prune redundant access_type parameter passed
57
include/hw/riscv/microchip_pfsoc.h | 1 +
54
target/riscv: rvv: Rename ambiguous esz
58
include/hw/riscv/virt.h | 2 +
55
target/riscv: rvv: Early exit when vstart >= vl
59
target/riscv/cpu.h | 4 +
56
target/riscv: rvv: Add tail agnostic for vv instructions
60
target/riscv/pmp.h | 4 +-
57
target/riscv: rvv: Add tail agnostic for vector load / store instructions
61
hw/block/m25p80.c | 3 +
58
target/riscv: rvv: Add tail agnostic for vx, vvm, vxm instructions
62
hw/char/ibex_uart.c | 23 +++-
59
target/riscv: rvv: Add tail agnostic for vector integer shift instructions
63
hw/riscv/microchip_pfsoc.c | 6 +
60
target/riscv: rvv: Add tail agnostic for vector integer comparison instructions
64
hw/riscv/virt.c | 33 ++++++
61
target/riscv: rvv: Add tail agnostic for vector integer merge and move instructions
65
target/riscv/cpu.c | 1 +
62
target/riscv: rvv: Add tail agnostic for vector fix-point arithmetic instructions
66
target/riscv/cpu_helper.c | 144 +++++++++++++++--------
63
target/riscv: rvv: Add tail agnostic for vector floating-point instructions
67
target/riscv/csr.c | 77 +++++++------
64
target/riscv: rvv: Add tail agnostic for vector reduction instructions
68
target/riscv/pmp.c | 84 ++++++++++----
65
target/riscv: rvv: Add tail agnostic for vector mask instructions
69
target/riscv/translate.c | 179 +----------------------------
66
target/riscv: rvv: Add tail agnostic for vector permutation instructions
70
hw/riscv/Kconfig | 1 +
67
target/riscv: rvv: Add option 'rvv_ta_all_1s' to enable optional tail agnostic behavior
71
17 files changed, 367 insertions(+), 289 deletions(-)
72
create mode 100644 docs/system/riscv/microchip-icicle-kit.rst
73
68
69
include/hw/loader.h | 55 +-
70
target/riscv/cpu.h | 4 +
71
target/riscv/internals.h | 6 +-
72
hw/arm/armv7m.c | 2 +-
73
hw/arm/boot.c | 8 +-
74
hw/core/generic-loader.c | 2 +-
75
hw/core/loader.c | 81 +-
76
hw/i386/x86.c | 2 +-
77
hw/intc/sifive_plic.c | 19 +-
78
hw/riscv/boot.c | 5 +-
79
hw/riscv/virt.c | 28 +-
80
target/riscv/cpu.c | 68 +-
81
target/riscv/cpu_helper.c | 4 +-
82
target/riscv/debug.c | 2 +
83
target/riscv/translate.c | 4 +
84
target/riscv/vector_helper.c | 1588 +++++++++++++++++++------------
85
target/riscv/insn_trans/trans_rvm.c.inc | 18 +-
86
target/riscv/insn_trans/trans_rvv.c.inc | 106 ++-
87
MAINTAINERS | 1 +
88
19 files changed, 1244 insertions(+), 759 deletions(-)
diff view generated by jsdifflib
New patch
1
From: Alistair Francis <alistair.francis@wdc.com>
1
2
3
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Message-Id: <20220509091339.26016-1-alistair.francis@wdc.com>
6
---
7
MAINTAINERS | 1 +
8
1 file changed, 1 insertion(+)
9
10
diff --git a/MAINTAINERS b/MAINTAINERS
11
index XXXXXXX..XXXXXXX 100644
12
--- a/MAINTAINERS
13
+++ b/MAINTAINERS
14
@@ -XXX,XX +XXX,XX @@ Generic Loader
15
M: Alistair Francis <alistair@alistair23.me>
16
S: Maintained
17
F: hw/core/generic-loader.c
18
+F: hw/core/uboot_image.h
19
F: include/hw/core/generic-loader.h
20
F: docs/system/generic-loader.rst
21
22
--
23
2.36.1
diff view generated by jsdifflib
New patch
1
From: Weiwei Li <liweiwei@iscas.ac.cn>
1
2
3
Add support for the zmmul extension v0.1. This extension includes all
4
multiplication operations from the M extension but not the divide ops.
5
6
Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
7
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
8
Reviewed-by: Víctor Colombo <victor.colombo@eldorado.org.br>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-Id: <20220531030732.3850-1-liweiwei@iscas.ac.cn>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
target/riscv/cpu.h | 1 +
14
target/riscv/cpu.c | 7 +++++++
15
target/riscv/insn_trans/trans_rvm.c.inc | 18 ++++++++++++------
16
3 files changed, 20 insertions(+), 6 deletions(-)
17
18
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/riscv/cpu.h
21
+++ b/target/riscv/cpu.h
22
@@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig {
23
bool ext_zhinxmin;
24
bool ext_zve32f;
25
bool ext_zve64f;
26
+ bool ext_zmmul;
27
28
uint32_t mvendorid;
29
uint64_t marchid;
30
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/riscv/cpu.c
33
+++ b/target/riscv/cpu.c
34
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
35
cpu->cfg.ext_ifencei = true;
36
}
37
38
+ if (cpu->cfg.ext_m && cpu->cfg.ext_zmmul) {
39
+ warn_report("Zmmul will override M");
40
+ cpu->cfg.ext_m = false;
41
+ }
42
+
43
if (cpu->cfg.ext_i && cpu->cfg.ext_e) {
44
error_setg(errp,
45
"I and E extensions are incompatible");
46
@@ -XXX,XX +XXX,XX @@ static Property riscv_cpu_properties[] = {
47
48
/* These are experimental so mark with 'x-' */
49
DEFINE_PROP_BOOL("x-j", RISCVCPU, cfg.ext_j, false),
50
+ DEFINE_PROP_BOOL("x-zmmul", RISCVCPU, cfg.ext_zmmul, false),
51
/* ePMP 0.9.3 */
52
DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false),
53
DEFINE_PROP_BOOL("x-aia", RISCVCPU, cfg.aia, false),
54
@@ -XXX,XX +XXX,XX @@ static void riscv_isa_string_ext(RISCVCPU *cpu, char **isa_str, int max_str_len)
55
struct isa_ext_data isa_edata_arr[] = {
56
ISA_EDATA_ENTRY(zicsr, ext_icsr),
57
ISA_EDATA_ENTRY(zifencei, ext_ifencei),
58
+ ISA_EDATA_ENTRY(zmmul, ext_zmmul),
59
ISA_EDATA_ENTRY(zfh, ext_zfh),
60
ISA_EDATA_ENTRY(zfhmin, ext_zfhmin),
61
ISA_EDATA_ENTRY(zfinx, ext_zfinx),
62
diff --git a/target/riscv/insn_trans/trans_rvm.c.inc b/target/riscv/insn_trans/trans_rvm.c.inc
63
index XXXXXXX..XXXXXXX 100644
64
--- a/target/riscv/insn_trans/trans_rvm.c.inc
65
+++ b/target/riscv/insn_trans/trans_rvm.c.inc
66
@@ -XXX,XX +XXX,XX @@
67
* this program. If not, see <http://www.gnu.org/licenses/>.
68
*/
69
70
+#define REQUIRE_M_OR_ZMMUL(ctx) do { \
71
+ if (!ctx->cfg_ptr->ext_zmmul && !has_ext(ctx, RVM)) { \
72
+ return false; \
73
+ } \
74
+} while (0)
75
+
76
static void gen_mulhu_i128(TCGv r2, TCGv r3, TCGv al, TCGv ah, TCGv bl, TCGv bh)
77
{
78
TCGv tmpl = tcg_temp_new();
79
@@ -XXX,XX +XXX,XX @@ static void gen_mul_i128(TCGv rl, TCGv rh,
80
81
static bool trans_mul(DisasContext *ctx, arg_mul *a)
82
{
83
- REQUIRE_EXT(ctx, RVM);
84
+ REQUIRE_M_OR_ZMMUL(ctx);
85
return gen_arith(ctx, a, EXT_NONE, tcg_gen_mul_tl, gen_mul_i128);
86
}
87
88
@@ -XXX,XX +XXX,XX @@ static void gen_mulh_w(TCGv ret, TCGv s1, TCGv s2)
89
90
static bool trans_mulh(DisasContext *ctx, arg_mulh *a)
91
{
92
- REQUIRE_EXT(ctx, RVM);
93
+ REQUIRE_M_OR_ZMMUL(ctx);
94
return gen_arith_per_ol(ctx, a, EXT_SIGN, gen_mulh, gen_mulh_w,
95
gen_mulh_i128);
96
}
97
@@ -XXX,XX +XXX,XX @@ static void gen_mulhsu_w(TCGv ret, TCGv arg1, TCGv arg2)
98
99
static bool trans_mulhsu(DisasContext *ctx, arg_mulhsu *a)
100
{
101
- REQUIRE_EXT(ctx, RVM);
102
+ REQUIRE_M_OR_ZMMUL(ctx);
103
return gen_arith_per_ol(ctx, a, EXT_NONE, gen_mulhsu, gen_mulhsu_w,
104
gen_mulhsu_i128);
105
}
106
@@ -XXX,XX +XXX,XX @@ static void gen_mulhu(TCGv ret, TCGv s1, TCGv s2)
107
108
static bool trans_mulhu(DisasContext *ctx, arg_mulhu *a)
109
{
110
- REQUIRE_EXT(ctx, RVM);
111
+ REQUIRE_M_OR_ZMMUL(ctx);
112
/* gen_mulh_w works for either sign as input. */
113
return gen_arith_per_ol(ctx, a, EXT_ZERO, gen_mulhu, gen_mulh_w,
114
gen_mulhu_i128);
115
@@ -XXX,XX +XXX,XX @@ static bool trans_remu(DisasContext *ctx, arg_remu *a)
116
static bool trans_mulw(DisasContext *ctx, arg_mulw *a)
117
{
118
REQUIRE_64_OR_128BIT(ctx);
119
- REQUIRE_EXT(ctx, RVM);
120
+ REQUIRE_M_OR_ZMMUL(ctx);
121
ctx->ol = MXL_RV32;
122
return gen_arith(ctx, a, EXT_NONE, tcg_gen_mul_tl, NULL);
123
}
124
@@ -XXX,XX +XXX,XX @@ static bool trans_remuw(DisasContext *ctx, arg_remuw *a)
125
static bool trans_muld(DisasContext *ctx, arg_muld *a)
126
{
127
REQUIRE_128BIT(ctx);
128
- REQUIRE_EXT(ctx, RVM);
129
+ REQUIRE_M_OR_ZMMUL(ctx);
130
ctx->ol = MXL_RV64;
131
return gen_arith(ctx, a, EXT_SIGN, tcg_gen_mul_tl, NULL);
132
}
133
--
134
2.36.1
diff view generated by jsdifflib
1
From: Asherah Connor <ashe@kivikakk.ee>
1
From: Atish Patra <atishp@rivosinc.com>
2
2
3
Provides fw_cfg for the virt machine on riscv. This enables
3
fw_cfg DT node is generated after the create_fdt without any check
4
using e.g. ramfb later.
4
if the DT is being loaded from the commandline. This results in
5
FDT_ERR_EXISTS error if dtb is loaded from the commandline.
5
6
6
Signed-off-by: Asherah Connor <ashe@kivikakk.ee>
7
Generate fw_cfg node only if the DT is not loaded from the commandline.
7
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8
9
Signed-off-by: Atish Patra <atishp@rivosinc.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20210318235041.17175-2-ashe@kivikakk.ee
11
Message-Id: <20220526203500.847165-1-atishp@rivosinc.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
13
---
12
include/hw/riscv/virt.h | 2 ++
14
hw/riscv/virt.c | 28 ++++++++++++++++++----------
13
hw/riscv/virt.c | 30 ++++++++++++++++++++++++++++++
15
1 file changed, 18 insertions(+), 10 deletions(-)
14
hw/riscv/Kconfig | 1 +
15
3 files changed, 33 insertions(+)
16
16
17
diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/riscv/virt.h
20
+++ b/include/hw/riscv/virt.h
21
@@ -XXX,XX +XXX,XX @@ struct RISCVVirtState {
22
RISCVHartArrayState soc[VIRT_SOCKETS_MAX];
23
DeviceState *plic[VIRT_SOCKETS_MAX];
24
PFlashCFI01 *flash[2];
25
+ FWCfgState *fw_cfg;
26
27
int fdt_size;
28
};
29
@@ -XXX,XX +XXX,XX @@ enum {
30
VIRT_PLIC,
31
VIRT_UART0,
32
VIRT_VIRTIO,
33
+ VIRT_FW_CFG,
34
VIRT_FLASH,
35
VIRT_DRAM,
36
VIRT_PCIE_MMIO,
37
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
17
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
38
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/riscv/virt.c
19
--- a/hw/riscv/virt.c
40
+++ b/hw/riscv/virt.c
20
+++ b/hw/riscv/virt.c
41
@@ -XXX,XX +XXX,XX @@ static const MemMapEntry virt_memmap[] = {
21
@@ -XXX,XX +XXX,XX @@ static void create_fdt_flash(RISCVVirtState *s, const MemMapEntry *memmap)
42
[VIRT_PLIC] = { 0xc000000, VIRT_PLIC_SIZE(VIRT_CPUS_MAX * 2) },
22
g_free(name);
43
[VIRT_UART0] = { 0x10000000, 0x100 },
44
[VIRT_VIRTIO] = { 0x10001000, 0x1000 },
45
+ [VIRT_FW_CFG] = { 0x10100000, 0x18 },
46
[VIRT_FLASH] = { 0x20000000, 0x4000000 },
47
[VIRT_PCIE_ECAM] = { 0x30000000, 0x10000000 },
48
[VIRT_PCIE_MMIO] = { 0x40000000, 0x40000000 },
49
@@ -XXX,XX +XXX,XX @@ static inline DeviceState *gpex_pcie_init(MemoryRegion *sys_mem,
50
return dev;
51
}
23
}
52
24
53
+static FWCfgState *create_fw_cfg(const MachineState *mc)
25
+static void create_fdt_fw_cfg(RISCVVirtState *s, const MemMapEntry *memmap)
54
+{
26
+{
55
+ hwaddr base = virt_memmap[VIRT_FW_CFG].base;
56
+ hwaddr size = virt_memmap[VIRT_FW_CFG].size;
57
+ FWCfgState *fw_cfg;
58
+ char *nodename;
27
+ char *nodename;
59
+
28
+ MachineState *mc = MACHINE(s);
60
+ fw_cfg = fw_cfg_init_mem_wide(base + 8, base, 8, base + 16,
29
+ hwaddr base = memmap[VIRT_FW_CFG].base;
61
+ &address_space_memory);
30
+ hwaddr size = memmap[VIRT_FW_CFG].size;
62
+ fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)mc->smp.cpus);
63
+
31
+
64
+ nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base);
32
+ nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base);
65
+ qemu_fdt_add_subnode(mc->fdt, nodename);
33
+ qemu_fdt_add_subnode(mc->fdt, nodename);
66
+ qemu_fdt_setprop_string(mc->fdt, nodename,
34
+ qemu_fdt_setprop_string(mc->fdt, nodename,
67
+ "compatible", "qemu,fw-cfg-mmio");
35
+ "compatible", "qemu,fw-cfg-mmio");
68
+ qemu_fdt_setprop_sized_cells(mc->fdt, nodename, "reg",
36
+ qemu_fdt_setprop_sized_cells(mc->fdt, nodename, "reg",
69
+ 2, base, 2, size);
37
+ 2, base, 2, size);
70
+ qemu_fdt_setprop(mc->fdt, nodename, "dma-coherent", NULL, 0);
38
+ qemu_fdt_setprop(mc->fdt, nodename, "dma-coherent", NULL, 0);
71
+ g_free(nodename);
39
+ g_free(nodename);
72
+ return fw_cfg;
73
+}
40
+}
74
+
41
+
75
static void virt_machine_init(MachineState *machine)
42
static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
43
uint64_t mem_size, const char *cmdline, bool is_32_bit)
76
{
44
{
77
const MemMapEntry *memmap = virt_memmap;
45
@@ -XXX,XX +XXX,XX @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
78
@@ -XXX,XX +XXX,XX @@ static void virt_machine_init(MachineState *machine)
46
create_fdt_rtc(s, memmap, irq_mmio_phandle);
79
start_addr = virt_memmap[VIRT_FLASH].base;
47
80
}
48
create_fdt_flash(s, memmap);
81
49
+ create_fdt_fw_cfg(s, memmap);
82
+ /*
50
83
+ * Init fw_cfg. Must be done before riscv_load_fdt, otherwise the device
51
update_bootargs:
84
+ * tree cannot be altered and we get FDT_ERR_NOSPACE.
52
if (cmdline && *cmdline) {
85
+ */
53
@@ -XXX,XX +XXX,XX @@ static inline DeviceState *gpex_pcie_init(MemoryRegion *sys_mem,
86
+ s->fw_cfg = create_fw_cfg(machine);
54
static FWCfgState *create_fw_cfg(const MachineState *mc)
87
+ rom_set_fw(s->fw_cfg);
55
{
88
+
56
hwaddr base = virt_memmap[VIRT_FW_CFG].base;
89
/* Compute the fdt load address in dram */
57
- hwaddr size = virt_memmap[VIRT_FW_CFG].size;
90
fdt_load_addr = riscv_load_fdt(memmap[VIRT_DRAM].base,
58
FWCfgState *fw_cfg;
91
machine->ram_size, machine->fdt);
59
- char *nodename;
92
diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
60
93
index XXXXXXX..XXXXXXX 100644
61
fw_cfg = fw_cfg_init_mem_wide(base + 8, base, 8, base + 16,
94
--- a/hw/riscv/Kconfig
62
&address_space_memory);
95
+++ b/hw/riscv/Kconfig
63
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)mc->smp.cpus);
96
@@ -XXX,XX +XXX,XX @@ config RISCV_VIRT
64
97
select SIFIVE_PLIC
65
- nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base);
98
select SIFIVE_TEST
66
- qemu_fdt_add_subnode(mc->fdt, nodename);
99
select VIRTIO_MMIO
67
- qemu_fdt_setprop_string(mc->fdt, nodename,
100
+ select FW_CFG_DMA
68
- "compatible", "qemu,fw-cfg-mmio");
101
69
- qemu_fdt_setprop_sized_cells(mc->fdt, nodename, "reg",
102
config SIFIVE_E
70
- 2, base, 2, size);
103
bool
71
- qemu_fdt_setprop(mc->fdt, nodename, "dma-coherent", NULL, 0);
72
- g_free(nodename);
73
return fw_cfg;
74
}
75
104
--
76
--
105
2.30.1
77
2.36.1
106
107
diff view generated by jsdifflib
New patch
1
From: Alistair Francis <alistair.francis@wdc.com>
1
2
3
Since commit ad40be27 "target/riscv: Support start kernel directly by
4
KVM" we have been overflowing the addr_config on "M,MS..."
5
configurations, as reported https://gitlab.com/qemu-project/qemu/-/issues/1050.
6
7
This commit changes the loop in sifive_plic_create() from iterating over
8
the number of harts to just iterating over the addr_config. The
9
addr_config is based on the hart_config, and will contain interrup details
10
for all harts. This way we can't iterate past the end of addr_config.
11
12
Fixes: ad40be27084536 ("target/riscv: Support start kernel directly by KVM")
13
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1050
14
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
Reviewed-by: Mingwang Li <limingwang@huawei.com>
16
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Message-Id: <20220601013631.196854-1-alistair.francis@opensource.wdc.com>
18
---
19
hw/intc/sifive_plic.c | 19 +++++++++----------
20
1 file changed, 9 insertions(+), 10 deletions(-)
21
22
diff --git a/hw/intc/sifive_plic.c b/hw/intc/sifive_plic.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/intc/sifive_plic.c
25
+++ b/hw/intc/sifive_plic.c
26
@@ -XXX,XX +XXX,XX @@ DeviceState *sifive_plic_create(hwaddr addr, char *hart_config,
27
uint32_t context_stride, uint32_t aperture_size)
28
{
29
DeviceState *dev = qdev_new(TYPE_SIFIVE_PLIC);
30
- int i, j = 0;
31
+ int i;
32
SiFivePLICState *plic;
33
34
assert(enable_stride == (enable_stride & -enable_stride));
35
@@ -XXX,XX +XXX,XX @@ DeviceState *sifive_plic_create(hwaddr addr, char *hart_config,
36
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
37
38
plic = SIFIVE_PLIC(dev);
39
- for (i = 0; i < num_harts; i++) {
40
- CPUState *cpu = qemu_get_cpu(hartid_base + i);
41
42
- if (plic->addr_config[j].mode == PLICMode_M) {
43
- j++;
44
- qdev_connect_gpio_out(dev, num_harts + i,
45
+ for (i = 0; i < plic->num_addrs; i++) {
46
+ int cpu_num = plic->addr_config[i].hartid;
47
+ CPUState *cpu = qemu_get_cpu(hartid_base + cpu_num);
48
+
49
+ if (plic->addr_config[i].mode == PLICMode_M) {
50
+ qdev_connect_gpio_out(dev, num_harts + cpu_num,
51
qdev_get_gpio_in(DEVICE(cpu), IRQ_M_EXT));
52
}
53
-
54
- if (plic->addr_config[j].mode == PLICMode_S) {
55
- j++;
56
- qdev_connect_gpio_out(dev, i,
57
+ if (plic->addr_config[i].mode == PLICMode_S) {
58
+ qdev_connect_gpio_out(dev, cpu_num,
59
qdev_get_gpio_in(DEVICE(cpu), IRQ_S_EXT));
60
}
61
}
62
--
63
2.36.1
diff view generated by jsdifflib
1
From: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
1
From: Jamie Iles <jamie@nuviainc.com>
2
2
3
Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
3
Various loader functions return an int which limits images to 2GB which
4
is fine for things like a BIOS/kernel image, but if we want to be able
5
to load memory images or large ramdisks then any file over 2GB would
6
silently fail to load.
7
8
Cc: Luc Michel <lmichel@kalray.eu>
9
Signed-off-by: Jamie Iles <jamie@nuviainc.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Reviewed-by: Luc Michel <lmichel@kalray.eu>
4
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
5
Message-id: 20210311094902.1377593-1-georg.kotheimer@kernkonzept.com
13
Message-Id: <20211111141141.3295094-2-jamie@nuviainc.com>
6
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
14
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
7
---
15
---
8
target/riscv/csr.c | 7 ++++---
16
include/hw/loader.h | 55 +++++++++++++--------------
9
1 file changed, 4 insertions(+), 3 deletions(-)
17
hw/arm/armv7m.c | 2 +-
18
hw/arm/boot.c | 8 ++--
19
hw/core/generic-loader.c | 2 +-
20
hw/core/loader.c | 81 +++++++++++++++++++++-------------------
21
hw/i386/x86.c | 2 +-
22
hw/riscv/boot.c | 5 ++-
23
7 files changed, 80 insertions(+), 75 deletions(-)
10
24
11
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
25
diff --git a/include/hw/loader.h b/include/hw/loader.h
12
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
13
--- a/target/riscv/csr.c
27
--- a/include/hw/loader.h
14
+++ b/target/riscv/csr.c
28
+++ b/include/hw/loader.h
15
@@ -XXX,XX +XXX,XX @@ static const target_ulong sstatus_v1_10_mask = SSTATUS_SIE | SSTATUS_SPIE |
29
@@ -XXX,XX +XXX,XX @@ ssize_t load_image_size(const char *filename, void *addr, size_t size);
16
SSTATUS_UIE | SSTATUS_UPIE | SSTATUS_SPP | SSTATUS_FS | SSTATUS_XS |
30
*
17
SSTATUS_SUM | SSTATUS_MXR | SSTATUS_SD;
31
* Returns the size of the loaded image on success, -1 otherwise.
18
static const target_ulong sip_writable_mask = SIP_SSIP | MIP_USIP | MIP_UEIP;
32
*/
19
-static const target_ulong hip_writable_mask = MIP_VSSIP | MIP_VSTIP | MIP_VSEIP;
33
-int load_image_targphys_as(const char *filename,
20
+static const target_ulong hip_writable_mask = MIP_VSSIP;
34
- hwaddr addr, uint64_t max_sz, AddressSpace *as);
21
+static const target_ulong hvip_writable_mask = MIP_VSSIP | MIP_VSTIP | MIP_VSEIP;
35
+ssize_t load_image_targphys_as(const char *filename,
22
static const target_ulong vsip_writable_mask = MIP_VSSIP;
36
+ hwaddr addr, uint64_t max_sz, AddressSpace *as);
23
37
24
static const char valid_vm_1_10_32[16] = {
38
/**load_targphys_hex_as:
25
@@ -XXX,XX +XXX,XX @@ static int rmw_hvip(CPURISCVState *env, int csrno, target_ulong *ret_value,
39
* @filename: Path to the .hex file
26
target_ulong new_value, target_ulong write_mask)
40
@@ -XXX,XX +XXX,XX @@ int load_image_targphys_as(const char *filename,
27
{
41
*
28
int ret = rmw_mip(env, 0, ret_value, new_value,
42
* Returns the size of the loaded .hex file on success, -1 otherwise.
29
- write_mask & hip_writable_mask);
43
*/
30
+ write_mask & hvip_writable_mask);
44
-int load_targphys_hex_as(const char *filename, hwaddr *entry, AddressSpace *as);
31
45
+ssize_t load_targphys_hex_as(const char *filename, hwaddr *entry,
32
- *ret_value &= hip_writable_mask;
46
+ AddressSpace *as);
33
+ *ret_value &= hvip_writable_mask;
47
34
48
/** load_image_targphys:
49
* Same as load_image_targphys_as(), but doesn't allow the caller to specify
50
* an AddressSpace.
51
*/
52
-int load_image_targphys(const char *filename, hwaddr,
53
- uint64_t max_sz);
54
+ssize_t load_image_targphys(const char *filename, hwaddr,
55
+ uint64_t max_sz);
56
57
/**
58
* load_image_mr: load an image into a memory region
59
@@ -XXX,XX +XXX,XX @@ int load_image_targphys(const char *filename, hwaddr,
60
* If the file is larger than the memory region's size the call will fail.
61
* Returns -1 on failure, or the size of the file.
62
*/
63
-int load_image_mr(const char *filename, MemoryRegion *mr);
64
+ssize_t load_image_mr(const char *filename, MemoryRegion *mr);
65
66
/* This is the limit on the maximum uncompressed image size that
67
* load_image_gzipped_buffer() and load_image_gzipped() will read. It prevents
68
@@ -XXX,XX +XXX,XX @@ int load_image_mr(const char *filename, MemoryRegion *mr);
69
*/
70
#define LOAD_IMAGE_MAX_GUNZIP_BYTES (256 << 20)
71
72
-int load_image_gzipped_buffer(const char *filename, uint64_t max_sz,
73
- uint8_t **buffer);
74
-int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz);
75
+ssize_t load_image_gzipped_buffer(const char *filename, uint64_t max_sz,
76
+ uint8_t **buffer);
77
+ssize_t load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz);
78
79
#define ELF_LOAD_FAILED -1
80
#define ELF_LOAD_NOT_ELF -2
81
@@ -XXX,XX +XXX,XX @@ ssize_t load_elf(const char *filename,
82
*/
83
void load_elf_hdr(const char *filename, void *hdr, bool *is64, Error **errp);
84
85
-int load_aout(const char *filename, hwaddr addr, int max_sz,
86
- int bswap_needed, hwaddr target_page_size);
87
+ssize_t load_aout(const char *filename, hwaddr addr, int max_sz,
88
+ int bswap_needed, hwaddr target_page_size);
89
90
#define LOAD_UIMAGE_LOADADDR_INVALID (-1)
91
92
@@ -XXX,XX +XXX,XX @@ int load_aout(const char *filename, hwaddr addr, int max_sz,
93
*
94
* Returns the size of the loaded image on success, -1 otherwise.
95
*/
96
-int load_uimage_as(const char *filename, hwaddr *ep,
97
- hwaddr *loadaddr, int *is_linux,
98
- uint64_t (*translate_fn)(void *, uint64_t),
99
- void *translate_opaque, AddressSpace *as);
100
+ssize_t load_uimage_as(const char *filename, hwaddr *ep,
101
+ hwaddr *loadaddr, int *is_linux,
102
+ uint64_t (*translate_fn)(void *, uint64_t),
103
+ void *translate_opaque, AddressSpace *as);
104
105
/** load_uimage:
106
* Same as load_uimage_as(), but doesn't allow the caller to specify an
107
* AddressSpace.
108
*/
109
-int load_uimage(const char *filename, hwaddr *ep,
110
- hwaddr *loadaddr, int *is_linux,
111
- uint64_t (*translate_fn)(void *, uint64_t),
112
- void *translate_opaque);
113
+ssize_t load_uimage(const char *filename, hwaddr *ep,
114
+ hwaddr *loadaddr, int *is_linux,
115
+ uint64_t (*translate_fn)(void *, uint64_t),
116
+ void *translate_opaque);
117
118
/**
119
* load_ramdisk_as:
120
@@ -XXX,XX +XXX,XX @@ int load_uimage(const char *filename, hwaddr *ep,
121
*
122
* Returns the size of the loaded image on success, -1 otherwise.
123
*/
124
-int load_ramdisk_as(const char *filename, hwaddr addr, uint64_t max_sz,
125
- AddressSpace *as);
126
+ssize_t load_ramdisk_as(const char *filename, hwaddr addr, uint64_t max_sz,
127
+ AddressSpace *as);
128
129
/**
130
* load_ramdisk:
131
* Same as load_ramdisk_as(), but doesn't allow the caller to specify
132
* an AddressSpace.
133
*/
134
-int load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz);
135
+ssize_t load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz);
136
137
ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen);
138
139
@@ -XXX,XX +XXX,XX @@ void pstrcpy_targphys(const char *name,
140
extern bool option_rom_has_mr;
141
extern bool rom_file_has_mr;
142
143
-int rom_add_file(const char *file, const char *fw_dir,
144
- hwaddr addr, int32_t bootindex,
145
- bool option_rom, MemoryRegion *mr, AddressSpace *as);
146
+ssize_t rom_add_file(const char *file, const char *fw_dir,
147
+ hwaddr addr, int32_t bootindex,
148
+ bool option_rom, MemoryRegion *mr, AddressSpace *as);
149
MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len,
150
size_t max_len, hwaddr addr,
151
const char *fw_file_name,
152
@@ -XXX,XX +XXX,XX @@ void hmp_info_roms(Monitor *mon, const QDict *qdict);
153
#define rom_add_blob_fixed_as(_f, _b, _l, _a, _as) \
154
rom_add_blob(_f, _b, _l, _l, _a, NULL, NULL, NULL, _as, true)
155
156
-int rom_add_vga(const char *file);
157
-int rom_add_option(const char *file, int32_t bootindex);
158
+ssize_t rom_add_vga(const char *file);
159
+ssize_t rom_add_option(const char *file, int32_t bootindex);
160
161
/* This is the usual maximum in uboot, so if a uImage overflows this, it would
162
* overflow on real hardware too. */
163
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
164
index XXXXXXX..XXXXXXX 100644
165
--- a/hw/arm/armv7m.c
166
+++ b/hw/arm/armv7m.c
167
@@ -XXX,XX +XXX,XX @@ static void armv7m_reset(void *opaque)
168
169
void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size)
170
{
171
- int image_size;
172
+ ssize_t image_size;
173
uint64_t entry;
174
int big_endian;
175
AddressSpace *as;
176
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
177
index XXXXXXX..XXXXXXX 100644
178
--- a/hw/arm/boot.c
179
+++ b/hw/arm/boot.c
180
@@ -XXX,XX +XXX,XX @@ static int do_arm_linux_init(Object *obj, void *opaque)
181
return 0;
182
}
183
184
-static int64_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,
185
+static ssize_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,
186
uint64_t *lowaddr, uint64_t *highaddr,
187
int elf_machine, AddressSpace *as)
188
{
189
@@ -XXX,XX +XXX,XX @@ static int64_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry,
190
} elf_header;
191
int data_swab = 0;
192
bool big_endian;
193
- int64_t ret = -1;
194
+ ssize_t ret = -1;
195
Error *err = NULL;
196
197
198
@@ -XXX,XX +XXX,XX @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
199
/* Set up for a direct boot of a kernel image file. */
200
CPUState *cs;
201
AddressSpace *as = arm_boot_address_space(cpu, info);
202
- int kernel_size;
203
+ ssize_t kernel_size;
204
int initrd_size;
205
int is_linux = 0;
206
uint64_t elf_entry;
207
@@ -XXX,XX +XXX,XX @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
208
209
if (kernel_size > info->ram_size) {
210
error_report("kernel '%s' is too large to fit in RAM "
211
- "(kernel size %d, RAM size %" PRId64 ")",
212
+ "(kernel size %zd, RAM size %" PRId64 ")",
213
info->kernel_filename, kernel_size, info->ram_size);
214
exit(1);
215
}
216
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
217
index XXXXXXX..XXXXXXX 100644
218
--- a/hw/core/generic-loader.c
219
+++ b/hw/core/generic-loader.c
220
@@ -XXX,XX +XXX,XX @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
221
GenericLoaderState *s = GENERIC_LOADER(dev);
222
hwaddr entry;
223
int big_endian;
224
- int size = 0;
225
+ ssize_t size = 0;
226
227
s->set_pc = false;
228
229
diff --git a/hw/core/loader.c b/hw/core/loader.c
230
index XXXXXXX..XXXXXXX 100644
231
--- a/hw/core/loader.c
232
+++ b/hw/core/loader.c
233
@@ -XXX,XX +XXX,XX @@ ssize_t read_targphys(const char *name,
234
return did;
235
}
236
237
-int load_image_targphys(const char *filename,
238
- hwaddr addr, uint64_t max_sz)
239
+ssize_t load_image_targphys(const char *filename,
240
+ hwaddr addr, uint64_t max_sz)
241
{
242
return load_image_targphys_as(filename, addr, max_sz, NULL);
243
}
244
245
/* return the size or -1 if error */
246
-int load_image_targphys_as(const char *filename,
247
- hwaddr addr, uint64_t max_sz, AddressSpace *as)
248
+ssize_t load_image_targphys_as(const char *filename,
249
+ hwaddr addr, uint64_t max_sz, AddressSpace *as)
250
{
251
- int size;
252
+ ssize_t size;
253
254
size = get_image_size(filename);
255
if (size < 0 || size > max_sz) {
256
@@ -XXX,XX +XXX,XX @@ int load_image_targphys_as(const char *filename,
257
return size;
258
}
259
260
-int load_image_mr(const char *filename, MemoryRegion *mr)
261
+ssize_t load_image_mr(const char *filename, MemoryRegion *mr)
262
{
263
- int size;
264
+ ssize_t size;
265
266
if (!memory_access_is_direct(mr, false)) {
267
/* Can only load an image into RAM or ROM */
268
@@ -XXX,XX +XXX,XX @@ static void bswap_ahdr(struct exec *e)
269
: (_N_SEGMENT_ROUND (_N_TXTENDADDR(x, target_page_size), target_page_size)))
270
271
272
-int load_aout(const char *filename, hwaddr addr, int max_sz,
273
- int bswap_needed, hwaddr target_page_size)
274
+ssize_t load_aout(const char *filename, hwaddr addr, int max_sz,
275
+ int bswap_needed, hwaddr target_page_size)
276
{
277
int fd;
278
ssize_t size, ret;
279
@@ -XXX,XX +XXX,XX @@ toosmall:
280
}
281
282
/* Load a U-Boot image. */
283
-static int load_uboot_image(const char *filename, hwaddr *ep, hwaddr *loadaddr,
284
- int *is_linux, uint8_t image_type,
285
- uint64_t (*translate_fn)(void *, uint64_t),
286
- void *translate_opaque, AddressSpace *as)
287
+static ssize_t load_uboot_image(const char *filename, hwaddr *ep,
288
+ hwaddr *loadaddr, int *is_linux,
289
+ uint8_t image_type,
290
+ uint64_t (*translate_fn)(void *, uint64_t),
291
+ void *translate_opaque, AddressSpace *as)
292
{
293
int fd;
294
- int size;
295
+ ssize_t size;
296
hwaddr address;
297
uboot_image_header_t h;
298
uboot_image_header_t *hdr = &h;
299
@@ -XXX,XX +XXX,XX @@ out:
35
return ret;
300
return ret;
36
}
301
}
302
303
-int load_uimage(const char *filename, hwaddr *ep, hwaddr *loadaddr,
304
- int *is_linux,
305
- uint64_t (*translate_fn)(void *, uint64_t),
306
- void *translate_opaque)
307
+ssize_t load_uimage(const char *filename, hwaddr *ep, hwaddr *loadaddr,
308
+ int *is_linux,
309
+ uint64_t (*translate_fn)(void *, uint64_t),
310
+ void *translate_opaque)
311
{
312
return load_uboot_image(filename, ep, loadaddr, is_linux, IH_TYPE_KERNEL,
313
translate_fn, translate_opaque, NULL);
314
}
315
316
-int load_uimage_as(const char *filename, hwaddr *ep, hwaddr *loadaddr,
317
- int *is_linux,
318
- uint64_t (*translate_fn)(void *, uint64_t),
319
- void *translate_opaque, AddressSpace *as)
320
+ssize_t load_uimage_as(const char *filename, hwaddr *ep, hwaddr *loadaddr,
321
+ int *is_linux,
322
+ uint64_t (*translate_fn)(void *, uint64_t),
323
+ void *translate_opaque, AddressSpace *as)
324
{
325
return load_uboot_image(filename, ep, loadaddr, is_linux, IH_TYPE_KERNEL,
326
translate_fn, translate_opaque, as);
327
}
328
329
/* Load a ramdisk. */
330
-int load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz)
331
+ssize_t load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz)
332
{
333
return load_ramdisk_as(filename, addr, max_sz, NULL);
334
}
335
336
-int load_ramdisk_as(const char *filename, hwaddr addr, uint64_t max_sz,
337
- AddressSpace *as)
338
+ssize_t load_ramdisk_as(const char *filename, hwaddr addr, uint64_t max_sz,
339
+ AddressSpace *as)
340
{
341
return load_uboot_image(filename, NULL, &addr, NULL, IH_TYPE_RAMDISK,
342
NULL, NULL, as);
343
}
344
345
/* Load a gzip-compressed kernel to a dynamically allocated buffer. */
346
-int load_image_gzipped_buffer(const char *filename, uint64_t max_sz,
347
- uint8_t **buffer)
348
+ssize_t load_image_gzipped_buffer(const char *filename, uint64_t max_sz,
349
+ uint8_t **buffer)
350
{
351
uint8_t *compressed_data = NULL;
352
uint8_t *data = NULL;
353
@@ -XXX,XX +XXX,XX @@ int load_image_gzipped_buffer(const char *filename, uint64_t max_sz,
354
}
355
356
/* Load a gzip-compressed kernel. */
357
-int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz)
358
+ssize_t load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz)
359
{
360
- int bytes;
361
+ ssize_t bytes;
362
uint8_t *data;
363
364
bytes = load_image_gzipped_buffer(filename, max_sz, &data);
365
@@ -XXX,XX +XXX,XX @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name, bool ro)
366
return data;
367
}
368
369
-int rom_add_file(const char *file, const char *fw_dir,
370
- hwaddr addr, int32_t bootindex,
371
- bool option_rom, MemoryRegion *mr,
372
- AddressSpace *as)
373
+ssize_t rom_add_file(const char *file, const char *fw_dir,
374
+ hwaddr addr, int32_t bootindex,
375
+ bool option_rom, MemoryRegion *mr,
376
+ AddressSpace *as)
377
{
378
MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
379
Rom *rom;
380
- int rc, fd = -1;
381
+ ssize_t rc;
382
+ int fd = -1;
383
char devpath[100];
384
385
if (as && mr) {
386
@@ -XXX,XX +XXX,XX @@ int rom_add_file(const char *file, const char *fw_dir,
387
lseek(fd, 0, SEEK_SET);
388
rc = read(fd, rom->data, rom->datasize);
389
if (rc != rom->datasize) {
390
- fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %zd)\n",
391
+ fprintf(stderr, "rom: file %-20s: read error: rc=%zd (expected %zd)\n",
392
rom->name, rc, rom->datasize);
393
goto err;
394
}
395
@@ -XXX,XX +XXX,XX @@ int rom_add_elf_program(const char *name, GMappedFile *mapped_file, void *data,
396
return 0;
397
}
398
399
-int rom_add_vga(const char *file)
400
+ssize_t rom_add_vga(const char *file)
401
{
402
return rom_add_file(file, "vgaroms", 0, -1, true, NULL, NULL);
403
}
404
405
-int rom_add_option(const char *file, int32_t bootindex)
406
+ssize_t rom_add_option(const char *file, int32_t bootindex)
407
{
408
return rom_add_file(file, "genroms", 0, bootindex, true, NULL, NULL);
409
}
410
@@ -XXX,XX +XXX,XX @@ out:
411
}
412
413
/* return size or -1 if error */
414
-int load_targphys_hex_as(const char *filename, hwaddr *entry, AddressSpace *as)
415
+ssize_t load_targphys_hex_as(const char *filename, hwaddr *entry,
416
+ AddressSpace *as)
417
{
418
gsize hex_blob_size;
419
gchar *hex_blob;
420
- int total_size = 0;
421
+ ssize_t total_size = 0;
422
423
if (!g_file_get_contents(filename, &hex_blob, &hex_blob_size, NULL)) {
424
return -1;
425
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
426
index XXXXXXX..XXXXXXX 100644
427
--- a/hw/i386/x86.c
428
+++ b/hw/i386/x86.c
429
@@ -XXX,XX +XXX,XX @@ void x86_bios_rom_init(MachineState *ms, const char *default_firmware,
430
char *filename;
431
MemoryRegion *bios, *isa_bios;
432
int bios_size, isa_bios_size;
433
- int ret;
434
+ ssize_t ret;
435
436
/* BIOS load */
437
bios_name = ms->firmware ?: default_firmware;
438
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
439
index XXXXXXX..XXXXXXX 100644
440
--- a/hw/riscv/boot.c
441
+++ b/hw/riscv/boot.c
442
@@ -XXX,XX +XXX,XX @@ target_ulong riscv_load_firmware(const char *firmware_filename,
443
hwaddr firmware_load_addr,
444
symbol_fn_t sym_cb)
445
{
446
- uint64_t firmware_entry, firmware_size, firmware_end;
447
+ uint64_t firmware_entry, firmware_end;
448
+ ssize_t firmware_size;
449
450
if (load_elf_ram_sym(firmware_filename, NULL, NULL, NULL,
451
&firmware_entry, NULL, &firmware_end, NULL,
452
@@ -XXX,XX +XXX,XX @@ target_ulong riscv_load_kernel(const char *kernel_filename,
453
hwaddr riscv_load_initrd(const char *filename, uint64_t mem_size,
454
uint64_t kernel_entry, hwaddr *start)
455
{
456
- int size;
457
+ ssize_t size;
458
459
/*
460
* We want to put the initrd far enough into RAM that when the
37
--
461
--
38
2.30.1
462
2.36.1
39
40
diff view generated by jsdifflib
1
From: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
1
From: Andrew Bresticker <abrestic@rivosinc.com>
2
2
3
The current two-stage lookup detection in riscv_cpu_do_interrupt falls
3
Whether or not VSEIP is pending isn't reflected in env->mip and must
4
short of its purpose, as all it checks is whether two-stage address
4
instead be determined from hstatus.vgein and hgeip. As a result a
5
translation either via the hypervisor-load store instructions or the
5
CPU in WFI won't wake on a VSEIP, which violates the WFI behavior as
6
MPRV feature would be allowed.
6
specified in the privileged ISA. Just use riscv_cpu_all_pending()
7
instead, which already accounts for VSEIP.
7
8
8
What we really need instead is whether two-stage address translation was
9
Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
9
active when the exception was raised. However, in riscv_cpu_do_interrupt
10
we do not have the information to reliably detect this. Therefore, when
11
we raise a memory fault exception we have to record whether two-stage
12
address translation is active.
13
14
Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
16
Message-id: 20210319141459.1196741-1-georg.kotheimer@kernkonzept.com
11
Message-Id: <20220531210544.181322-1-abrestic@rivosinc.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
18
---
13
---
19
target/riscv/cpu.h | 4 ++++
14
target/riscv/cpu.h | 1 +
20
target/riscv/cpu.c | 1 +
15
target/riscv/cpu.c | 2 +-
21
target/riscv/cpu_helper.c | 21 ++++++++-------------
16
target/riscv/cpu_helper.c | 2 +-
22
3 files changed, 13 insertions(+), 13 deletions(-)
17
3 files changed, 3 insertions(+), 2 deletions(-)
23
18
24
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
19
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
25
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
26
--- a/target/riscv/cpu.h
21
--- a/target/riscv/cpu.h
27
+++ b/target/riscv/cpu.h
22
+++ b/target/riscv/cpu.h
28
@@ -XXX,XX +XXX,XX @@ struct CPURISCVState {
23
@@ -XXX,XX +XXX,XX @@ int riscv_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
29
target_ulong satp_hs;
24
int riscv_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
30
uint64_t mstatus_hs;
25
int riscv_cpu_hviprio_index2irq(int index, int *out_irq, int *out_rdzero);
31
26
uint8_t riscv_cpu_default_priority(int irq);
32
+ /* Signals whether the current exception occurred with two-stage address
27
+uint64_t riscv_cpu_all_pending(CPURISCVState *env);
33
+ translation active. */
28
int riscv_cpu_mirq_pending(CPURISCVState *env);
34
+ bool two_stage_lookup;
29
int riscv_cpu_sirq_pending(CPURISCVState *env);
35
+
30
int riscv_cpu_vsirq_pending(CPURISCVState *env);
36
target_ulong scounteren;
37
target_ulong mcounteren;
38
39
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
31
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
40
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
41
--- a/target/riscv/cpu.c
33
--- a/target/riscv/cpu.c
42
+++ b/target/riscv/cpu.c
34
+++ b/target/riscv/cpu.c
43
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_reset(DeviceState *dev)
35
@@ -XXX,XX +XXX,XX @@ static bool riscv_cpu_has_work(CPUState *cs)
44
env->mstatus &= ~(MSTATUS_MIE | MSTATUS_MPRV);
36
* Definition of the WFI instruction requires it to ignore the privilege
45
env->mcause = 0;
37
* mode and delegation registers, but respect individual enables
46
env->pc = env->resetvec;
38
*/
47
+ env->two_stage_lookup = false;
39
- return (env->mip & env->mie) != 0;
40
+ return riscv_cpu_all_pending(env) != 0;
41
#else
42
return true;
48
#endif
43
#endif
49
cs->exception_index = EXCP_NONE;
50
env->load_res = -1;
51
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
44
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
52
index XXXXXXX..XXXXXXX 100644
45
index XXXXXXX..XXXXXXX 100644
53
--- a/target/riscv/cpu_helper.c
46
--- a/target/riscv/cpu_helper.c
54
+++ b/target/riscv/cpu_helper.c
47
+++ b/target/riscv/cpu_helper.c
55
@@ -XXX,XX +XXX,XX @@ static void raise_mmu_exception(CPURISCVState *env, target_ulong address,
48
@@ -XXX,XX +XXX,XX @@ static int riscv_cpu_pending_to_irq(CPURISCVState *env,
56
g_assert_not_reached();
49
return best_irq;
57
}
58
env->badaddr = address;
59
+ env->two_stage_lookup = two_stage;
60
}
50
}
61
51
62
hwaddr riscv_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
52
-static uint64_t riscv_cpu_all_pending(CPURISCVState *env)
63
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
53
+uint64_t riscv_cpu_all_pending(CPURISCVState *env)
64
}
54
{
65
55
uint32_t gein = get_field(env->hstatus, HSTATUS_VGEIN);
66
env->badaddr = addr;
56
uint64_t vsgein = (env->hgeip & (1ULL << gein)) ? MIP_VSEIP : 0;
67
+ env->two_stage_lookup = riscv_cpu_virt_enabled(env) ||
68
+ riscv_cpu_two_stage_lookup(mmu_idx);
69
riscv_raise_exception(&cpu->env, cs->exception_index, retaddr);
70
}
71
72
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
73
g_assert_not_reached();
74
}
75
env->badaddr = addr;
76
+ env->two_stage_lookup = riscv_cpu_virt_enabled(env) ||
77
+ riscv_cpu_two_stage_lookup(mmu_idx);
78
riscv_raise_exception(env, cs->exception_index, retaddr);
79
}
80
#endif /* !CONFIG_USER_ONLY */
81
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs)
82
/* handle the trap in S-mode */
83
if (riscv_has_ext(env, RVH)) {
84
target_ulong hdeleg = async ? env->hideleg : env->hedeleg;
85
- bool two_stage_lookup = false;
86
87
- if (env->priv == PRV_M ||
88
- (env->priv == PRV_S && !riscv_cpu_virt_enabled(env)) ||
89
- (env->priv == PRV_U && !riscv_cpu_virt_enabled(env) &&
90
- get_field(env->hstatus, HSTATUS_HU))) {
91
- two_stage_lookup = true;
92
- }
93
-
94
- if ((riscv_cpu_virt_enabled(env) || two_stage_lookup) && write_tval) {
95
+ if (env->two_stage_lookup && write_tval) {
96
/*
97
* If we are writing a guest virtual address to stval, set
98
* this to 1. If we are trapping to VS we will set this to 0
99
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs)
100
riscv_cpu_set_force_hs_excep(env, 0);
101
} else {
102
/* Trap into HS mode */
103
- if (!two_stage_lookup) {
104
- env->hstatus = set_field(env->hstatus, HSTATUS_SPV,
105
- riscv_cpu_virt_enabled(env));
106
- }
107
+ env->hstatus = set_field(env->hstatus, HSTATUS_SPV, false);
108
htval = env->guest_phys_fault_addr;
109
}
110
}
111
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs)
112
* RISC-V ISA Specification.
113
*/
114
115
+ env->two_stage_lookup = false;
116
#endif
117
cs->exception_index = EXCP_NONE; /* mark handled to qemu */
118
}
119
--
57
--
120
2.30.1
58
2.36.1
121
122
diff view generated by jsdifflib
New patch
1
From: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
1
2
3
Add an MXL_RV128 case in two switches so that no error is triggered when
4
using the -cpu x-rv128 option.
5
6
Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
7
Acked-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
9
Message-Id: <20220602155246.38837-1-frederic.petrot@univ-grenoble-alpes.fr>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
target/riscv/debug.c | 2 ++
13
1 file changed, 2 insertions(+)
14
15
diff --git a/target/riscv/debug.c b/target/riscv/debug.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/riscv/debug.c
18
+++ b/target/riscv/debug.c
19
@@ -XXX,XX +XXX,XX @@ static inline target_ulong trigger_type(CPURISCVState *env,
20
tdata1 = RV32_TYPE(type);
21
break;
22
case MXL_RV64:
23
+ case MXL_RV128:
24
tdata1 = RV64_TYPE(type);
25
break;
26
default:
27
@@ -XXX,XX +XXX,XX @@ static target_ulong tdata1_validate(CPURISCVState *env, target_ulong val,
28
tdata1 = RV32_TYPE(t);
29
break;
30
case MXL_RV64:
31
+ case MXL_RV128:
32
type = extract64(val, 60, 4);
33
dmode = extract64(val, 59, 1);
34
tdata1 = RV64_TYPE(t);
35
--
36
2.36.1
diff view generated by jsdifflib
New patch
1
From: eopXD <yueh.ting.chen@gmail.com>
1
2
3
No functional change intended in this commit.
4
5
Signed-off-by: eop Chen <eop.chen@sifive.com>
6
Reviewed-by: Frank Chang <frank.chang@sifive.com>
7
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-Id: <165449614532.19704.7000832880482980398-1@git.sr.ht>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
target/riscv/vector_helper.c | 1132 +++++++++++++++++-----------------
13
1 file changed, 565 insertions(+), 567 deletions(-)
14
15
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/riscv/vector_helper.c
18
+++ b/target/riscv/vector_helper.c
19
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vsub_vv_d, OP_SSS_D, H8, H8, H8, DO_SUB)
20
21
static void do_vext_vv(void *vd, void *v0, void *vs1, void *vs2,
22
CPURISCVState *env, uint32_t desc,
23
- uint32_t esz, uint32_t dsz,
24
opivv2_fn *fn)
25
{
26
uint32_t vm = vext_vm(desc);
27
@@ -XXX,XX +XXX,XX @@ static void do_vext_vv(void *vd, void *v0, void *vs1, void *vs2,
28
}
29
30
/* generate the helpers for OPIVV */
31
-#define GEN_VEXT_VV(NAME, ESZ, DSZ) \
32
+#define GEN_VEXT_VV(NAME) \
33
void HELPER(NAME)(void *vd, void *v0, void *vs1, \
34
void *vs2, CPURISCVState *env, \
35
uint32_t desc) \
36
{ \
37
- do_vext_vv(vd, v0, vs1, vs2, env, desc, ESZ, DSZ, \
38
+ do_vext_vv(vd, v0, vs1, vs2, env, desc, \
39
do_##NAME); \
40
}
41
42
-GEN_VEXT_VV(vadd_vv_b, 1, 1)
43
-GEN_VEXT_VV(vadd_vv_h, 2, 2)
44
-GEN_VEXT_VV(vadd_vv_w, 4, 4)
45
-GEN_VEXT_VV(vadd_vv_d, 8, 8)
46
-GEN_VEXT_VV(vsub_vv_b, 1, 1)
47
-GEN_VEXT_VV(vsub_vv_h, 2, 2)
48
-GEN_VEXT_VV(vsub_vv_w, 4, 4)
49
-GEN_VEXT_VV(vsub_vv_d, 8, 8)
50
+GEN_VEXT_VV(vadd_vv_b)
51
+GEN_VEXT_VV(vadd_vv_h)
52
+GEN_VEXT_VV(vadd_vv_w)
53
+GEN_VEXT_VV(vadd_vv_d)
54
+GEN_VEXT_VV(vsub_vv_b)
55
+GEN_VEXT_VV(vsub_vv_h)
56
+GEN_VEXT_VV(vsub_vv_w)
57
+GEN_VEXT_VV(vsub_vv_d)
58
59
typedef void opivx2_fn(void *vd, target_long s1, void *vs2, int i);
60
61
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vrsub_vx_d, OP_SSS_D, H8, H8, DO_RSUB)
62
63
static void do_vext_vx(void *vd, void *v0, target_long s1, void *vs2,
64
CPURISCVState *env, uint32_t desc,
65
- uint32_t esz, uint32_t dsz,
66
opivx2_fn fn)
67
{
68
uint32_t vm = vext_vm(desc);
69
@@ -XXX,XX +XXX,XX @@ static void do_vext_vx(void *vd, void *v0, target_long s1, void *vs2,
70
}
71
72
/* generate the helpers for OPIVX */
73
-#define GEN_VEXT_VX(NAME, ESZ, DSZ) \
74
+#define GEN_VEXT_VX(NAME) \
75
void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
76
void *vs2, CPURISCVState *env, \
77
uint32_t desc) \
78
{ \
79
- do_vext_vx(vd, v0, s1, vs2, env, desc, ESZ, DSZ, \
80
+ do_vext_vx(vd, v0, s1, vs2, env, desc, \
81
do_##NAME); \
82
}
83
84
-GEN_VEXT_VX(vadd_vx_b, 1, 1)
85
-GEN_VEXT_VX(vadd_vx_h, 2, 2)
86
-GEN_VEXT_VX(vadd_vx_w, 4, 4)
87
-GEN_VEXT_VX(vadd_vx_d, 8, 8)
88
-GEN_VEXT_VX(vsub_vx_b, 1, 1)
89
-GEN_VEXT_VX(vsub_vx_h, 2, 2)
90
-GEN_VEXT_VX(vsub_vx_w, 4, 4)
91
-GEN_VEXT_VX(vsub_vx_d, 8, 8)
92
-GEN_VEXT_VX(vrsub_vx_b, 1, 1)
93
-GEN_VEXT_VX(vrsub_vx_h, 2, 2)
94
-GEN_VEXT_VX(vrsub_vx_w, 4, 4)
95
-GEN_VEXT_VX(vrsub_vx_d, 8, 8)
96
+GEN_VEXT_VX(vadd_vx_b)
97
+GEN_VEXT_VX(vadd_vx_h)
98
+GEN_VEXT_VX(vadd_vx_w)
99
+GEN_VEXT_VX(vadd_vx_d)
100
+GEN_VEXT_VX(vsub_vx_b)
101
+GEN_VEXT_VX(vsub_vx_h)
102
+GEN_VEXT_VX(vsub_vx_w)
103
+GEN_VEXT_VX(vsub_vx_d)
104
+GEN_VEXT_VX(vrsub_vx_b)
105
+GEN_VEXT_VX(vrsub_vx_h)
106
+GEN_VEXT_VX(vrsub_vx_w)
107
+GEN_VEXT_VX(vrsub_vx_d)
108
109
void HELPER(vec_rsubs8)(void *d, void *a, uint64_t b, uint32_t desc)
110
{
111
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vwadd_wv_w, WOP_WSSS_W, H8, H4, H4, DO_ADD)
112
RVVCALL(OPIVV2, vwsub_wv_b, WOP_WSSS_B, H2, H1, H1, DO_SUB)
113
RVVCALL(OPIVV2, vwsub_wv_h, WOP_WSSS_H, H4, H2, H2, DO_SUB)
114
RVVCALL(OPIVV2, vwsub_wv_w, WOP_WSSS_W, H8, H4, H4, DO_SUB)
115
-GEN_VEXT_VV(vwaddu_vv_b, 1, 2)
116
-GEN_VEXT_VV(vwaddu_vv_h, 2, 4)
117
-GEN_VEXT_VV(vwaddu_vv_w, 4, 8)
118
-GEN_VEXT_VV(vwsubu_vv_b, 1, 2)
119
-GEN_VEXT_VV(vwsubu_vv_h, 2, 4)
120
-GEN_VEXT_VV(vwsubu_vv_w, 4, 8)
121
-GEN_VEXT_VV(vwadd_vv_b, 1, 2)
122
-GEN_VEXT_VV(vwadd_vv_h, 2, 4)
123
-GEN_VEXT_VV(vwadd_vv_w, 4, 8)
124
-GEN_VEXT_VV(vwsub_vv_b, 1, 2)
125
-GEN_VEXT_VV(vwsub_vv_h, 2, 4)
126
-GEN_VEXT_VV(vwsub_vv_w, 4, 8)
127
-GEN_VEXT_VV(vwaddu_wv_b, 1, 2)
128
-GEN_VEXT_VV(vwaddu_wv_h, 2, 4)
129
-GEN_VEXT_VV(vwaddu_wv_w, 4, 8)
130
-GEN_VEXT_VV(vwsubu_wv_b, 1, 2)
131
-GEN_VEXT_VV(vwsubu_wv_h, 2, 4)
132
-GEN_VEXT_VV(vwsubu_wv_w, 4, 8)
133
-GEN_VEXT_VV(vwadd_wv_b, 1, 2)
134
-GEN_VEXT_VV(vwadd_wv_h, 2, 4)
135
-GEN_VEXT_VV(vwadd_wv_w, 4, 8)
136
-GEN_VEXT_VV(vwsub_wv_b, 1, 2)
137
-GEN_VEXT_VV(vwsub_wv_h, 2, 4)
138
-GEN_VEXT_VV(vwsub_wv_w, 4, 8)
139
+GEN_VEXT_VV(vwaddu_vv_b)
140
+GEN_VEXT_VV(vwaddu_vv_h)
141
+GEN_VEXT_VV(vwaddu_vv_w)
142
+GEN_VEXT_VV(vwsubu_vv_b)
143
+GEN_VEXT_VV(vwsubu_vv_h)
144
+GEN_VEXT_VV(vwsubu_vv_w)
145
+GEN_VEXT_VV(vwadd_vv_b)
146
+GEN_VEXT_VV(vwadd_vv_h)
147
+GEN_VEXT_VV(vwadd_vv_w)
148
+GEN_VEXT_VV(vwsub_vv_b)
149
+GEN_VEXT_VV(vwsub_vv_h)
150
+GEN_VEXT_VV(vwsub_vv_w)
151
+GEN_VEXT_VV(vwaddu_wv_b)
152
+GEN_VEXT_VV(vwaddu_wv_h)
153
+GEN_VEXT_VV(vwaddu_wv_w)
154
+GEN_VEXT_VV(vwsubu_wv_b)
155
+GEN_VEXT_VV(vwsubu_wv_h)
156
+GEN_VEXT_VV(vwsubu_wv_w)
157
+GEN_VEXT_VV(vwadd_wv_b)
158
+GEN_VEXT_VV(vwadd_wv_h)
159
+GEN_VEXT_VV(vwadd_wv_w)
160
+GEN_VEXT_VV(vwsub_wv_b)
161
+GEN_VEXT_VV(vwsub_wv_h)
162
+GEN_VEXT_VV(vwsub_wv_w)
163
164
RVVCALL(OPIVX2, vwaddu_vx_b, WOP_UUU_B, H2, H1, DO_ADD)
165
RVVCALL(OPIVX2, vwaddu_vx_h, WOP_UUU_H, H4, H2, DO_ADD)
166
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vwadd_wx_w, WOP_WSSS_W, H8, H4, DO_ADD)
167
RVVCALL(OPIVX2, vwsub_wx_b, WOP_WSSS_B, H2, H1, DO_SUB)
168
RVVCALL(OPIVX2, vwsub_wx_h, WOP_WSSS_H, H4, H2, DO_SUB)
169
RVVCALL(OPIVX2, vwsub_wx_w, WOP_WSSS_W, H8, H4, DO_SUB)
170
-GEN_VEXT_VX(vwaddu_vx_b, 1, 2)
171
-GEN_VEXT_VX(vwaddu_vx_h, 2, 4)
172
-GEN_VEXT_VX(vwaddu_vx_w, 4, 8)
173
-GEN_VEXT_VX(vwsubu_vx_b, 1, 2)
174
-GEN_VEXT_VX(vwsubu_vx_h, 2, 4)
175
-GEN_VEXT_VX(vwsubu_vx_w, 4, 8)
176
-GEN_VEXT_VX(vwadd_vx_b, 1, 2)
177
-GEN_VEXT_VX(vwadd_vx_h, 2, 4)
178
-GEN_VEXT_VX(vwadd_vx_w, 4, 8)
179
-GEN_VEXT_VX(vwsub_vx_b, 1, 2)
180
-GEN_VEXT_VX(vwsub_vx_h, 2, 4)
181
-GEN_VEXT_VX(vwsub_vx_w, 4, 8)
182
-GEN_VEXT_VX(vwaddu_wx_b, 1, 2)
183
-GEN_VEXT_VX(vwaddu_wx_h, 2, 4)
184
-GEN_VEXT_VX(vwaddu_wx_w, 4, 8)
185
-GEN_VEXT_VX(vwsubu_wx_b, 1, 2)
186
-GEN_VEXT_VX(vwsubu_wx_h, 2, 4)
187
-GEN_VEXT_VX(vwsubu_wx_w, 4, 8)
188
-GEN_VEXT_VX(vwadd_wx_b, 1, 2)
189
-GEN_VEXT_VX(vwadd_wx_h, 2, 4)
190
-GEN_VEXT_VX(vwadd_wx_w, 4, 8)
191
-GEN_VEXT_VX(vwsub_wx_b, 1, 2)
192
-GEN_VEXT_VX(vwsub_wx_h, 2, 4)
193
-GEN_VEXT_VX(vwsub_wx_w, 4, 8)
194
+GEN_VEXT_VX(vwaddu_vx_b)
195
+GEN_VEXT_VX(vwaddu_vx_h)
196
+GEN_VEXT_VX(vwaddu_vx_w)
197
+GEN_VEXT_VX(vwsubu_vx_b)
198
+GEN_VEXT_VX(vwsubu_vx_h)
199
+GEN_VEXT_VX(vwsubu_vx_w)
200
+GEN_VEXT_VX(vwadd_vx_b)
201
+GEN_VEXT_VX(vwadd_vx_h)
202
+GEN_VEXT_VX(vwadd_vx_w)
203
+GEN_VEXT_VX(vwsub_vx_b)
204
+GEN_VEXT_VX(vwsub_vx_h)
205
+GEN_VEXT_VX(vwsub_vx_w)
206
+GEN_VEXT_VX(vwaddu_wx_b)
207
+GEN_VEXT_VX(vwaddu_wx_h)
208
+GEN_VEXT_VX(vwaddu_wx_w)
209
+GEN_VEXT_VX(vwsubu_wx_b)
210
+GEN_VEXT_VX(vwsubu_wx_h)
211
+GEN_VEXT_VX(vwsubu_wx_w)
212
+GEN_VEXT_VX(vwadd_wx_b)
213
+GEN_VEXT_VX(vwadd_wx_h)
214
+GEN_VEXT_VX(vwadd_wx_w)
215
+GEN_VEXT_VX(vwsub_wx_b)
216
+GEN_VEXT_VX(vwsub_wx_h)
217
+GEN_VEXT_VX(vwsub_wx_w)
218
219
/* Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions */
220
#define DO_VADC(N, M, C) (N + M + C)
221
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vxor_vv_b, OP_SSS_B, H1, H1, H1, DO_XOR)
222
RVVCALL(OPIVV2, vxor_vv_h, OP_SSS_H, H2, H2, H2, DO_XOR)
223
RVVCALL(OPIVV2, vxor_vv_w, OP_SSS_W, H4, H4, H4, DO_XOR)
224
RVVCALL(OPIVV2, vxor_vv_d, OP_SSS_D, H8, H8, H8, DO_XOR)
225
-GEN_VEXT_VV(vand_vv_b, 1, 1)
226
-GEN_VEXT_VV(vand_vv_h, 2, 2)
227
-GEN_VEXT_VV(vand_vv_w, 4, 4)
228
-GEN_VEXT_VV(vand_vv_d, 8, 8)
229
-GEN_VEXT_VV(vor_vv_b, 1, 1)
230
-GEN_VEXT_VV(vor_vv_h, 2, 2)
231
-GEN_VEXT_VV(vor_vv_w, 4, 4)
232
-GEN_VEXT_VV(vor_vv_d, 8, 8)
233
-GEN_VEXT_VV(vxor_vv_b, 1, 1)
234
-GEN_VEXT_VV(vxor_vv_h, 2, 2)
235
-GEN_VEXT_VV(vxor_vv_w, 4, 4)
236
-GEN_VEXT_VV(vxor_vv_d, 8, 8)
237
+GEN_VEXT_VV(vand_vv_b)
238
+GEN_VEXT_VV(vand_vv_h)
239
+GEN_VEXT_VV(vand_vv_w)
240
+GEN_VEXT_VV(vand_vv_d)
241
+GEN_VEXT_VV(vor_vv_b)
242
+GEN_VEXT_VV(vor_vv_h)
243
+GEN_VEXT_VV(vor_vv_w)
244
+GEN_VEXT_VV(vor_vv_d)
245
+GEN_VEXT_VV(vxor_vv_b)
246
+GEN_VEXT_VV(vxor_vv_h)
247
+GEN_VEXT_VV(vxor_vv_w)
248
+GEN_VEXT_VV(vxor_vv_d)
249
250
RVVCALL(OPIVX2, vand_vx_b, OP_SSS_B, H1, H1, DO_AND)
251
RVVCALL(OPIVX2, vand_vx_h, OP_SSS_H, H2, H2, DO_AND)
252
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vxor_vx_b, OP_SSS_B, H1, H1, DO_XOR)
253
RVVCALL(OPIVX2, vxor_vx_h, OP_SSS_H, H2, H2, DO_XOR)
254
RVVCALL(OPIVX2, vxor_vx_w, OP_SSS_W, H4, H4, DO_XOR)
255
RVVCALL(OPIVX2, vxor_vx_d, OP_SSS_D, H8, H8, DO_XOR)
256
-GEN_VEXT_VX(vand_vx_b, 1, 1)
257
-GEN_VEXT_VX(vand_vx_h, 2, 2)
258
-GEN_VEXT_VX(vand_vx_w, 4, 4)
259
-GEN_VEXT_VX(vand_vx_d, 8, 8)
260
-GEN_VEXT_VX(vor_vx_b, 1, 1)
261
-GEN_VEXT_VX(vor_vx_h, 2, 2)
262
-GEN_VEXT_VX(vor_vx_w, 4, 4)
263
-GEN_VEXT_VX(vor_vx_d, 8, 8)
264
-GEN_VEXT_VX(vxor_vx_b, 1, 1)
265
-GEN_VEXT_VX(vxor_vx_h, 2, 2)
266
-GEN_VEXT_VX(vxor_vx_w, 4, 4)
267
-GEN_VEXT_VX(vxor_vx_d, 8, 8)
268
+GEN_VEXT_VX(vand_vx_b)
269
+GEN_VEXT_VX(vand_vx_h)
270
+GEN_VEXT_VX(vand_vx_w)
271
+GEN_VEXT_VX(vand_vx_d)
272
+GEN_VEXT_VX(vor_vx_b)
273
+GEN_VEXT_VX(vor_vx_h)
274
+GEN_VEXT_VX(vor_vx_w)
275
+GEN_VEXT_VX(vor_vx_d)
276
+GEN_VEXT_VX(vxor_vx_b)
277
+GEN_VEXT_VX(vxor_vx_h)
278
+GEN_VEXT_VX(vxor_vx_w)
279
+GEN_VEXT_VX(vxor_vx_d)
280
281
/* Vector Single-Width Bit Shift Instructions */
282
#define DO_SLL(N, M) (N << (M))
283
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vmax_vv_b, OP_SSS_B, H1, H1, H1, DO_MAX)
284
RVVCALL(OPIVV2, vmax_vv_h, OP_SSS_H, H2, H2, H2, DO_MAX)
285
RVVCALL(OPIVV2, vmax_vv_w, OP_SSS_W, H4, H4, H4, DO_MAX)
286
RVVCALL(OPIVV2, vmax_vv_d, OP_SSS_D, H8, H8, H8, DO_MAX)
287
-GEN_VEXT_VV(vminu_vv_b, 1, 1)
288
-GEN_VEXT_VV(vminu_vv_h, 2, 2)
289
-GEN_VEXT_VV(vminu_vv_w, 4, 4)
290
-GEN_VEXT_VV(vminu_vv_d, 8, 8)
291
-GEN_VEXT_VV(vmin_vv_b, 1, 1)
292
-GEN_VEXT_VV(vmin_vv_h, 2, 2)
293
-GEN_VEXT_VV(vmin_vv_w, 4, 4)
294
-GEN_VEXT_VV(vmin_vv_d, 8, 8)
295
-GEN_VEXT_VV(vmaxu_vv_b, 1, 1)
296
-GEN_VEXT_VV(vmaxu_vv_h, 2, 2)
297
-GEN_VEXT_VV(vmaxu_vv_w, 4, 4)
298
-GEN_VEXT_VV(vmaxu_vv_d, 8, 8)
299
-GEN_VEXT_VV(vmax_vv_b, 1, 1)
300
-GEN_VEXT_VV(vmax_vv_h, 2, 2)
301
-GEN_VEXT_VV(vmax_vv_w, 4, 4)
302
-GEN_VEXT_VV(vmax_vv_d, 8, 8)
303
+GEN_VEXT_VV(vminu_vv_b)
304
+GEN_VEXT_VV(vminu_vv_h)
305
+GEN_VEXT_VV(vminu_vv_w)
306
+GEN_VEXT_VV(vminu_vv_d)
307
+GEN_VEXT_VV(vmin_vv_b)
308
+GEN_VEXT_VV(vmin_vv_h)
309
+GEN_VEXT_VV(vmin_vv_w)
310
+GEN_VEXT_VV(vmin_vv_d)
311
+GEN_VEXT_VV(vmaxu_vv_b)
312
+GEN_VEXT_VV(vmaxu_vv_h)
313
+GEN_VEXT_VV(vmaxu_vv_w)
314
+GEN_VEXT_VV(vmaxu_vv_d)
315
+GEN_VEXT_VV(vmax_vv_b)
316
+GEN_VEXT_VV(vmax_vv_h)
317
+GEN_VEXT_VV(vmax_vv_w)
318
+GEN_VEXT_VV(vmax_vv_d)
319
320
RVVCALL(OPIVX2, vminu_vx_b, OP_UUU_B, H1, H1, DO_MIN)
321
RVVCALL(OPIVX2, vminu_vx_h, OP_UUU_H, H2, H2, DO_MIN)
322
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vmax_vx_b, OP_SSS_B, H1, H1, DO_MAX)
323
RVVCALL(OPIVX2, vmax_vx_h, OP_SSS_H, H2, H2, DO_MAX)
324
RVVCALL(OPIVX2, vmax_vx_w, OP_SSS_W, H4, H4, DO_MAX)
325
RVVCALL(OPIVX2, vmax_vx_d, OP_SSS_D, H8, H8, DO_MAX)
326
-GEN_VEXT_VX(vminu_vx_b, 1, 1)
327
-GEN_VEXT_VX(vminu_vx_h, 2, 2)
328
-GEN_VEXT_VX(vminu_vx_w, 4, 4)
329
-GEN_VEXT_VX(vminu_vx_d, 8, 8)
330
-GEN_VEXT_VX(vmin_vx_b, 1, 1)
331
-GEN_VEXT_VX(vmin_vx_h, 2, 2)
332
-GEN_VEXT_VX(vmin_vx_w, 4, 4)
333
-GEN_VEXT_VX(vmin_vx_d, 8, 8)
334
-GEN_VEXT_VX(vmaxu_vx_b, 1, 1)
335
-GEN_VEXT_VX(vmaxu_vx_h, 2, 2)
336
-GEN_VEXT_VX(vmaxu_vx_w, 4, 4)
337
-GEN_VEXT_VX(vmaxu_vx_d, 8, 8)
338
-GEN_VEXT_VX(vmax_vx_b, 1, 1)
339
-GEN_VEXT_VX(vmax_vx_h, 2, 2)
340
-GEN_VEXT_VX(vmax_vx_w, 4, 4)
341
-GEN_VEXT_VX(vmax_vx_d, 8, 8)
342
+GEN_VEXT_VX(vminu_vx_b)
343
+GEN_VEXT_VX(vminu_vx_h)
344
+GEN_VEXT_VX(vminu_vx_w)
345
+GEN_VEXT_VX(vminu_vx_d)
346
+GEN_VEXT_VX(vmin_vx_b)
347
+GEN_VEXT_VX(vmin_vx_h)
348
+GEN_VEXT_VX(vmin_vx_w)
349
+GEN_VEXT_VX(vmin_vx_d)
350
+GEN_VEXT_VX(vmaxu_vx_b)
351
+GEN_VEXT_VX(vmaxu_vx_h)
352
+GEN_VEXT_VX(vmaxu_vx_w)
353
+GEN_VEXT_VX(vmaxu_vx_d)
354
+GEN_VEXT_VX(vmax_vx_b)
355
+GEN_VEXT_VX(vmax_vx_h)
356
+GEN_VEXT_VX(vmax_vx_w)
357
+GEN_VEXT_VX(vmax_vx_d)
358
359
/* Vector Single-Width Integer Multiply Instructions */
360
#define DO_MUL(N, M) (N * M)
361
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vmul_vv_b, OP_SSS_B, H1, H1, H1, DO_MUL)
362
RVVCALL(OPIVV2, vmul_vv_h, OP_SSS_H, H2, H2, H2, DO_MUL)
363
RVVCALL(OPIVV2, vmul_vv_w, OP_SSS_W, H4, H4, H4, DO_MUL)
364
RVVCALL(OPIVV2, vmul_vv_d, OP_SSS_D, H8, H8, H8, DO_MUL)
365
-GEN_VEXT_VV(vmul_vv_b, 1, 1)
366
-GEN_VEXT_VV(vmul_vv_h, 2, 2)
367
-GEN_VEXT_VV(vmul_vv_w, 4, 4)
368
-GEN_VEXT_VV(vmul_vv_d, 8, 8)
369
+GEN_VEXT_VV(vmul_vv_b)
370
+GEN_VEXT_VV(vmul_vv_h)
371
+GEN_VEXT_VV(vmul_vv_w)
372
+GEN_VEXT_VV(vmul_vv_d)
373
374
static int8_t do_mulh_b(int8_t s2, int8_t s1)
375
{
376
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vmulhsu_vv_b, OP_SUS_B, H1, H1, H1, do_mulhsu_b)
377
RVVCALL(OPIVV2, vmulhsu_vv_h, OP_SUS_H, H2, H2, H2, do_mulhsu_h)
378
RVVCALL(OPIVV2, vmulhsu_vv_w, OP_SUS_W, H4, H4, H4, do_mulhsu_w)
379
RVVCALL(OPIVV2, vmulhsu_vv_d, OP_SUS_D, H8, H8, H8, do_mulhsu_d)
380
-GEN_VEXT_VV(vmulh_vv_b, 1, 1)
381
-GEN_VEXT_VV(vmulh_vv_h, 2, 2)
382
-GEN_VEXT_VV(vmulh_vv_w, 4, 4)
383
-GEN_VEXT_VV(vmulh_vv_d, 8, 8)
384
-GEN_VEXT_VV(vmulhu_vv_b, 1, 1)
385
-GEN_VEXT_VV(vmulhu_vv_h, 2, 2)
386
-GEN_VEXT_VV(vmulhu_vv_w, 4, 4)
387
-GEN_VEXT_VV(vmulhu_vv_d, 8, 8)
388
-GEN_VEXT_VV(vmulhsu_vv_b, 1, 1)
389
-GEN_VEXT_VV(vmulhsu_vv_h, 2, 2)
390
-GEN_VEXT_VV(vmulhsu_vv_w, 4, 4)
391
-GEN_VEXT_VV(vmulhsu_vv_d, 8, 8)
392
+GEN_VEXT_VV(vmulh_vv_b)
393
+GEN_VEXT_VV(vmulh_vv_h)
394
+GEN_VEXT_VV(vmulh_vv_w)
395
+GEN_VEXT_VV(vmulh_vv_d)
396
+GEN_VEXT_VV(vmulhu_vv_b)
397
+GEN_VEXT_VV(vmulhu_vv_h)
398
+GEN_VEXT_VV(vmulhu_vv_w)
399
+GEN_VEXT_VV(vmulhu_vv_d)
400
+GEN_VEXT_VV(vmulhsu_vv_b)
401
+GEN_VEXT_VV(vmulhsu_vv_h)
402
+GEN_VEXT_VV(vmulhsu_vv_w)
403
+GEN_VEXT_VV(vmulhsu_vv_d)
404
405
RVVCALL(OPIVX2, vmul_vx_b, OP_SSS_B, H1, H1, DO_MUL)
406
RVVCALL(OPIVX2, vmul_vx_h, OP_SSS_H, H2, H2, DO_MUL)
407
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vmulhsu_vx_b, OP_SUS_B, H1, H1, do_mulhsu_b)
408
RVVCALL(OPIVX2, vmulhsu_vx_h, OP_SUS_H, H2, H2, do_mulhsu_h)
409
RVVCALL(OPIVX2, vmulhsu_vx_w, OP_SUS_W, H4, H4, do_mulhsu_w)
410
RVVCALL(OPIVX2, vmulhsu_vx_d, OP_SUS_D, H8, H8, do_mulhsu_d)
411
-GEN_VEXT_VX(vmul_vx_b, 1, 1)
412
-GEN_VEXT_VX(vmul_vx_h, 2, 2)
413
-GEN_VEXT_VX(vmul_vx_w, 4, 4)
414
-GEN_VEXT_VX(vmul_vx_d, 8, 8)
415
-GEN_VEXT_VX(vmulh_vx_b, 1, 1)
416
-GEN_VEXT_VX(vmulh_vx_h, 2, 2)
417
-GEN_VEXT_VX(vmulh_vx_w, 4, 4)
418
-GEN_VEXT_VX(vmulh_vx_d, 8, 8)
419
-GEN_VEXT_VX(vmulhu_vx_b, 1, 1)
420
-GEN_VEXT_VX(vmulhu_vx_h, 2, 2)
421
-GEN_VEXT_VX(vmulhu_vx_w, 4, 4)
422
-GEN_VEXT_VX(vmulhu_vx_d, 8, 8)
423
-GEN_VEXT_VX(vmulhsu_vx_b, 1, 1)
424
-GEN_VEXT_VX(vmulhsu_vx_h, 2, 2)
425
-GEN_VEXT_VX(vmulhsu_vx_w, 4, 4)
426
-GEN_VEXT_VX(vmulhsu_vx_d, 8, 8)
427
+GEN_VEXT_VX(vmul_vx_b)
428
+GEN_VEXT_VX(vmul_vx_h)
429
+GEN_VEXT_VX(vmul_vx_w)
430
+GEN_VEXT_VX(vmul_vx_d)
431
+GEN_VEXT_VX(vmulh_vx_b)
432
+GEN_VEXT_VX(vmulh_vx_h)
433
+GEN_VEXT_VX(vmulh_vx_w)
434
+GEN_VEXT_VX(vmulh_vx_d)
435
+GEN_VEXT_VX(vmulhu_vx_b)
436
+GEN_VEXT_VX(vmulhu_vx_h)
437
+GEN_VEXT_VX(vmulhu_vx_w)
438
+GEN_VEXT_VX(vmulhu_vx_d)
439
+GEN_VEXT_VX(vmulhsu_vx_b)
440
+GEN_VEXT_VX(vmulhsu_vx_h)
441
+GEN_VEXT_VX(vmulhsu_vx_w)
442
+GEN_VEXT_VX(vmulhsu_vx_d)
443
444
/* Vector Integer Divide Instructions */
445
#define DO_DIVU(N, M) (unlikely(M == 0) ? (__typeof(N))(-1) : N / M)
446
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vrem_vv_b, OP_SSS_B, H1, H1, H1, DO_REM)
447
RVVCALL(OPIVV2, vrem_vv_h, OP_SSS_H, H2, H2, H2, DO_REM)
448
RVVCALL(OPIVV2, vrem_vv_w, OP_SSS_W, H4, H4, H4, DO_REM)
449
RVVCALL(OPIVV2, vrem_vv_d, OP_SSS_D, H8, H8, H8, DO_REM)
450
-GEN_VEXT_VV(vdivu_vv_b, 1, 1)
451
-GEN_VEXT_VV(vdivu_vv_h, 2, 2)
452
-GEN_VEXT_VV(vdivu_vv_w, 4, 4)
453
-GEN_VEXT_VV(vdivu_vv_d, 8, 8)
454
-GEN_VEXT_VV(vdiv_vv_b, 1, 1)
455
-GEN_VEXT_VV(vdiv_vv_h, 2, 2)
456
-GEN_VEXT_VV(vdiv_vv_w, 4, 4)
457
-GEN_VEXT_VV(vdiv_vv_d, 8, 8)
458
-GEN_VEXT_VV(vremu_vv_b, 1, 1)
459
-GEN_VEXT_VV(vremu_vv_h, 2, 2)
460
-GEN_VEXT_VV(vremu_vv_w, 4, 4)
461
-GEN_VEXT_VV(vremu_vv_d, 8, 8)
462
-GEN_VEXT_VV(vrem_vv_b, 1, 1)
463
-GEN_VEXT_VV(vrem_vv_h, 2, 2)
464
-GEN_VEXT_VV(vrem_vv_w, 4, 4)
465
-GEN_VEXT_VV(vrem_vv_d, 8, 8)
466
+GEN_VEXT_VV(vdivu_vv_b)
467
+GEN_VEXT_VV(vdivu_vv_h)
468
+GEN_VEXT_VV(vdivu_vv_w)
469
+GEN_VEXT_VV(vdivu_vv_d)
470
+GEN_VEXT_VV(vdiv_vv_b)
471
+GEN_VEXT_VV(vdiv_vv_h)
472
+GEN_VEXT_VV(vdiv_vv_w)
473
+GEN_VEXT_VV(vdiv_vv_d)
474
+GEN_VEXT_VV(vremu_vv_b)
475
+GEN_VEXT_VV(vremu_vv_h)
476
+GEN_VEXT_VV(vremu_vv_w)
477
+GEN_VEXT_VV(vremu_vv_d)
478
+GEN_VEXT_VV(vrem_vv_b)
479
+GEN_VEXT_VV(vrem_vv_h)
480
+GEN_VEXT_VV(vrem_vv_w)
481
+GEN_VEXT_VV(vrem_vv_d)
482
483
RVVCALL(OPIVX2, vdivu_vx_b, OP_UUU_B, H1, H1, DO_DIVU)
484
RVVCALL(OPIVX2, vdivu_vx_h, OP_UUU_H, H2, H2, DO_DIVU)
485
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vrem_vx_b, OP_SSS_B, H1, H1, DO_REM)
486
RVVCALL(OPIVX2, vrem_vx_h, OP_SSS_H, H2, H2, DO_REM)
487
RVVCALL(OPIVX2, vrem_vx_w, OP_SSS_W, H4, H4, DO_REM)
488
RVVCALL(OPIVX2, vrem_vx_d, OP_SSS_D, H8, H8, DO_REM)
489
-GEN_VEXT_VX(vdivu_vx_b, 1, 1)
490
-GEN_VEXT_VX(vdivu_vx_h, 2, 2)
491
-GEN_VEXT_VX(vdivu_vx_w, 4, 4)
492
-GEN_VEXT_VX(vdivu_vx_d, 8, 8)
493
-GEN_VEXT_VX(vdiv_vx_b, 1, 1)
494
-GEN_VEXT_VX(vdiv_vx_h, 2, 2)
495
-GEN_VEXT_VX(vdiv_vx_w, 4, 4)
496
-GEN_VEXT_VX(vdiv_vx_d, 8, 8)
497
-GEN_VEXT_VX(vremu_vx_b, 1, 1)
498
-GEN_VEXT_VX(vremu_vx_h, 2, 2)
499
-GEN_VEXT_VX(vremu_vx_w, 4, 4)
500
-GEN_VEXT_VX(vremu_vx_d, 8, 8)
501
-GEN_VEXT_VX(vrem_vx_b, 1, 1)
502
-GEN_VEXT_VX(vrem_vx_h, 2, 2)
503
-GEN_VEXT_VX(vrem_vx_w, 4, 4)
504
-GEN_VEXT_VX(vrem_vx_d, 8, 8)
505
+GEN_VEXT_VX(vdivu_vx_b)
506
+GEN_VEXT_VX(vdivu_vx_h)
507
+GEN_VEXT_VX(vdivu_vx_w)
508
+GEN_VEXT_VX(vdivu_vx_d)
509
+GEN_VEXT_VX(vdiv_vx_b)
510
+GEN_VEXT_VX(vdiv_vx_h)
511
+GEN_VEXT_VX(vdiv_vx_w)
512
+GEN_VEXT_VX(vdiv_vx_d)
513
+GEN_VEXT_VX(vremu_vx_b)
514
+GEN_VEXT_VX(vremu_vx_h)
515
+GEN_VEXT_VX(vremu_vx_w)
516
+GEN_VEXT_VX(vremu_vx_d)
517
+GEN_VEXT_VX(vrem_vx_b)
518
+GEN_VEXT_VX(vrem_vx_h)
519
+GEN_VEXT_VX(vrem_vx_w)
520
+GEN_VEXT_VX(vrem_vx_d)
521
522
/* Vector Widening Integer Multiply Instructions */
523
RVVCALL(OPIVV2, vwmul_vv_b, WOP_SSS_B, H2, H1, H1, DO_MUL)
524
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vwmulu_vv_w, WOP_UUU_W, H8, H4, H4, DO_MUL)
525
RVVCALL(OPIVV2, vwmulsu_vv_b, WOP_SUS_B, H2, H1, H1, DO_MUL)
526
RVVCALL(OPIVV2, vwmulsu_vv_h, WOP_SUS_H, H4, H2, H2, DO_MUL)
527
RVVCALL(OPIVV2, vwmulsu_vv_w, WOP_SUS_W, H8, H4, H4, DO_MUL)
528
-GEN_VEXT_VV(vwmul_vv_b, 1, 2)
529
-GEN_VEXT_VV(vwmul_vv_h, 2, 4)
530
-GEN_VEXT_VV(vwmul_vv_w, 4, 8)
531
-GEN_VEXT_VV(vwmulu_vv_b, 1, 2)
532
-GEN_VEXT_VV(vwmulu_vv_h, 2, 4)
533
-GEN_VEXT_VV(vwmulu_vv_w, 4, 8)
534
-GEN_VEXT_VV(vwmulsu_vv_b, 1, 2)
535
-GEN_VEXT_VV(vwmulsu_vv_h, 2, 4)
536
-GEN_VEXT_VV(vwmulsu_vv_w, 4, 8)
537
+GEN_VEXT_VV(vwmul_vv_b)
538
+GEN_VEXT_VV(vwmul_vv_h)
539
+GEN_VEXT_VV(vwmul_vv_w)
540
+GEN_VEXT_VV(vwmulu_vv_b)
541
+GEN_VEXT_VV(vwmulu_vv_h)
542
+GEN_VEXT_VV(vwmulu_vv_w)
543
+GEN_VEXT_VV(vwmulsu_vv_b)
544
+GEN_VEXT_VV(vwmulsu_vv_h)
545
+GEN_VEXT_VV(vwmulsu_vv_w)
546
547
RVVCALL(OPIVX2, vwmul_vx_b, WOP_SSS_B, H2, H1, DO_MUL)
548
RVVCALL(OPIVX2, vwmul_vx_h, WOP_SSS_H, H4, H2, DO_MUL)
549
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vwmulu_vx_w, WOP_UUU_W, H8, H4, DO_MUL)
550
RVVCALL(OPIVX2, vwmulsu_vx_b, WOP_SUS_B, H2, H1, DO_MUL)
551
RVVCALL(OPIVX2, vwmulsu_vx_h, WOP_SUS_H, H4, H2, DO_MUL)
552
RVVCALL(OPIVX2, vwmulsu_vx_w, WOP_SUS_W, H8, H4, DO_MUL)
553
-GEN_VEXT_VX(vwmul_vx_b, 1, 2)
554
-GEN_VEXT_VX(vwmul_vx_h, 2, 4)
555
-GEN_VEXT_VX(vwmul_vx_w, 4, 8)
556
-GEN_VEXT_VX(vwmulu_vx_b, 1, 2)
557
-GEN_VEXT_VX(vwmulu_vx_h, 2, 4)
558
-GEN_VEXT_VX(vwmulu_vx_w, 4, 8)
559
-GEN_VEXT_VX(vwmulsu_vx_b, 1, 2)
560
-GEN_VEXT_VX(vwmulsu_vx_h, 2, 4)
561
-GEN_VEXT_VX(vwmulsu_vx_w, 4, 8)
562
+GEN_VEXT_VX(vwmul_vx_b)
563
+GEN_VEXT_VX(vwmul_vx_h)
564
+GEN_VEXT_VX(vwmul_vx_w)
565
+GEN_VEXT_VX(vwmulu_vx_b)
566
+GEN_VEXT_VX(vwmulu_vx_h)
567
+GEN_VEXT_VX(vwmulu_vx_w)
568
+GEN_VEXT_VX(vwmulsu_vx_b)
569
+GEN_VEXT_VX(vwmulsu_vx_h)
570
+GEN_VEXT_VX(vwmulsu_vx_w)
571
572
/* Vector Single-Width Integer Multiply-Add Instructions */
573
#define OPIVV3(NAME, TD, T1, T2, TX1, TX2, HD, HS1, HS2, OP) \
574
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV3, vnmsub_vv_b, OP_SSS_B, H1, H1, H1, DO_NMSUB)
575
RVVCALL(OPIVV3, vnmsub_vv_h, OP_SSS_H, H2, H2, H2, DO_NMSUB)
576
RVVCALL(OPIVV3, vnmsub_vv_w, OP_SSS_W, H4, H4, H4, DO_NMSUB)
577
RVVCALL(OPIVV3, vnmsub_vv_d, OP_SSS_D, H8, H8, H8, DO_NMSUB)
578
-GEN_VEXT_VV(vmacc_vv_b, 1, 1)
579
-GEN_VEXT_VV(vmacc_vv_h, 2, 2)
580
-GEN_VEXT_VV(vmacc_vv_w, 4, 4)
581
-GEN_VEXT_VV(vmacc_vv_d, 8, 8)
582
-GEN_VEXT_VV(vnmsac_vv_b, 1, 1)
583
-GEN_VEXT_VV(vnmsac_vv_h, 2, 2)
584
-GEN_VEXT_VV(vnmsac_vv_w, 4, 4)
585
-GEN_VEXT_VV(vnmsac_vv_d, 8, 8)
586
-GEN_VEXT_VV(vmadd_vv_b, 1, 1)
587
-GEN_VEXT_VV(vmadd_vv_h, 2, 2)
588
-GEN_VEXT_VV(vmadd_vv_w, 4, 4)
589
-GEN_VEXT_VV(vmadd_vv_d, 8, 8)
590
-GEN_VEXT_VV(vnmsub_vv_b, 1, 1)
591
-GEN_VEXT_VV(vnmsub_vv_h, 2, 2)
592
-GEN_VEXT_VV(vnmsub_vv_w, 4, 4)
593
-GEN_VEXT_VV(vnmsub_vv_d, 8, 8)
594
+GEN_VEXT_VV(vmacc_vv_b)
595
+GEN_VEXT_VV(vmacc_vv_h)
596
+GEN_VEXT_VV(vmacc_vv_w)
597
+GEN_VEXT_VV(vmacc_vv_d)
598
+GEN_VEXT_VV(vnmsac_vv_b)
599
+GEN_VEXT_VV(vnmsac_vv_h)
600
+GEN_VEXT_VV(vnmsac_vv_w)
601
+GEN_VEXT_VV(vnmsac_vv_d)
602
+GEN_VEXT_VV(vmadd_vv_b)
603
+GEN_VEXT_VV(vmadd_vv_h)
604
+GEN_VEXT_VV(vmadd_vv_w)
605
+GEN_VEXT_VV(vmadd_vv_d)
606
+GEN_VEXT_VV(vnmsub_vv_b)
607
+GEN_VEXT_VV(vnmsub_vv_h)
608
+GEN_VEXT_VV(vnmsub_vv_w)
609
+GEN_VEXT_VV(vnmsub_vv_d)
610
611
#define OPIVX3(NAME, TD, T1, T2, TX1, TX2, HD, HS2, OP) \
612
static void do_##NAME(void *vd, target_long s1, void *vs2, int i) \
613
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX3, vnmsub_vx_b, OP_SSS_B, H1, H1, DO_NMSUB)
614
RVVCALL(OPIVX3, vnmsub_vx_h, OP_SSS_H, H2, H2, DO_NMSUB)
615
RVVCALL(OPIVX3, vnmsub_vx_w, OP_SSS_W, H4, H4, DO_NMSUB)
616
RVVCALL(OPIVX3, vnmsub_vx_d, OP_SSS_D, H8, H8, DO_NMSUB)
617
-GEN_VEXT_VX(vmacc_vx_b, 1, 1)
618
-GEN_VEXT_VX(vmacc_vx_h, 2, 2)
619
-GEN_VEXT_VX(vmacc_vx_w, 4, 4)
620
-GEN_VEXT_VX(vmacc_vx_d, 8, 8)
621
-GEN_VEXT_VX(vnmsac_vx_b, 1, 1)
622
-GEN_VEXT_VX(vnmsac_vx_h, 2, 2)
623
-GEN_VEXT_VX(vnmsac_vx_w, 4, 4)
624
-GEN_VEXT_VX(vnmsac_vx_d, 8, 8)
625
-GEN_VEXT_VX(vmadd_vx_b, 1, 1)
626
-GEN_VEXT_VX(vmadd_vx_h, 2, 2)
627
-GEN_VEXT_VX(vmadd_vx_w, 4, 4)
628
-GEN_VEXT_VX(vmadd_vx_d, 8, 8)
629
-GEN_VEXT_VX(vnmsub_vx_b, 1, 1)
630
-GEN_VEXT_VX(vnmsub_vx_h, 2, 2)
631
-GEN_VEXT_VX(vnmsub_vx_w, 4, 4)
632
-GEN_VEXT_VX(vnmsub_vx_d, 8, 8)
633
+GEN_VEXT_VX(vmacc_vx_b)
634
+GEN_VEXT_VX(vmacc_vx_h)
635
+GEN_VEXT_VX(vmacc_vx_w)
636
+GEN_VEXT_VX(vmacc_vx_d)
637
+GEN_VEXT_VX(vnmsac_vx_b)
638
+GEN_VEXT_VX(vnmsac_vx_h)
639
+GEN_VEXT_VX(vnmsac_vx_w)
640
+GEN_VEXT_VX(vnmsac_vx_d)
641
+GEN_VEXT_VX(vmadd_vx_b)
642
+GEN_VEXT_VX(vmadd_vx_h)
643
+GEN_VEXT_VX(vmadd_vx_w)
644
+GEN_VEXT_VX(vmadd_vx_d)
645
+GEN_VEXT_VX(vnmsub_vx_b)
646
+GEN_VEXT_VX(vnmsub_vx_h)
647
+GEN_VEXT_VX(vnmsub_vx_w)
648
+GEN_VEXT_VX(vnmsub_vx_d)
649
650
/* Vector Widening Integer Multiply-Add Instructions */
651
RVVCALL(OPIVV3, vwmaccu_vv_b, WOP_UUU_B, H2, H1, H1, DO_MACC)
652
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV3, vwmacc_vv_w, WOP_SSS_W, H8, H4, H4, DO_MACC)
653
RVVCALL(OPIVV3, vwmaccsu_vv_b, WOP_SSU_B, H2, H1, H1, DO_MACC)
654
RVVCALL(OPIVV3, vwmaccsu_vv_h, WOP_SSU_H, H4, H2, H2, DO_MACC)
655
RVVCALL(OPIVV3, vwmaccsu_vv_w, WOP_SSU_W, H8, H4, H4, DO_MACC)
656
-GEN_VEXT_VV(vwmaccu_vv_b, 1, 2)
657
-GEN_VEXT_VV(vwmaccu_vv_h, 2, 4)
658
-GEN_VEXT_VV(vwmaccu_vv_w, 4, 8)
659
-GEN_VEXT_VV(vwmacc_vv_b, 1, 2)
660
-GEN_VEXT_VV(vwmacc_vv_h, 2, 4)
661
-GEN_VEXT_VV(vwmacc_vv_w, 4, 8)
662
-GEN_VEXT_VV(vwmaccsu_vv_b, 1, 2)
663
-GEN_VEXT_VV(vwmaccsu_vv_h, 2, 4)
664
-GEN_VEXT_VV(vwmaccsu_vv_w, 4, 8)
665
+GEN_VEXT_VV(vwmaccu_vv_b)
666
+GEN_VEXT_VV(vwmaccu_vv_h)
667
+GEN_VEXT_VV(vwmaccu_vv_w)
668
+GEN_VEXT_VV(vwmacc_vv_b)
669
+GEN_VEXT_VV(vwmacc_vv_h)
670
+GEN_VEXT_VV(vwmacc_vv_w)
671
+GEN_VEXT_VV(vwmaccsu_vv_b)
672
+GEN_VEXT_VV(vwmaccsu_vv_h)
673
+GEN_VEXT_VV(vwmaccsu_vv_w)
674
675
RVVCALL(OPIVX3, vwmaccu_vx_b, WOP_UUU_B, H2, H1, DO_MACC)
676
RVVCALL(OPIVX3, vwmaccu_vx_h, WOP_UUU_H, H4, H2, DO_MACC)
677
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX3, vwmaccsu_vx_w, WOP_SSU_W, H8, H4, DO_MACC)
678
RVVCALL(OPIVX3, vwmaccus_vx_b, WOP_SUS_B, H2, H1, DO_MACC)
679
RVVCALL(OPIVX3, vwmaccus_vx_h, WOP_SUS_H, H4, H2, DO_MACC)
680
RVVCALL(OPIVX3, vwmaccus_vx_w, WOP_SUS_W, H8, H4, DO_MACC)
681
-GEN_VEXT_VX(vwmaccu_vx_b, 1, 2)
682
-GEN_VEXT_VX(vwmaccu_vx_h, 2, 4)
683
-GEN_VEXT_VX(vwmaccu_vx_w, 4, 8)
684
-GEN_VEXT_VX(vwmacc_vx_b, 1, 2)
685
-GEN_VEXT_VX(vwmacc_vx_h, 2, 4)
686
-GEN_VEXT_VX(vwmacc_vx_w, 4, 8)
687
-GEN_VEXT_VX(vwmaccsu_vx_b, 1, 2)
688
-GEN_VEXT_VX(vwmaccsu_vx_h, 2, 4)
689
-GEN_VEXT_VX(vwmaccsu_vx_w, 4, 8)
690
-GEN_VEXT_VX(vwmaccus_vx_b, 1, 2)
691
-GEN_VEXT_VX(vwmaccus_vx_h, 2, 4)
692
-GEN_VEXT_VX(vwmaccus_vx_w, 4, 8)
693
+GEN_VEXT_VX(vwmaccu_vx_b)
694
+GEN_VEXT_VX(vwmaccu_vx_h)
695
+GEN_VEXT_VX(vwmaccu_vx_w)
696
+GEN_VEXT_VX(vwmacc_vx_b)
697
+GEN_VEXT_VX(vwmacc_vx_h)
698
+GEN_VEXT_VX(vwmacc_vx_w)
699
+GEN_VEXT_VX(vwmaccsu_vx_b)
700
+GEN_VEXT_VX(vwmaccsu_vx_h)
701
+GEN_VEXT_VX(vwmaccsu_vx_w)
702
+GEN_VEXT_VX(vwmaccus_vx_b)
703
+GEN_VEXT_VX(vwmaccus_vx_h)
704
+GEN_VEXT_VX(vwmaccus_vx_w)
705
706
/* Vector Integer Merge and Move Instructions */
707
#define GEN_VEXT_VMV_VV(NAME, ETYPE, H) \
708
@@ -XXX,XX +XXX,XX @@ vext_vv_rm_1(void *vd, void *v0, void *vs1, void *vs2,
709
static inline void
710
vext_vv_rm_2(void *vd, void *v0, void *vs1, void *vs2,
711
CPURISCVState *env,
712
- uint32_t desc, uint32_t esz, uint32_t dsz,
713
+ uint32_t desc,
714
opivv2_rm_fn *fn)
715
{
716
uint32_t vm = vext_vm(desc);
717
@@ -XXX,XX +XXX,XX @@ vext_vv_rm_2(void *vd, void *v0, void *vs1, void *vs2,
718
}
719
720
/* generate helpers for fixed point instructions with OPIVV format */
721
-#define GEN_VEXT_VV_RM(NAME, ESZ, DSZ) \
722
+#define GEN_VEXT_VV_RM(NAME) \
723
void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
724
CPURISCVState *env, uint32_t desc) \
725
{ \
726
- vext_vv_rm_2(vd, v0, vs1, vs2, env, desc, ESZ, DSZ, \
727
+ vext_vv_rm_2(vd, v0, vs1, vs2, env, desc, \
728
do_##NAME); \
729
}
730
731
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vsaddu_vv_b, OP_UUU_B, H1, H1, H1, saddu8)
732
RVVCALL(OPIVV2_RM, vsaddu_vv_h, OP_UUU_H, H2, H2, H2, saddu16)
733
RVVCALL(OPIVV2_RM, vsaddu_vv_w, OP_UUU_W, H4, H4, H4, saddu32)
734
RVVCALL(OPIVV2_RM, vsaddu_vv_d, OP_UUU_D, H8, H8, H8, saddu64)
735
-GEN_VEXT_VV_RM(vsaddu_vv_b, 1, 1)
736
-GEN_VEXT_VV_RM(vsaddu_vv_h, 2, 2)
737
-GEN_VEXT_VV_RM(vsaddu_vv_w, 4, 4)
738
-GEN_VEXT_VV_RM(vsaddu_vv_d, 8, 8)
739
+GEN_VEXT_VV_RM(vsaddu_vv_b)
740
+GEN_VEXT_VV_RM(vsaddu_vv_h)
741
+GEN_VEXT_VV_RM(vsaddu_vv_w)
742
+GEN_VEXT_VV_RM(vsaddu_vv_d)
743
744
typedef void opivx2_rm_fn(void *vd, target_long s1, void *vs2, int i,
745
CPURISCVState *env, int vxrm);
746
@@ -XXX,XX +XXX,XX @@ vext_vx_rm_1(void *vd, void *v0, target_long s1, void *vs2,
747
static inline void
748
vext_vx_rm_2(void *vd, void *v0, target_long s1, void *vs2,
749
CPURISCVState *env,
750
- uint32_t desc, uint32_t esz, uint32_t dsz,
751
+ uint32_t desc,
752
opivx2_rm_fn *fn)
753
{
754
uint32_t vm = vext_vm(desc);
755
@@ -XXX,XX +XXX,XX @@ vext_vx_rm_2(void *vd, void *v0, target_long s1, void *vs2,
756
}
757
758
/* generate helpers for fixed point instructions with OPIVX format */
759
-#define GEN_VEXT_VX_RM(NAME, ESZ, DSZ) \
760
+#define GEN_VEXT_VX_RM(NAME) \
761
void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
762
void *vs2, CPURISCVState *env, uint32_t desc) \
763
{ \
764
- vext_vx_rm_2(vd, v0, s1, vs2, env, desc, ESZ, DSZ, \
765
+ vext_vx_rm_2(vd, v0, s1, vs2, env, desc, \
766
do_##NAME); \
767
}
768
769
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2_RM, vsaddu_vx_b, OP_UUU_B, H1, H1, saddu8)
770
RVVCALL(OPIVX2_RM, vsaddu_vx_h, OP_UUU_H, H2, H2, saddu16)
771
RVVCALL(OPIVX2_RM, vsaddu_vx_w, OP_UUU_W, H4, H4, saddu32)
772
RVVCALL(OPIVX2_RM, vsaddu_vx_d, OP_UUU_D, H8, H8, saddu64)
773
-GEN_VEXT_VX_RM(vsaddu_vx_b, 1, 1)
774
-GEN_VEXT_VX_RM(vsaddu_vx_h, 2, 2)
775
-GEN_VEXT_VX_RM(vsaddu_vx_w, 4, 4)
776
-GEN_VEXT_VX_RM(vsaddu_vx_d, 8, 8)
777
+GEN_VEXT_VX_RM(vsaddu_vx_b)
778
+GEN_VEXT_VX_RM(vsaddu_vx_h)
779
+GEN_VEXT_VX_RM(vsaddu_vx_w)
780
+GEN_VEXT_VX_RM(vsaddu_vx_d)
781
782
static inline int8_t sadd8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
783
{
784
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vsadd_vv_b, OP_SSS_B, H1, H1, H1, sadd8)
785
RVVCALL(OPIVV2_RM, vsadd_vv_h, OP_SSS_H, H2, H2, H2, sadd16)
786
RVVCALL(OPIVV2_RM, vsadd_vv_w, OP_SSS_W, H4, H4, H4, sadd32)
787
RVVCALL(OPIVV2_RM, vsadd_vv_d, OP_SSS_D, H8, H8, H8, sadd64)
788
-GEN_VEXT_VV_RM(vsadd_vv_b, 1, 1)
789
-GEN_VEXT_VV_RM(vsadd_vv_h, 2, 2)
790
-GEN_VEXT_VV_RM(vsadd_vv_w, 4, 4)
791
-GEN_VEXT_VV_RM(vsadd_vv_d, 8, 8)
792
+GEN_VEXT_VV_RM(vsadd_vv_b)
793
+GEN_VEXT_VV_RM(vsadd_vv_h)
794
+GEN_VEXT_VV_RM(vsadd_vv_w)
795
+GEN_VEXT_VV_RM(vsadd_vv_d)
796
797
RVVCALL(OPIVX2_RM, vsadd_vx_b, OP_SSS_B, H1, H1, sadd8)
798
RVVCALL(OPIVX2_RM, vsadd_vx_h, OP_SSS_H, H2, H2, sadd16)
799
RVVCALL(OPIVX2_RM, vsadd_vx_w, OP_SSS_W, H4, H4, sadd32)
800
RVVCALL(OPIVX2_RM, vsadd_vx_d, OP_SSS_D, H8, H8, sadd64)
801
-GEN_VEXT_VX_RM(vsadd_vx_b, 1, 1)
802
-GEN_VEXT_VX_RM(vsadd_vx_h, 2, 2)
803
-GEN_VEXT_VX_RM(vsadd_vx_w, 4, 4)
804
-GEN_VEXT_VX_RM(vsadd_vx_d, 8, 8)
805
+GEN_VEXT_VX_RM(vsadd_vx_b)
806
+GEN_VEXT_VX_RM(vsadd_vx_h)
807
+GEN_VEXT_VX_RM(vsadd_vx_w)
808
+GEN_VEXT_VX_RM(vsadd_vx_d)
809
810
static inline uint8_t ssubu8(CPURISCVState *env, int vxrm, uint8_t a, uint8_t b)
811
{
812
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssubu_vv_b, OP_UUU_B, H1, H1, H1, ssubu8)
813
RVVCALL(OPIVV2_RM, vssubu_vv_h, OP_UUU_H, H2, H2, H2, ssubu16)
814
RVVCALL(OPIVV2_RM, vssubu_vv_w, OP_UUU_W, H4, H4, H4, ssubu32)
815
RVVCALL(OPIVV2_RM, vssubu_vv_d, OP_UUU_D, H8, H8, H8, ssubu64)
816
-GEN_VEXT_VV_RM(vssubu_vv_b, 1, 1)
817
-GEN_VEXT_VV_RM(vssubu_vv_h, 2, 2)
818
-GEN_VEXT_VV_RM(vssubu_vv_w, 4, 4)
819
-GEN_VEXT_VV_RM(vssubu_vv_d, 8, 8)
820
+GEN_VEXT_VV_RM(vssubu_vv_b)
821
+GEN_VEXT_VV_RM(vssubu_vv_h)
822
+GEN_VEXT_VV_RM(vssubu_vv_w)
823
+GEN_VEXT_VV_RM(vssubu_vv_d)
824
825
RVVCALL(OPIVX2_RM, vssubu_vx_b, OP_UUU_B, H1, H1, ssubu8)
826
RVVCALL(OPIVX2_RM, vssubu_vx_h, OP_UUU_H, H2, H2, ssubu16)
827
RVVCALL(OPIVX2_RM, vssubu_vx_w, OP_UUU_W, H4, H4, ssubu32)
828
RVVCALL(OPIVX2_RM, vssubu_vx_d, OP_UUU_D, H8, H8, ssubu64)
829
-GEN_VEXT_VX_RM(vssubu_vx_b, 1, 1)
830
-GEN_VEXT_VX_RM(vssubu_vx_h, 2, 2)
831
-GEN_VEXT_VX_RM(vssubu_vx_w, 4, 4)
832
-GEN_VEXT_VX_RM(vssubu_vx_d, 8, 8)
833
+GEN_VEXT_VX_RM(vssubu_vx_b)
834
+GEN_VEXT_VX_RM(vssubu_vx_h)
835
+GEN_VEXT_VX_RM(vssubu_vx_w)
836
+GEN_VEXT_VX_RM(vssubu_vx_d)
837
838
static inline int8_t ssub8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
839
{
840
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssub_vv_b, OP_SSS_B, H1, H1, H1, ssub8)
841
RVVCALL(OPIVV2_RM, vssub_vv_h, OP_SSS_H, H2, H2, H2, ssub16)
842
RVVCALL(OPIVV2_RM, vssub_vv_w, OP_SSS_W, H4, H4, H4, ssub32)
843
RVVCALL(OPIVV2_RM, vssub_vv_d, OP_SSS_D, H8, H8, H8, ssub64)
844
-GEN_VEXT_VV_RM(vssub_vv_b, 1, 1)
845
-GEN_VEXT_VV_RM(vssub_vv_h, 2, 2)
846
-GEN_VEXT_VV_RM(vssub_vv_w, 4, 4)
847
-GEN_VEXT_VV_RM(vssub_vv_d, 8, 8)
848
+GEN_VEXT_VV_RM(vssub_vv_b)
849
+GEN_VEXT_VV_RM(vssub_vv_h)
850
+GEN_VEXT_VV_RM(vssub_vv_w)
851
+GEN_VEXT_VV_RM(vssub_vv_d)
852
853
RVVCALL(OPIVX2_RM, vssub_vx_b, OP_SSS_B, H1, H1, ssub8)
854
RVVCALL(OPIVX2_RM, vssub_vx_h, OP_SSS_H, H2, H2, ssub16)
855
RVVCALL(OPIVX2_RM, vssub_vx_w, OP_SSS_W, H4, H4, ssub32)
856
RVVCALL(OPIVX2_RM, vssub_vx_d, OP_SSS_D, H8, H8, ssub64)
857
-GEN_VEXT_VX_RM(vssub_vx_b, 1, 1)
858
-GEN_VEXT_VX_RM(vssub_vx_h, 2, 2)
859
-GEN_VEXT_VX_RM(vssub_vx_w, 4, 4)
860
-GEN_VEXT_VX_RM(vssub_vx_d, 8, 8)
861
+GEN_VEXT_VX_RM(vssub_vx_b)
862
+GEN_VEXT_VX_RM(vssub_vx_h)
863
+GEN_VEXT_VX_RM(vssub_vx_w)
864
+GEN_VEXT_VX_RM(vssub_vx_d)
865
866
/* Vector Single-Width Averaging Add and Subtract */
867
static inline uint8_t get_round(int vxrm, uint64_t v, uint8_t shift)
868
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vaadd_vv_b, OP_SSS_B, H1, H1, H1, aadd32)
869
RVVCALL(OPIVV2_RM, vaadd_vv_h, OP_SSS_H, H2, H2, H2, aadd32)
870
RVVCALL(OPIVV2_RM, vaadd_vv_w, OP_SSS_W, H4, H4, H4, aadd32)
871
RVVCALL(OPIVV2_RM, vaadd_vv_d, OP_SSS_D, H8, H8, H8, aadd64)
872
-GEN_VEXT_VV_RM(vaadd_vv_b, 1, 1)
873
-GEN_VEXT_VV_RM(vaadd_vv_h, 2, 2)
874
-GEN_VEXT_VV_RM(vaadd_vv_w, 4, 4)
875
-GEN_VEXT_VV_RM(vaadd_vv_d, 8, 8)
876
+GEN_VEXT_VV_RM(vaadd_vv_b)
877
+GEN_VEXT_VV_RM(vaadd_vv_h)
878
+GEN_VEXT_VV_RM(vaadd_vv_w)
879
+GEN_VEXT_VV_RM(vaadd_vv_d)
880
881
RVVCALL(OPIVX2_RM, vaadd_vx_b, OP_SSS_B, H1, H1, aadd32)
882
RVVCALL(OPIVX2_RM, vaadd_vx_h, OP_SSS_H, H2, H2, aadd32)
883
RVVCALL(OPIVX2_RM, vaadd_vx_w, OP_SSS_W, H4, H4, aadd32)
884
RVVCALL(OPIVX2_RM, vaadd_vx_d, OP_SSS_D, H8, H8, aadd64)
885
-GEN_VEXT_VX_RM(vaadd_vx_b, 1, 1)
886
-GEN_VEXT_VX_RM(vaadd_vx_h, 2, 2)
887
-GEN_VEXT_VX_RM(vaadd_vx_w, 4, 4)
888
-GEN_VEXT_VX_RM(vaadd_vx_d, 8, 8)
889
+GEN_VEXT_VX_RM(vaadd_vx_b)
890
+GEN_VEXT_VX_RM(vaadd_vx_h)
891
+GEN_VEXT_VX_RM(vaadd_vx_w)
892
+GEN_VEXT_VX_RM(vaadd_vx_d)
893
894
static inline uint32_t aaddu32(CPURISCVState *env, int vxrm,
895
uint32_t a, uint32_t b)
896
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vaaddu_vv_b, OP_UUU_B, H1, H1, H1, aaddu32)
897
RVVCALL(OPIVV2_RM, vaaddu_vv_h, OP_UUU_H, H2, H2, H2, aaddu32)
898
RVVCALL(OPIVV2_RM, vaaddu_vv_w, OP_UUU_W, H4, H4, H4, aaddu32)
899
RVVCALL(OPIVV2_RM, vaaddu_vv_d, OP_UUU_D, H8, H8, H8, aaddu64)
900
-GEN_VEXT_VV_RM(vaaddu_vv_b, 1, 1)
901
-GEN_VEXT_VV_RM(vaaddu_vv_h, 2, 2)
902
-GEN_VEXT_VV_RM(vaaddu_vv_w, 4, 4)
903
-GEN_VEXT_VV_RM(vaaddu_vv_d, 8, 8)
904
+GEN_VEXT_VV_RM(vaaddu_vv_b)
905
+GEN_VEXT_VV_RM(vaaddu_vv_h)
906
+GEN_VEXT_VV_RM(vaaddu_vv_w)
907
+GEN_VEXT_VV_RM(vaaddu_vv_d)
908
909
RVVCALL(OPIVX2_RM, vaaddu_vx_b, OP_UUU_B, H1, H1, aaddu32)
910
RVVCALL(OPIVX2_RM, vaaddu_vx_h, OP_UUU_H, H2, H2, aaddu32)
911
RVVCALL(OPIVX2_RM, vaaddu_vx_w, OP_UUU_W, H4, H4, aaddu32)
912
RVVCALL(OPIVX2_RM, vaaddu_vx_d, OP_UUU_D, H8, H8, aaddu64)
913
-GEN_VEXT_VX_RM(vaaddu_vx_b, 1, 1)
914
-GEN_VEXT_VX_RM(vaaddu_vx_h, 2, 2)
915
-GEN_VEXT_VX_RM(vaaddu_vx_w, 4, 4)
916
-GEN_VEXT_VX_RM(vaaddu_vx_d, 8, 8)
917
+GEN_VEXT_VX_RM(vaaddu_vx_b)
918
+GEN_VEXT_VX_RM(vaaddu_vx_h)
919
+GEN_VEXT_VX_RM(vaaddu_vx_w)
920
+GEN_VEXT_VX_RM(vaaddu_vx_d)
921
922
static inline int32_t asub32(CPURISCVState *env, int vxrm, int32_t a, int32_t b)
923
{
924
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vasub_vv_b, OP_SSS_B, H1, H1, H1, asub32)
925
RVVCALL(OPIVV2_RM, vasub_vv_h, OP_SSS_H, H2, H2, H2, asub32)
926
RVVCALL(OPIVV2_RM, vasub_vv_w, OP_SSS_W, H4, H4, H4, asub32)
927
RVVCALL(OPIVV2_RM, vasub_vv_d, OP_SSS_D, H8, H8, H8, asub64)
928
-GEN_VEXT_VV_RM(vasub_vv_b, 1, 1)
929
-GEN_VEXT_VV_RM(vasub_vv_h, 2, 2)
930
-GEN_VEXT_VV_RM(vasub_vv_w, 4, 4)
931
-GEN_VEXT_VV_RM(vasub_vv_d, 8, 8)
932
+GEN_VEXT_VV_RM(vasub_vv_b)
933
+GEN_VEXT_VV_RM(vasub_vv_h)
934
+GEN_VEXT_VV_RM(vasub_vv_w)
935
+GEN_VEXT_VV_RM(vasub_vv_d)
936
937
RVVCALL(OPIVX2_RM, vasub_vx_b, OP_SSS_B, H1, H1, asub32)
938
RVVCALL(OPIVX2_RM, vasub_vx_h, OP_SSS_H, H2, H2, asub32)
939
RVVCALL(OPIVX2_RM, vasub_vx_w, OP_SSS_W, H4, H4, asub32)
940
RVVCALL(OPIVX2_RM, vasub_vx_d, OP_SSS_D, H8, H8, asub64)
941
-GEN_VEXT_VX_RM(vasub_vx_b, 1, 1)
942
-GEN_VEXT_VX_RM(vasub_vx_h, 2, 2)
943
-GEN_VEXT_VX_RM(vasub_vx_w, 4, 4)
944
-GEN_VEXT_VX_RM(vasub_vx_d, 8, 8)
945
+GEN_VEXT_VX_RM(vasub_vx_b)
946
+GEN_VEXT_VX_RM(vasub_vx_h)
947
+GEN_VEXT_VX_RM(vasub_vx_w)
948
+GEN_VEXT_VX_RM(vasub_vx_d)
949
950
static inline uint32_t asubu32(CPURISCVState *env, int vxrm,
951
uint32_t a, uint32_t b)
952
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vasubu_vv_b, OP_UUU_B, H1, H1, H1, asubu32)
953
RVVCALL(OPIVV2_RM, vasubu_vv_h, OP_UUU_H, H2, H2, H2, asubu32)
954
RVVCALL(OPIVV2_RM, vasubu_vv_w, OP_UUU_W, H4, H4, H4, asubu32)
955
RVVCALL(OPIVV2_RM, vasubu_vv_d, OP_UUU_D, H8, H8, H8, asubu64)
956
-GEN_VEXT_VV_RM(vasubu_vv_b, 1, 1)
957
-GEN_VEXT_VV_RM(vasubu_vv_h, 2, 2)
958
-GEN_VEXT_VV_RM(vasubu_vv_w, 4, 4)
959
-GEN_VEXT_VV_RM(vasubu_vv_d, 8, 8)
960
+GEN_VEXT_VV_RM(vasubu_vv_b)
961
+GEN_VEXT_VV_RM(vasubu_vv_h)
962
+GEN_VEXT_VV_RM(vasubu_vv_w)
963
+GEN_VEXT_VV_RM(vasubu_vv_d)
964
965
RVVCALL(OPIVX2_RM, vasubu_vx_b, OP_UUU_B, H1, H1, asubu32)
966
RVVCALL(OPIVX2_RM, vasubu_vx_h, OP_UUU_H, H2, H2, asubu32)
967
RVVCALL(OPIVX2_RM, vasubu_vx_w, OP_UUU_W, H4, H4, asubu32)
968
RVVCALL(OPIVX2_RM, vasubu_vx_d, OP_UUU_D, H8, H8, asubu64)
969
-GEN_VEXT_VX_RM(vasubu_vx_b, 1, 1)
970
-GEN_VEXT_VX_RM(vasubu_vx_h, 2, 2)
971
-GEN_VEXT_VX_RM(vasubu_vx_w, 4, 4)
972
-GEN_VEXT_VX_RM(vasubu_vx_d, 8, 8)
973
+GEN_VEXT_VX_RM(vasubu_vx_b)
974
+GEN_VEXT_VX_RM(vasubu_vx_h)
975
+GEN_VEXT_VX_RM(vasubu_vx_w)
976
+GEN_VEXT_VX_RM(vasubu_vx_d)
977
978
/* Vector Single-Width Fractional Multiply with Rounding and Saturation */
979
static inline int8_t vsmul8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
980
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vsmul_vv_b, OP_SSS_B, H1, H1, H1, vsmul8)
981
RVVCALL(OPIVV2_RM, vsmul_vv_h, OP_SSS_H, H2, H2, H2, vsmul16)
982
RVVCALL(OPIVV2_RM, vsmul_vv_w, OP_SSS_W, H4, H4, H4, vsmul32)
983
RVVCALL(OPIVV2_RM, vsmul_vv_d, OP_SSS_D, H8, H8, H8, vsmul64)
984
-GEN_VEXT_VV_RM(vsmul_vv_b, 1, 1)
985
-GEN_VEXT_VV_RM(vsmul_vv_h, 2, 2)
986
-GEN_VEXT_VV_RM(vsmul_vv_w, 4, 4)
987
-GEN_VEXT_VV_RM(vsmul_vv_d, 8, 8)
988
+GEN_VEXT_VV_RM(vsmul_vv_b)
989
+GEN_VEXT_VV_RM(vsmul_vv_h)
990
+GEN_VEXT_VV_RM(vsmul_vv_w)
991
+GEN_VEXT_VV_RM(vsmul_vv_d)
992
993
RVVCALL(OPIVX2_RM, vsmul_vx_b, OP_SSS_B, H1, H1, vsmul8)
994
RVVCALL(OPIVX2_RM, vsmul_vx_h, OP_SSS_H, H2, H2, vsmul16)
995
RVVCALL(OPIVX2_RM, vsmul_vx_w, OP_SSS_W, H4, H4, vsmul32)
996
RVVCALL(OPIVX2_RM, vsmul_vx_d, OP_SSS_D, H8, H8, vsmul64)
997
-GEN_VEXT_VX_RM(vsmul_vx_b, 1, 1)
998
-GEN_VEXT_VX_RM(vsmul_vx_h, 2, 2)
999
-GEN_VEXT_VX_RM(vsmul_vx_w, 4, 4)
1000
-GEN_VEXT_VX_RM(vsmul_vx_d, 8, 8)
1001
+GEN_VEXT_VX_RM(vsmul_vx_b)
1002
+GEN_VEXT_VX_RM(vsmul_vx_h)
1003
+GEN_VEXT_VX_RM(vsmul_vx_w)
1004
+GEN_VEXT_VX_RM(vsmul_vx_d)
1005
1006
/* Vector Single-Width Scaling Shift Instructions */
1007
static inline uint8_t
1008
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssrl_vv_b, OP_UUU_B, H1, H1, H1, vssrl8)
1009
RVVCALL(OPIVV2_RM, vssrl_vv_h, OP_UUU_H, H2, H2, H2, vssrl16)
1010
RVVCALL(OPIVV2_RM, vssrl_vv_w, OP_UUU_W, H4, H4, H4, vssrl32)
1011
RVVCALL(OPIVV2_RM, vssrl_vv_d, OP_UUU_D, H8, H8, H8, vssrl64)
1012
-GEN_VEXT_VV_RM(vssrl_vv_b, 1, 1)
1013
-GEN_VEXT_VV_RM(vssrl_vv_h, 2, 2)
1014
-GEN_VEXT_VV_RM(vssrl_vv_w, 4, 4)
1015
-GEN_VEXT_VV_RM(vssrl_vv_d, 8, 8)
1016
+GEN_VEXT_VV_RM(vssrl_vv_b)
1017
+GEN_VEXT_VV_RM(vssrl_vv_h)
1018
+GEN_VEXT_VV_RM(vssrl_vv_w)
1019
+GEN_VEXT_VV_RM(vssrl_vv_d)
1020
1021
RVVCALL(OPIVX2_RM, vssrl_vx_b, OP_UUU_B, H1, H1, vssrl8)
1022
RVVCALL(OPIVX2_RM, vssrl_vx_h, OP_UUU_H, H2, H2, vssrl16)
1023
RVVCALL(OPIVX2_RM, vssrl_vx_w, OP_UUU_W, H4, H4, vssrl32)
1024
RVVCALL(OPIVX2_RM, vssrl_vx_d, OP_UUU_D, H8, H8, vssrl64)
1025
-GEN_VEXT_VX_RM(vssrl_vx_b, 1, 1)
1026
-GEN_VEXT_VX_RM(vssrl_vx_h, 2, 2)
1027
-GEN_VEXT_VX_RM(vssrl_vx_w, 4, 4)
1028
-GEN_VEXT_VX_RM(vssrl_vx_d, 8, 8)
1029
+GEN_VEXT_VX_RM(vssrl_vx_b)
1030
+GEN_VEXT_VX_RM(vssrl_vx_h)
1031
+GEN_VEXT_VX_RM(vssrl_vx_w)
1032
+GEN_VEXT_VX_RM(vssrl_vx_d)
1033
1034
static inline int8_t
1035
vssra8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
1036
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssra_vv_b, OP_SSS_B, H1, H1, H1, vssra8)
1037
RVVCALL(OPIVV2_RM, vssra_vv_h, OP_SSS_H, H2, H2, H2, vssra16)
1038
RVVCALL(OPIVV2_RM, vssra_vv_w, OP_SSS_W, H4, H4, H4, vssra32)
1039
RVVCALL(OPIVV2_RM, vssra_vv_d, OP_SSS_D, H8, H8, H8, vssra64)
1040
-GEN_VEXT_VV_RM(vssra_vv_b, 1, 1)
1041
-GEN_VEXT_VV_RM(vssra_vv_h, 2, 2)
1042
-GEN_VEXT_VV_RM(vssra_vv_w, 4, 4)
1043
-GEN_VEXT_VV_RM(vssra_vv_d, 8, 8)
1044
+GEN_VEXT_VV_RM(vssra_vv_b)
1045
+GEN_VEXT_VV_RM(vssra_vv_h)
1046
+GEN_VEXT_VV_RM(vssra_vv_w)
1047
+GEN_VEXT_VV_RM(vssra_vv_d)
1048
1049
RVVCALL(OPIVX2_RM, vssra_vx_b, OP_SSS_B, H1, H1, vssra8)
1050
RVVCALL(OPIVX2_RM, vssra_vx_h, OP_SSS_H, H2, H2, vssra16)
1051
RVVCALL(OPIVX2_RM, vssra_vx_w, OP_SSS_W, H4, H4, vssra32)
1052
RVVCALL(OPIVX2_RM, vssra_vx_d, OP_SSS_D, H8, H8, vssra64)
1053
-GEN_VEXT_VX_RM(vssra_vx_b, 1, 1)
1054
-GEN_VEXT_VX_RM(vssra_vx_h, 2, 2)
1055
-GEN_VEXT_VX_RM(vssra_vx_w, 4, 4)
1056
-GEN_VEXT_VX_RM(vssra_vx_d, 8, 8)
1057
+GEN_VEXT_VX_RM(vssra_vx_b)
1058
+GEN_VEXT_VX_RM(vssra_vx_h)
1059
+GEN_VEXT_VX_RM(vssra_vx_w)
1060
+GEN_VEXT_VX_RM(vssra_vx_d)
1061
1062
/* Vector Narrowing Fixed-Point Clip Instructions */
1063
static inline int8_t
1064
@@ -XXX,XX +XXX,XX @@ vnclip32(CPURISCVState *env, int vxrm, int64_t a, int32_t b)
1065
RVVCALL(OPIVV2_RM, vnclip_wv_b, NOP_SSS_B, H1, H2, H1, vnclip8)
1066
RVVCALL(OPIVV2_RM, vnclip_wv_h, NOP_SSS_H, H2, H4, H2, vnclip16)
1067
RVVCALL(OPIVV2_RM, vnclip_wv_w, NOP_SSS_W, H4, H8, H4, vnclip32)
1068
-GEN_VEXT_VV_RM(vnclip_wv_b, 1, 1)
1069
-GEN_VEXT_VV_RM(vnclip_wv_h, 2, 2)
1070
-GEN_VEXT_VV_RM(vnclip_wv_w, 4, 4)
1071
+GEN_VEXT_VV_RM(vnclip_wv_b)
1072
+GEN_VEXT_VV_RM(vnclip_wv_h)
1073
+GEN_VEXT_VV_RM(vnclip_wv_w)
1074
1075
RVVCALL(OPIVX2_RM, vnclip_wx_b, NOP_SSS_B, H1, H2, vnclip8)
1076
RVVCALL(OPIVX2_RM, vnclip_wx_h, NOP_SSS_H, H2, H4, vnclip16)
1077
RVVCALL(OPIVX2_RM, vnclip_wx_w, NOP_SSS_W, H4, H8, vnclip32)
1078
-GEN_VEXT_VX_RM(vnclip_wx_b, 1, 1)
1079
-GEN_VEXT_VX_RM(vnclip_wx_h, 2, 2)
1080
-GEN_VEXT_VX_RM(vnclip_wx_w, 4, 4)
1081
+GEN_VEXT_VX_RM(vnclip_wx_b)
1082
+GEN_VEXT_VX_RM(vnclip_wx_h)
1083
+GEN_VEXT_VX_RM(vnclip_wx_w)
1084
1085
static inline uint8_t
1086
vnclipu8(CPURISCVState *env, int vxrm, uint16_t a, uint8_t b)
1087
@@ -XXX,XX +XXX,XX @@ vnclipu32(CPURISCVState *env, int vxrm, uint64_t a, uint32_t b)
1088
RVVCALL(OPIVV2_RM, vnclipu_wv_b, NOP_UUU_B, H1, H2, H1, vnclipu8)
1089
RVVCALL(OPIVV2_RM, vnclipu_wv_h, NOP_UUU_H, H2, H4, H2, vnclipu16)
1090
RVVCALL(OPIVV2_RM, vnclipu_wv_w, NOP_UUU_W, H4, H8, H4, vnclipu32)
1091
-GEN_VEXT_VV_RM(vnclipu_wv_b, 1, 1)
1092
-GEN_VEXT_VV_RM(vnclipu_wv_h, 2, 2)
1093
-GEN_VEXT_VV_RM(vnclipu_wv_w, 4, 4)
1094
+GEN_VEXT_VV_RM(vnclipu_wv_b)
1095
+GEN_VEXT_VV_RM(vnclipu_wv_h)
1096
+GEN_VEXT_VV_RM(vnclipu_wv_w)
1097
1098
RVVCALL(OPIVX2_RM, vnclipu_wx_b, NOP_UUU_B, H1, H2, vnclipu8)
1099
RVVCALL(OPIVX2_RM, vnclipu_wx_h, NOP_UUU_H, H2, H4, vnclipu16)
1100
RVVCALL(OPIVX2_RM, vnclipu_wx_w, NOP_UUU_W, H4, H8, vnclipu32)
1101
-GEN_VEXT_VX_RM(vnclipu_wx_b, 1, 1)
1102
-GEN_VEXT_VX_RM(vnclipu_wx_h, 2, 2)
1103
-GEN_VEXT_VX_RM(vnclipu_wx_w, 4, 4)
1104
+GEN_VEXT_VX_RM(vnclipu_wx_b)
1105
+GEN_VEXT_VX_RM(vnclipu_wx_h)
1106
+GEN_VEXT_VX_RM(vnclipu_wx_w)
1107
1108
/*
1109
*** Vector Float Point Arithmetic Instructions
1110
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, void *vs1, void *vs2, int i, \
1111
*((TD *)vd + HD(i)) = OP(s2, s1, &env->fp_status); \
1112
}
1113
1114
-#define GEN_VEXT_VV_ENV(NAME, ESZ, DSZ) \
1115
+#define GEN_VEXT_VV_ENV(NAME) \
1116
void HELPER(NAME)(void *vd, void *v0, void *vs1, \
1117
void *vs2, CPURISCVState *env, \
1118
uint32_t desc) \
1119
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
1120
RVVCALL(OPFVV2, vfadd_vv_h, OP_UUU_H, H2, H2, H2, float16_add)
1121
RVVCALL(OPFVV2, vfadd_vv_w, OP_UUU_W, H4, H4, H4, float32_add)
1122
RVVCALL(OPFVV2, vfadd_vv_d, OP_UUU_D, H8, H8, H8, float64_add)
1123
-GEN_VEXT_VV_ENV(vfadd_vv_h, 2, 2)
1124
-GEN_VEXT_VV_ENV(vfadd_vv_w, 4, 4)
1125
-GEN_VEXT_VV_ENV(vfadd_vv_d, 8, 8)
1126
+GEN_VEXT_VV_ENV(vfadd_vv_h)
1127
+GEN_VEXT_VV_ENV(vfadd_vv_w)
1128
+GEN_VEXT_VV_ENV(vfadd_vv_d)
1129
1130
#define OPFVF2(NAME, TD, T1, T2, TX1, TX2, HD, HS2, OP) \
1131
static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
1132
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
1133
*((TD *)vd + HD(i)) = OP(s2, (TX1)(T1)s1, &env->fp_status);\
1134
}
1135
1136
-#define GEN_VEXT_VF(NAME, ESZ, DSZ) \
1137
+#define GEN_VEXT_VF(NAME) \
1138
void HELPER(NAME)(void *vd, void *v0, uint64_t s1, \
1139
void *vs2, CPURISCVState *env, \
1140
uint32_t desc) \
1141
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, uint64_t s1, \
1142
RVVCALL(OPFVF2, vfadd_vf_h, OP_UUU_H, H2, H2, float16_add)
1143
RVVCALL(OPFVF2, vfadd_vf_w, OP_UUU_W, H4, H4, float32_add)
1144
RVVCALL(OPFVF2, vfadd_vf_d, OP_UUU_D, H8, H8, float64_add)
1145
-GEN_VEXT_VF(vfadd_vf_h, 2, 2)
1146
-GEN_VEXT_VF(vfadd_vf_w, 4, 4)
1147
-GEN_VEXT_VF(vfadd_vf_d, 8, 8)
1148
+GEN_VEXT_VF(vfadd_vf_h)
1149
+GEN_VEXT_VF(vfadd_vf_w)
1150
+GEN_VEXT_VF(vfadd_vf_d)
1151
1152
RVVCALL(OPFVV2, vfsub_vv_h, OP_UUU_H, H2, H2, H2, float16_sub)
1153
RVVCALL(OPFVV2, vfsub_vv_w, OP_UUU_W, H4, H4, H4, float32_sub)
1154
RVVCALL(OPFVV2, vfsub_vv_d, OP_UUU_D, H8, H8, H8, float64_sub)
1155
-GEN_VEXT_VV_ENV(vfsub_vv_h, 2, 2)
1156
-GEN_VEXT_VV_ENV(vfsub_vv_w, 4, 4)
1157
-GEN_VEXT_VV_ENV(vfsub_vv_d, 8, 8)
1158
+GEN_VEXT_VV_ENV(vfsub_vv_h)
1159
+GEN_VEXT_VV_ENV(vfsub_vv_w)
1160
+GEN_VEXT_VV_ENV(vfsub_vv_d)
1161
RVVCALL(OPFVF2, vfsub_vf_h, OP_UUU_H, H2, H2, float16_sub)
1162
RVVCALL(OPFVF2, vfsub_vf_w, OP_UUU_W, H4, H4, float32_sub)
1163
RVVCALL(OPFVF2, vfsub_vf_d, OP_UUU_D, H8, H8, float64_sub)
1164
-GEN_VEXT_VF(vfsub_vf_h, 2, 2)
1165
-GEN_VEXT_VF(vfsub_vf_w, 4, 4)
1166
-GEN_VEXT_VF(vfsub_vf_d, 8, 8)
1167
+GEN_VEXT_VF(vfsub_vf_h)
1168
+GEN_VEXT_VF(vfsub_vf_w)
1169
+GEN_VEXT_VF(vfsub_vf_d)
1170
1171
static uint16_t float16_rsub(uint16_t a, uint16_t b, float_status *s)
1172
{
1173
@@ -XXX,XX +XXX,XX @@ static uint64_t float64_rsub(uint64_t a, uint64_t b, float_status *s)
1174
RVVCALL(OPFVF2, vfrsub_vf_h, OP_UUU_H, H2, H2, float16_rsub)
1175
RVVCALL(OPFVF2, vfrsub_vf_w, OP_UUU_W, H4, H4, float32_rsub)
1176
RVVCALL(OPFVF2, vfrsub_vf_d, OP_UUU_D, H8, H8, float64_rsub)
1177
-GEN_VEXT_VF(vfrsub_vf_h, 2, 2)
1178
-GEN_VEXT_VF(vfrsub_vf_w, 4, 4)
1179
-GEN_VEXT_VF(vfrsub_vf_d, 8, 8)
1180
+GEN_VEXT_VF(vfrsub_vf_h)
1181
+GEN_VEXT_VF(vfrsub_vf_w)
1182
+GEN_VEXT_VF(vfrsub_vf_d)
1183
1184
/* Vector Widening Floating-Point Add/Subtract Instructions */
1185
static uint32_t vfwadd16(uint16_t a, uint16_t b, float_status *s)
1186
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwadd32(uint32_t a, uint32_t b, float_status *s)
1187
1188
RVVCALL(OPFVV2, vfwadd_vv_h, WOP_UUU_H, H4, H2, H2, vfwadd16)
1189
RVVCALL(OPFVV2, vfwadd_vv_w, WOP_UUU_W, H8, H4, H4, vfwadd32)
1190
-GEN_VEXT_VV_ENV(vfwadd_vv_h, 2, 4)
1191
-GEN_VEXT_VV_ENV(vfwadd_vv_w, 4, 8)
1192
+GEN_VEXT_VV_ENV(vfwadd_vv_h)
1193
+GEN_VEXT_VV_ENV(vfwadd_vv_w)
1194
RVVCALL(OPFVF2, vfwadd_vf_h, WOP_UUU_H, H4, H2, vfwadd16)
1195
RVVCALL(OPFVF2, vfwadd_vf_w, WOP_UUU_W, H8, H4, vfwadd32)
1196
-GEN_VEXT_VF(vfwadd_vf_h, 2, 4)
1197
-GEN_VEXT_VF(vfwadd_vf_w, 4, 8)
1198
+GEN_VEXT_VF(vfwadd_vf_h)
1199
+GEN_VEXT_VF(vfwadd_vf_w)
1200
1201
static uint32_t vfwsub16(uint16_t a, uint16_t b, float_status *s)
1202
{
1203
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwsub32(uint32_t a, uint32_t b, float_status *s)
1204
1205
RVVCALL(OPFVV2, vfwsub_vv_h, WOP_UUU_H, H4, H2, H2, vfwsub16)
1206
RVVCALL(OPFVV2, vfwsub_vv_w, WOP_UUU_W, H8, H4, H4, vfwsub32)
1207
-GEN_VEXT_VV_ENV(vfwsub_vv_h, 2, 4)
1208
-GEN_VEXT_VV_ENV(vfwsub_vv_w, 4, 8)
1209
+GEN_VEXT_VV_ENV(vfwsub_vv_h)
1210
+GEN_VEXT_VV_ENV(vfwsub_vv_w)
1211
RVVCALL(OPFVF2, vfwsub_vf_h, WOP_UUU_H, H4, H2, vfwsub16)
1212
RVVCALL(OPFVF2, vfwsub_vf_w, WOP_UUU_W, H8, H4, vfwsub32)
1213
-GEN_VEXT_VF(vfwsub_vf_h, 2, 4)
1214
-GEN_VEXT_VF(vfwsub_vf_w, 4, 8)
1215
+GEN_VEXT_VF(vfwsub_vf_h)
1216
+GEN_VEXT_VF(vfwsub_vf_w)
1217
1218
static uint32_t vfwaddw16(uint32_t a, uint16_t b, float_status *s)
1219
{
1220
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwaddw32(uint64_t a, uint32_t b, float_status *s)
1221
1222
RVVCALL(OPFVV2, vfwadd_wv_h, WOP_WUUU_H, H4, H2, H2, vfwaddw16)
1223
RVVCALL(OPFVV2, vfwadd_wv_w, WOP_WUUU_W, H8, H4, H4, vfwaddw32)
1224
-GEN_VEXT_VV_ENV(vfwadd_wv_h, 2, 4)
1225
-GEN_VEXT_VV_ENV(vfwadd_wv_w, 4, 8)
1226
+GEN_VEXT_VV_ENV(vfwadd_wv_h)
1227
+GEN_VEXT_VV_ENV(vfwadd_wv_w)
1228
RVVCALL(OPFVF2, vfwadd_wf_h, WOP_WUUU_H, H4, H2, vfwaddw16)
1229
RVVCALL(OPFVF2, vfwadd_wf_w, WOP_WUUU_W, H8, H4, vfwaddw32)
1230
-GEN_VEXT_VF(vfwadd_wf_h, 2, 4)
1231
-GEN_VEXT_VF(vfwadd_wf_w, 4, 8)
1232
+GEN_VEXT_VF(vfwadd_wf_h)
1233
+GEN_VEXT_VF(vfwadd_wf_w)
1234
1235
static uint32_t vfwsubw16(uint32_t a, uint16_t b, float_status *s)
1236
{
1237
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwsubw32(uint64_t a, uint32_t b, float_status *s)
1238
1239
RVVCALL(OPFVV2, vfwsub_wv_h, WOP_WUUU_H, H4, H2, H2, vfwsubw16)
1240
RVVCALL(OPFVV2, vfwsub_wv_w, WOP_WUUU_W, H8, H4, H4, vfwsubw32)
1241
-GEN_VEXT_VV_ENV(vfwsub_wv_h, 2, 4)
1242
-GEN_VEXT_VV_ENV(vfwsub_wv_w, 4, 8)
1243
+GEN_VEXT_VV_ENV(vfwsub_wv_h)
1244
+GEN_VEXT_VV_ENV(vfwsub_wv_w)
1245
RVVCALL(OPFVF2, vfwsub_wf_h, WOP_WUUU_H, H4, H2, vfwsubw16)
1246
RVVCALL(OPFVF2, vfwsub_wf_w, WOP_WUUU_W, H8, H4, vfwsubw32)
1247
-GEN_VEXT_VF(vfwsub_wf_h, 2, 4)
1248
-GEN_VEXT_VF(vfwsub_wf_w, 4, 8)
1249
+GEN_VEXT_VF(vfwsub_wf_h)
1250
+GEN_VEXT_VF(vfwsub_wf_w)
1251
1252
/* Vector Single-Width Floating-Point Multiply/Divide Instructions */
1253
RVVCALL(OPFVV2, vfmul_vv_h, OP_UUU_H, H2, H2, H2, float16_mul)
1254
RVVCALL(OPFVV2, vfmul_vv_w, OP_UUU_W, H4, H4, H4, float32_mul)
1255
RVVCALL(OPFVV2, vfmul_vv_d, OP_UUU_D, H8, H8, H8, float64_mul)
1256
-GEN_VEXT_VV_ENV(vfmul_vv_h, 2, 2)
1257
-GEN_VEXT_VV_ENV(vfmul_vv_w, 4, 4)
1258
-GEN_VEXT_VV_ENV(vfmul_vv_d, 8, 8)
1259
+GEN_VEXT_VV_ENV(vfmul_vv_h)
1260
+GEN_VEXT_VV_ENV(vfmul_vv_w)
1261
+GEN_VEXT_VV_ENV(vfmul_vv_d)
1262
RVVCALL(OPFVF2, vfmul_vf_h, OP_UUU_H, H2, H2, float16_mul)
1263
RVVCALL(OPFVF2, vfmul_vf_w, OP_UUU_W, H4, H4, float32_mul)
1264
RVVCALL(OPFVF2, vfmul_vf_d, OP_UUU_D, H8, H8, float64_mul)
1265
-GEN_VEXT_VF(vfmul_vf_h, 2, 2)
1266
-GEN_VEXT_VF(vfmul_vf_w, 4, 4)
1267
-GEN_VEXT_VF(vfmul_vf_d, 8, 8)
1268
+GEN_VEXT_VF(vfmul_vf_h)
1269
+GEN_VEXT_VF(vfmul_vf_w)
1270
+GEN_VEXT_VF(vfmul_vf_d)
1271
1272
RVVCALL(OPFVV2, vfdiv_vv_h, OP_UUU_H, H2, H2, H2, float16_div)
1273
RVVCALL(OPFVV2, vfdiv_vv_w, OP_UUU_W, H4, H4, H4, float32_div)
1274
RVVCALL(OPFVV2, vfdiv_vv_d, OP_UUU_D, H8, H8, H8, float64_div)
1275
-GEN_VEXT_VV_ENV(vfdiv_vv_h, 2, 2)
1276
-GEN_VEXT_VV_ENV(vfdiv_vv_w, 4, 4)
1277
-GEN_VEXT_VV_ENV(vfdiv_vv_d, 8, 8)
1278
+GEN_VEXT_VV_ENV(vfdiv_vv_h)
1279
+GEN_VEXT_VV_ENV(vfdiv_vv_w)
1280
+GEN_VEXT_VV_ENV(vfdiv_vv_d)
1281
RVVCALL(OPFVF2, vfdiv_vf_h, OP_UUU_H, H2, H2, float16_div)
1282
RVVCALL(OPFVF2, vfdiv_vf_w, OP_UUU_W, H4, H4, float32_div)
1283
RVVCALL(OPFVF2, vfdiv_vf_d, OP_UUU_D, H8, H8, float64_div)
1284
-GEN_VEXT_VF(vfdiv_vf_h, 2, 2)
1285
-GEN_VEXT_VF(vfdiv_vf_w, 4, 4)
1286
-GEN_VEXT_VF(vfdiv_vf_d, 8, 8)
1287
+GEN_VEXT_VF(vfdiv_vf_h)
1288
+GEN_VEXT_VF(vfdiv_vf_w)
1289
+GEN_VEXT_VF(vfdiv_vf_d)
1290
1291
static uint16_t float16_rdiv(uint16_t a, uint16_t b, float_status *s)
1292
{
1293
@@ -XXX,XX +XXX,XX @@ static uint64_t float64_rdiv(uint64_t a, uint64_t b, float_status *s)
1294
RVVCALL(OPFVF2, vfrdiv_vf_h, OP_UUU_H, H2, H2, float16_rdiv)
1295
RVVCALL(OPFVF2, vfrdiv_vf_w, OP_UUU_W, H4, H4, float32_rdiv)
1296
RVVCALL(OPFVF2, vfrdiv_vf_d, OP_UUU_D, H8, H8, float64_rdiv)
1297
-GEN_VEXT_VF(vfrdiv_vf_h, 2, 2)
1298
-GEN_VEXT_VF(vfrdiv_vf_w, 4, 4)
1299
-GEN_VEXT_VF(vfrdiv_vf_d, 8, 8)
1300
+GEN_VEXT_VF(vfrdiv_vf_h)
1301
+GEN_VEXT_VF(vfrdiv_vf_w)
1302
+GEN_VEXT_VF(vfrdiv_vf_d)
1303
1304
/* Vector Widening Floating-Point Multiply */
1305
static uint32_t vfwmul16(uint16_t a, uint16_t b, float_status *s)
1306
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwmul32(uint32_t a, uint32_t b, float_status *s)
1307
}
1308
RVVCALL(OPFVV2, vfwmul_vv_h, WOP_UUU_H, H4, H2, H2, vfwmul16)
1309
RVVCALL(OPFVV2, vfwmul_vv_w, WOP_UUU_W, H8, H4, H4, vfwmul32)
1310
-GEN_VEXT_VV_ENV(vfwmul_vv_h, 2, 4)
1311
-GEN_VEXT_VV_ENV(vfwmul_vv_w, 4, 8)
1312
+GEN_VEXT_VV_ENV(vfwmul_vv_h)
1313
+GEN_VEXT_VV_ENV(vfwmul_vv_w)
1314
RVVCALL(OPFVF2, vfwmul_vf_h, WOP_UUU_H, H4, H2, vfwmul16)
1315
RVVCALL(OPFVF2, vfwmul_vf_w, WOP_UUU_W, H8, H4, vfwmul32)
1316
-GEN_VEXT_VF(vfwmul_vf_h, 2, 4)
1317
-GEN_VEXT_VF(vfwmul_vf_w, 4, 8)
1318
+GEN_VEXT_VF(vfwmul_vf_h)
1319
+GEN_VEXT_VF(vfwmul_vf_w)
1320
1321
/* Vector Single-Width Floating-Point Fused Multiply-Add Instructions */
1322
#define OPFVV3(NAME, TD, T1, T2, TX1, TX2, HD, HS1, HS2, OP) \
1323
@@ -XXX,XX +XXX,XX @@ static uint64_t fmacc64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1324
RVVCALL(OPFVV3, vfmacc_vv_h, OP_UUU_H, H2, H2, H2, fmacc16)
1325
RVVCALL(OPFVV3, vfmacc_vv_w, OP_UUU_W, H4, H4, H4, fmacc32)
1326
RVVCALL(OPFVV3, vfmacc_vv_d, OP_UUU_D, H8, H8, H8, fmacc64)
1327
-GEN_VEXT_VV_ENV(vfmacc_vv_h, 2, 2)
1328
-GEN_VEXT_VV_ENV(vfmacc_vv_w, 4, 4)
1329
-GEN_VEXT_VV_ENV(vfmacc_vv_d, 8, 8)
1330
+GEN_VEXT_VV_ENV(vfmacc_vv_h)
1331
+GEN_VEXT_VV_ENV(vfmacc_vv_w)
1332
+GEN_VEXT_VV_ENV(vfmacc_vv_d)
1333
1334
#define OPFVF3(NAME, TD, T1, T2, TX1, TX2, HD, HS2, OP) \
1335
static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
1336
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
1337
RVVCALL(OPFVF3, vfmacc_vf_h, OP_UUU_H, H2, H2, fmacc16)
1338
RVVCALL(OPFVF3, vfmacc_vf_w, OP_UUU_W, H4, H4, fmacc32)
1339
RVVCALL(OPFVF3, vfmacc_vf_d, OP_UUU_D, H8, H8, fmacc64)
1340
-GEN_VEXT_VF(vfmacc_vf_h, 2, 2)
1341
-GEN_VEXT_VF(vfmacc_vf_w, 4, 4)
1342
-GEN_VEXT_VF(vfmacc_vf_d, 8, 8)
1343
+GEN_VEXT_VF(vfmacc_vf_h)
1344
+GEN_VEXT_VF(vfmacc_vf_w)
1345
+GEN_VEXT_VF(vfmacc_vf_d)
1346
1347
static uint16_t fnmacc16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
1348
{
1349
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmacc64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1350
RVVCALL(OPFVV3, vfnmacc_vv_h, OP_UUU_H, H2, H2, H2, fnmacc16)
1351
RVVCALL(OPFVV3, vfnmacc_vv_w, OP_UUU_W, H4, H4, H4, fnmacc32)
1352
RVVCALL(OPFVV3, vfnmacc_vv_d, OP_UUU_D, H8, H8, H8, fnmacc64)
1353
-GEN_VEXT_VV_ENV(vfnmacc_vv_h, 2, 2)
1354
-GEN_VEXT_VV_ENV(vfnmacc_vv_w, 4, 4)
1355
-GEN_VEXT_VV_ENV(vfnmacc_vv_d, 8, 8)
1356
+GEN_VEXT_VV_ENV(vfnmacc_vv_h)
1357
+GEN_VEXT_VV_ENV(vfnmacc_vv_w)
1358
+GEN_VEXT_VV_ENV(vfnmacc_vv_d)
1359
RVVCALL(OPFVF3, vfnmacc_vf_h, OP_UUU_H, H2, H2, fnmacc16)
1360
RVVCALL(OPFVF3, vfnmacc_vf_w, OP_UUU_W, H4, H4, fnmacc32)
1361
RVVCALL(OPFVF3, vfnmacc_vf_d, OP_UUU_D, H8, H8, fnmacc64)
1362
-GEN_VEXT_VF(vfnmacc_vf_h, 2, 2)
1363
-GEN_VEXT_VF(vfnmacc_vf_w, 4, 4)
1364
-GEN_VEXT_VF(vfnmacc_vf_d, 8, 8)
1365
+GEN_VEXT_VF(vfnmacc_vf_h)
1366
+GEN_VEXT_VF(vfnmacc_vf_w)
1367
+GEN_VEXT_VF(vfnmacc_vf_d)
1368
1369
static uint16_t fmsac16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
1370
{
1371
@@ -XXX,XX +XXX,XX @@ static uint64_t fmsac64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1372
RVVCALL(OPFVV3, vfmsac_vv_h, OP_UUU_H, H2, H2, H2, fmsac16)
1373
RVVCALL(OPFVV3, vfmsac_vv_w, OP_UUU_W, H4, H4, H4, fmsac32)
1374
RVVCALL(OPFVV3, vfmsac_vv_d, OP_UUU_D, H8, H8, H8, fmsac64)
1375
-GEN_VEXT_VV_ENV(vfmsac_vv_h, 2, 2)
1376
-GEN_VEXT_VV_ENV(vfmsac_vv_w, 4, 4)
1377
-GEN_VEXT_VV_ENV(vfmsac_vv_d, 8, 8)
1378
+GEN_VEXT_VV_ENV(vfmsac_vv_h)
1379
+GEN_VEXT_VV_ENV(vfmsac_vv_w)
1380
+GEN_VEXT_VV_ENV(vfmsac_vv_d)
1381
RVVCALL(OPFVF3, vfmsac_vf_h, OP_UUU_H, H2, H2, fmsac16)
1382
RVVCALL(OPFVF3, vfmsac_vf_w, OP_UUU_W, H4, H4, fmsac32)
1383
RVVCALL(OPFVF3, vfmsac_vf_d, OP_UUU_D, H8, H8, fmsac64)
1384
-GEN_VEXT_VF(vfmsac_vf_h, 2, 2)
1385
-GEN_VEXT_VF(vfmsac_vf_w, 4, 4)
1386
-GEN_VEXT_VF(vfmsac_vf_d, 8, 8)
1387
+GEN_VEXT_VF(vfmsac_vf_h)
1388
+GEN_VEXT_VF(vfmsac_vf_w)
1389
+GEN_VEXT_VF(vfmsac_vf_d)
1390
1391
static uint16_t fnmsac16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
1392
{
1393
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmsac64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1394
RVVCALL(OPFVV3, vfnmsac_vv_h, OP_UUU_H, H2, H2, H2, fnmsac16)
1395
RVVCALL(OPFVV3, vfnmsac_vv_w, OP_UUU_W, H4, H4, H4, fnmsac32)
1396
RVVCALL(OPFVV3, vfnmsac_vv_d, OP_UUU_D, H8, H8, H8, fnmsac64)
1397
-GEN_VEXT_VV_ENV(vfnmsac_vv_h, 2, 2)
1398
-GEN_VEXT_VV_ENV(vfnmsac_vv_w, 4, 4)
1399
-GEN_VEXT_VV_ENV(vfnmsac_vv_d, 8, 8)
1400
+GEN_VEXT_VV_ENV(vfnmsac_vv_h)
1401
+GEN_VEXT_VV_ENV(vfnmsac_vv_w)
1402
+GEN_VEXT_VV_ENV(vfnmsac_vv_d)
1403
RVVCALL(OPFVF3, vfnmsac_vf_h, OP_UUU_H, H2, H2, fnmsac16)
1404
RVVCALL(OPFVF3, vfnmsac_vf_w, OP_UUU_W, H4, H4, fnmsac32)
1405
RVVCALL(OPFVF3, vfnmsac_vf_d, OP_UUU_D, H8, H8, fnmsac64)
1406
-GEN_VEXT_VF(vfnmsac_vf_h, 2, 2)
1407
-GEN_VEXT_VF(vfnmsac_vf_w, 4, 4)
1408
-GEN_VEXT_VF(vfnmsac_vf_d, 8, 8)
1409
+GEN_VEXT_VF(vfnmsac_vf_h)
1410
+GEN_VEXT_VF(vfnmsac_vf_w)
1411
+GEN_VEXT_VF(vfnmsac_vf_d)
1412
1413
static uint16_t fmadd16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
1414
{
1415
@@ -XXX,XX +XXX,XX @@ static uint64_t fmadd64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1416
RVVCALL(OPFVV3, vfmadd_vv_h, OP_UUU_H, H2, H2, H2, fmadd16)
1417
RVVCALL(OPFVV3, vfmadd_vv_w, OP_UUU_W, H4, H4, H4, fmadd32)
1418
RVVCALL(OPFVV3, vfmadd_vv_d, OP_UUU_D, H8, H8, H8, fmadd64)
1419
-GEN_VEXT_VV_ENV(vfmadd_vv_h, 2, 2)
1420
-GEN_VEXT_VV_ENV(vfmadd_vv_w, 4, 4)
1421
-GEN_VEXT_VV_ENV(vfmadd_vv_d, 8, 8)
1422
+GEN_VEXT_VV_ENV(vfmadd_vv_h)
1423
+GEN_VEXT_VV_ENV(vfmadd_vv_w)
1424
+GEN_VEXT_VV_ENV(vfmadd_vv_d)
1425
RVVCALL(OPFVF3, vfmadd_vf_h, OP_UUU_H, H2, H2, fmadd16)
1426
RVVCALL(OPFVF3, vfmadd_vf_w, OP_UUU_W, H4, H4, fmadd32)
1427
RVVCALL(OPFVF3, vfmadd_vf_d, OP_UUU_D, H8, H8, fmadd64)
1428
-GEN_VEXT_VF(vfmadd_vf_h, 2, 2)
1429
-GEN_VEXT_VF(vfmadd_vf_w, 4, 4)
1430
-GEN_VEXT_VF(vfmadd_vf_d, 8, 8)
1431
+GEN_VEXT_VF(vfmadd_vf_h)
1432
+GEN_VEXT_VF(vfmadd_vf_w)
1433
+GEN_VEXT_VF(vfmadd_vf_d)
1434
1435
static uint16_t fnmadd16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
1436
{
1437
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmadd64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1438
RVVCALL(OPFVV3, vfnmadd_vv_h, OP_UUU_H, H2, H2, H2, fnmadd16)
1439
RVVCALL(OPFVV3, vfnmadd_vv_w, OP_UUU_W, H4, H4, H4, fnmadd32)
1440
RVVCALL(OPFVV3, vfnmadd_vv_d, OP_UUU_D, H8, H8, H8, fnmadd64)
1441
-GEN_VEXT_VV_ENV(vfnmadd_vv_h, 2, 2)
1442
-GEN_VEXT_VV_ENV(vfnmadd_vv_w, 4, 4)
1443
-GEN_VEXT_VV_ENV(vfnmadd_vv_d, 8, 8)
1444
+GEN_VEXT_VV_ENV(vfnmadd_vv_h)
1445
+GEN_VEXT_VV_ENV(vfnmadd_vv_w)
1446
+GEN_VEXT_VV_ENV(vfnmadd_vv_d)
1447
RVVCALL(OPFVF3, vfnmadd_vf_h, OP_UUU_H, H2, H2, fnmadd16)
1448
RVVCALL(OPFVF3, vfnmadd_vf_w, OP_UUU_W, H4, H4, fnmadd32)
1449
RVVCALL(OPFVF3, vfnmadd_vf_d, OP_UUU_D, H8, H8, fnmadd64)
1450
-GEN_VEXT_VF(vfnmadd_vf_h, 2, 2)
1451
-GEN_VEXT_VF(vfnmadd_vf_w, 4, 4)
1452
-GEN_VEXT_VF(vfnmadd_vf_d, 8, 8)
1453
+GEN_VEXT_VF(vfnmadd_vf_h)
1454
+GEN_VEXT_VF(vfnmadd_vf_w)
1455
+GEN_VEXT_VF(vfnmadd_vf_d)
1456
1457
static uint16_t fmsub16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
1458
{
1459
@@ -XXX,XX +XXX,XX @@ static uint64_t fmsub64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1460
RVVCALL(OPFVV3, vfmsub_vv_h, OP_UUU_H, H2, H2, H2, fmsub16)
1461
RVVCALL(OPFVV3, vfmsub_vv_w, OP_UUU_W, H4, H4, H4, fmsub32)
1462
RVVCALL(OPFVV3, vfmsub_vv_d, OP_UUU_D, H8, H8, H8, fmsub64)
1463
-GEN_VEXT_VV_ENV(vfmsub_vv_h, 2, 2)
1464
-GEN_VEXT_VV_ENV(vfmsub_vv_w, 4, 4)
1465
-GEN_VEXT_VV_ENV(vfmsub_vv_d, 8, 8)
1466
+GEN_VEXT_VV_ENV(vfmsub_vv_h)
1467
+GEN_VEXT_VV_ENV(vfmsub_vv_w)
1468
+GEN_VEXT_VV_ENV(vfmsub_vv_d)
1469
RVVCALL(OPFVF3, vfmsub_vf_h, OP_UUU_H, H2, H2, fmsub16)
1470
RVVCALL(OPFVF3, vfmsub_vf_w, OP_UUU_W, H4, H4, fmsub32)
1471
RVVCALL(OPFVF3, vfmsub_vf_d, OP_UUU_D, H8, H8, fmsub64)
1472
-GEN_VEXT_VF(vfmsub_vf_h, 2, 2)
1473
-GEN_VEXT_VF(vfmsub_vf_w, 4, 4)
1474
-GEN_VEXT_VF(vfmsub_vf_d, 8, 8)
1475
+GEN_VEXT_VF(vfmsub_vf_h)
1476
+GEN_VEXT_VF(vfmsub_vf_w)
1477
+GEN_VEXT_VF(vfmsub_vf_d)
1478
1479
static uint16_t fnmsub16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
1480
{
1481
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmsub64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
1482
RVVCALL(OPFVV3, vfnmsub_vv_h, OP_UUU_H, H2, H2, H2, fnmsub16)
1483
RVVCALL(OPFVV3, vfnmsub_vv_w, OP_UUU_W, H4, H4, H4, fnmsub32)
1484
RVVCALL(OPFVV3, vfnmsub_vv_d, OP_UUU_D, H8, H8, H8, fnmsub64)
1485
-GEN_VEXT_VV_ENV(vfnmsub_vv_h, 2, 2)
1486
-GEN_VEXT_VV_ENV(vfnmsub_vv_w, 4, 4)
1487
-GEN_VEXT_VV_ENV(vfnmsub_vv_d, 8, 8)
1488
+GEN_VEXT_VV_ENV(vfnmsub_vv_h)
1489
+GEN_VEXT_VV_ENV(vfnmsub_vv_w)
1490
+GEN_VEXT_VV_ENV(vfnmsub_vv_d)
1491
RVVCALL(OPFVF3, vfnmsub_vf_h, OP_UUU_H, H2, H2, fnmsub16)
1492
RVVCALL(OPFVF3, vfnmsub_vf_w, OP_UUU_W, H4, H4, fnmsub32)
1493
RVVCALL(OPFVF3, vfnmsub_vf_d, OP_UUU_D, H8, H8, fnmsub64)
1494
-GEN_VEXT_VF(vfnmsub_vf_h, 2, 2)
1495
-GEN_VEXT_VF(vfnmsub_vf_w, 4, 4)
1496
-GEN_VEXT_VF(vfnmsub_vf_d, 8, 8)
1497
+GEN_VEXT_VF(vfnmsub_vf_h)
1498
+GEN_VEXT_VF(vfnmsub_vf_w)
1499
+GEN_VEXT_VF(vfnmsub_vf_d)
1500
1501
/* Vector Widening Floating-Point Fused Multiply-Add Instructions */
1502
static uint32_t fwmacc16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
1503
@@ -XXX,XX +XXX,XX @@ static uint64_t fwmacc32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
1504
1505
RVVCALL(OPFVV3, vfwmacc_vv_h, WOP_UUU_H, H4, H2, H2, fwmacc16)
1506
RVVCALL(OPFVV3, vfwmacc_vv_w, WOP_UUU_W, H8, H4, H4, fwmacc32)
1507
-GEN_VEXT_VV_ENV(vfwmacc_vv_h, 2, 4)
1508
-GEN_VEXT_VV_ENV(vfwmacc_vv_w, 4, 8)
1509
+GEN_VEXT_VV_ENV(vfwmacc_vv_h)
1510
+GEN_VEXT_VV_ENV(vfwmacc_vv_w)
1511
RVVCALL(OPFVF3, vfwmacc_vf_h, WOP_UUU_H, H4, H2, fwmacc16)
1512
RVVCALL(OPFVF3, vfwmacc_vf_w, WOP_UUU_W, H8, H4, fwmacc32)
1513
-GEN_VEXT_VF(vfwmacc_vf_h, 2, 4)
1514
-GEN_VEXT_VF(vfwmacc_vf_w, 4, 8)
1515
+GEN_VEXT_VF(vfwmacc_vf_h)
1516
+GEN_VEXT_VF(vfwmacc_vf_w)
1517
1518
static uint32_t fwnmacc16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
1519
{
1520
@@ -XXX,XX +XXX,XX @@ static uint64_t fwnmacc32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
1521
1522
RVVCALL(OPFVV3, vfwnmacc_vv_h, WOP_UUU_H, H4, H2, H2, fwnmacc16)
1523
RVVCALL(OPFVV3, vfwnmacc_vv_w, WOP_UUU_W, H8, H4, H4, fwnmacc32)
1524
-GEN_VEXT_VV_ENV(vfwnmacc_vv_h, 2, 4)
1525
-GEN_VEXT_VV_ENV(vfwnmacc_vv_w, 4, 8)
1526
+GEN_VEXT_VV_ENV(vfwnmacc_vv_h)
1527
+GEN_VEXT_VV_ENV(vfwnmacc_vv_w)
1528
RVVCALL(OPFVF3, vfwnmacc_vf_h, WOP_UUU_H, H4, H2, fwnmacc16)
1529
RVVCALL(OPFVF3, vfwnmacc_vf_w, WOP_UUU_W, H8, H4, fwnmacc32)
1530
-GEN_VEXT_VF(vfwnmacc_vf_h, 2, 4)
1531
-GEN_VEXT_VF(vfwnmacc_vf_w, 4, 8)
1532
+GEN_VEXT_VF(vfwnmacc_vf_h)
1533
+GEN_VEXT_VF(vfwnmacc_vf_w)
1534
1535
static uint32_t fwmsac16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
1536
{
1537
@@ -XXX,XX +XXX,XX @@ static uint64_t fwmsac32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
1538
1539
RVVCALL(OPFVV3, vfwmsac_vv_h, WOP_UUU_H, H4, H2, H2, fwmsac16)
1540
RVVCALL(OPFVV3, vfwmsac_vv_w, WOP_UUU_W, H8, H4, H4, fwmsac32)
1541
-GEN_VEXT_VV_ENV(vfwmsac_vv_h, 2, 4)
1542
-GEN_VEXT_VV_ENV(vfwmsac_vv_w, 4, 8)
1543
+GEN_VEXT_VV_ENV(vfwmsac_vv_h)
1544
+GEN_VEXT_VV_ENV(vfwmsac_vv_w)
1545
RVVCALL(OPFVF3, vfwmsac_vf_h, WOP_UUU_H, H4, H2, fwmsac16)
1546
RVVCALL(OPFVF3, vfwmsac_vf_w, WOP_UUU_W, H8, H4, fwmsac32)
1547
-GEN_VEXT_VF(vfwmsac_vf_h, 2, 4)
1548
-GEN_VEXT_VF(vfwmsac_vf_w, 4, 8)
1549
+GEN_VEXT_VF(vfwmsac_vf_h)
1550
+GEN_VEXT_VF(vfwmsac_vf_w)
1551
1552
static uint32_t fwnmsac16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
1553
{
1554
@@ -XXX,XX +XXX,XX @@ static uint64_t fwnmsac32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
1555
1556
RVVCALL(OPFVV3, vfwnmsac_vv_h, WOP_UUU_H, H4, H2, H2, fwnmsac16)
1557
RVVCALL(OPFVV3, vfwnmsac_vv_w, WOP_UUU_W, H8, H4, H4, fwnmsac32)
1558
-GEN_VEXT_VV_ENV(vfwnmsac_vv_h, 2, 4)
1559
-GEN_VEXT_VV_ENV(vfwnmsac_vv_w, 4, 8)
1560
+GEN_VEXT_VV_ENV(vfwnmsac_vv_h)
1561
+GEN_VEXT_VV_ENV(vfwnmsac_vv_w)
1562
RVVCALL(OPFVF3, vfwnmsac_vf_h, WOP_UUU_H, H4, H2, fwnmsac16)
1563
RVVCALL(OPFVF3, vfwnmsac_vf_w, WOP_UUU_W, H8, H4, fwnmsac32)
1564
-GEN_VEXT_VF(vfwnmsac_vf_h, 2, 4)
1565
-GEN_VEXT_VF(vfwnmsac_vf_w, 4, 8)
1566
+GEN_VEXT_VF(vfwnmsac_vf_h)
1567
+GEN_VEXT_VF(vfwnmsac_vf_w)
1568
1569
/* Vector Floating-Point Square-Root Instruction */
1570
/* (TD, T2, TX2) */
1571
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, void *vs2, int i, \
1572
*((TD *)vd + HD(i)) = OP(s2, &env->fp_status); \
1573
}
1574
1575
-#define GEN_VEXT_V_ENV(NAME, ESZ, DSZ) \
1576
+#define GEN_VEXT_V_ENV(NAME) \
1577
void HELPER(NAME)(void *vd, void *v0, void *vs2, \
1578
CPURISCVState *env, uint32_t desc) \
1579
{ \
1580
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, \
1581
RVVCALL(OPFVV1, vfsqrt_v_h, OP_UU_H, H2, H2, float16_sqrt)
1582
RVVCALL(OPFVV1, vfsqrt_v_w, OP_UU_W, H4, H4, float32_sqrt)
1583
RVVCALL(OPFVV1, vfsqrt_v_d, OP_UU_D, H8, H8, float64_sqrt)
1584
-GEN_VEXT_V_ENV(vfsqrt_v_h, 2, 2)
1585
-GEN_VEXT_V_ENV(vfsqrt_v_w, 4, 4)
1586
-GEN_VEXT_V_ENV(vfsqrt_v_d, 8, 8)
1587
+GEN_VEXT_V_ENV(vfsqrt_v_h)
1588
+GEN_VEXT_V_ENV(vfsqrt_v_w)
1589
+GEN_VEXT_V_ENV(vfsqrt_v_d)
1590
1591
/*
1592
* Vector Floating-Point Reciprocal Square-Root Estimate Instruction
1593
@@ -XXX,XX +XXX,XX @@ static float64 frsqrt7_d(float64 f, float_status *s)
1594
RVVCALL(OPFVV1, vfrsqrt7_v_h, OP_UU_H, H2, H2, frsqrt7_h)
1595
RVVCALL(OPFVV1, vfrsqrt7_v_w, OP_UU_W, H4, H4, frsqrt7_s)
1596
RVVCALL(OPFVV1, vfrsqrt7_v_d, OP_UU_D, H8, H8, frsqrt7_d)
1597
-GEN_VEXT_V_ENV(vfrsqrt7_v_h, 2, 2)
1598
-GEN_VEXT_V_ENV(vfrsqrt7_v_w, 4, 4)
1599
-GEN_VEXT_V_ENV(vfrsqrt7_v_d, 8, 8)
1600
+GEN_VEXT_V_ENV(vfrsqrt7_v_h)
1601
+GEN_VEXT_V_ENV(vfrsqrt7_v_w)
1602
+GEN_VEXT_V_ENV(vfrsqrt7_v_d)
1603
1604
/*
1605
* Vector Floating-Point Reciprocal Estimate Instruction
1606
@@ -XXX,XX +XXX,XX @@ static float64 frec7_d(float64 f, float_status *s)
1607
RVVCALL(OPFVV1, vfrec7_v_h, OP_UU_H, H2, H2, frec7_h)
1608
RVVCALL(OPFVV1, vfrec7_v_w, OP_UU_W, H4, H4, frec7_s)
1609
RVVCALL(OPFVV1, vfrec7_v_d, OP_UU_D, H8, H8, frec7_d)
1610
-GEN_VEXT_V_ENV(vfrec7_v_h, 2, 2)
1611
-GEN_VEXT_V_ENV(vfrec7_v_w, 4, 4)
1612
-GEN_VEXT_V_ENV(vfrec7_v_d, 8, 8)
1613
+GEN_VEXT_V_ENV(vfrec7_v_h)
1614
+GEN_VEXT_V_ENV(vfrec7_v_w)
1615
+GEN_VEXT_V_ENV(vfrec7_v_d)
1616
1617
/* Vector Floating-Point MIN/MAX Instructions */
1618
RVVCALL(OPFVV2, vfmin_vv_h, OP_UUU_H, H2, H2, H2, float16_minimum_number)
1619
RVVCALL(OPFVV2, vfmin_vv_w, OP_UUU_W, H4, H4, H4, float32_minimum_number)
1620
RVVCALL(OPFVV2, vfmin_vv_d, OP_UUU_D, H8, H8, H8, float64_minimum_number)
1621
-GEN_VEXT_VV_ENV(vfmin_vv_h, 2, 2)
1622
-GEN_VEXT_VV_ENV(vfmin_vv_w, 4, 4)
1623
-GEN_VEXT_VV_ENV(vfmin_vv_d, 8, 8)
1624
+GEN_VEXT_VV_ENV(vfmin_vv_h)
1625
+GEN_VEXT_VV_ENV(vfmin_vv_w)
1626
+GEN_VEXT_VV_ENV(vfmin_vv_d)
1627
RVVCALL(OPFVF2, vfmin_vf_h, OP_UUU_H, H2, H2, float16_minimum_number)
1628
RVVCALL(OPFVF2, vfmin_vf_w, OP_UUU_W, H4, H4, float32_minimum_number)
1629
RVVCALL(OPFVF2, vfmin_vf_d, OP_UUU_D, H8, H8, float64_minimum_number)
1630
-GEN_VEXT_VF(vfmin_vf_h, 2, 2)
1631
-GEN_VEXT_VF(vfmin_vf_w, 4, 4)
1632
-GEN_VEXT_VF(vfmin_vf_d, 8, 8)
1633
+GEN_VEXT_VF(vfmin_vf_h)
1634
+GEN_VEXT_VF(vfmin_vf_w)
1635
+GEN_VEXT_VF(vfmin_vf_d)
1636
1637
RVVCALL(OPFVV2, vfmax_vv_h, OP_UUU_H, H2, H2, H2, float16_maximum_number)
1638
RVVCALL(OPFVV2, vfmax_vv_w, OP_UUU_W, H4, H4, H4, float32_maximum_number)
1639
RVVCALL(OPFVV2, vfmax_vv_d, OP_UUU_D, H8, H8, H8, float64_maximum_number)
1640
-GEN_VEXT_VV_ENV(vfmax_vv_h, 2, 2)
1641
-GEN_VEXT_VV_ENV(vfmax_vv_w, 4, 4)
1642
-GEN_VEXT_VV_ENV(vfmax_vv_d, 8, 8)
1643
+GEN_VEXT_VV_ENV(vfmax_vv_h)
1644
+GEN_VEXT_VV_ENV(vfmax_vv_w)
1645
+GEN_VEXT_VV_ENV(vfmax_vv_d)
1646
RVVCALL(OPFVF2, vfmax_vf_h, OP_UUU_H, H2, H2, float16_maximum_number)
1647
RVVCALL(OPFVF2, vfmax_vf_w, OP_UUU_W, H4, H4, float32_maximum_number)
1648
RVVCALL(OPFVF2, vfmax_vf_d, OP_UUU_D, H8, H8, float64_maximum_number)
1649
-GEN_VEXT_VF(vfmax_vf_h, 2, 2)
1650
-GEN_VEXT_VF(vfmax_vf_w, 4, 4)
1651
-GEN_VEXT_VF(vfmax_vf_d, 8, 8)
1652
+GEN_VEXT_VF(vfmax_vf_h)
1653
+GEN_VEXT_VF(vfmax_vf_w)
1654
+GEN_VEXT_VF(vfmax_vf_d)
1655
1656
/* Vector Floating-Point Sign-Injection Instructions */
1657
static uint16_t fsgnj16(uint16_t a, uint16_t b, float_status *s)
1658
@@ -XXX,XX +XXX,XX @@ static uint64_t fsgnj64(uint64_t a, uint64_t b, float_status *s)
1659
RVVCALL(OPFVV2, vfsgnj_vv_h, OP_UUU_H, H2, H2, H2, fsgnj16)
1660
RVVCALL(OPFVV2, vfsgnj_vv_w, OP_UUU_W, H4, H4, H4, fsgnj32)
1661
RVVCALL(OPFVV2, vfsgnj_vv_d, OP_UUU_D, H8, H8, H8, fsgnj64)
1662
-GEN_VEXT_VV_ENV(vfsgnj_vv_h, 2, 2)
1663
-GEN_VEXT_VV_ENV(vfsgnj_vv_w, 4, 4)
1664
-GEN_VEXT_VV_ENV(vfsgnj_vv_d, 8, 8)
1665
+GEN_VEXT_VV_ENV(vfsgnj_vv_h)
1666
+GEN_VEXT_VV_ENV(vfsgnj_vv_w)
1667
+GEN_VEXT_VV_ENV(vfsgnj_vv_d)
1668
RVVCALL(OPFVF2, vfsgnj_vf_h, OP_UUU_H, H2, H2, fsgnj16)
1669
RVVCALL(OPFVF2, vfsgnj_vf_w, OP_UUU_W, H4, H4, fsgnj32)
1670
RVVCALL(OPFVF2, vfsgnj_vf_d, OP_UUU_D, H8, H8, fsgnj64)
1671
-GEN_VEXT_VF(vfsgnj_vf_h, 2, 2)
1672
-GEN_VEXT_VF(vfsgnj_vf_w, 4, 4)
1673
-GEN_VEXT_VF(vfsgnj_vf_d, 8, 8)
1674
+GEN_VEXT_VF(vfsgnj_vf_h)
1675
+GEN_VEXT_VF(vfsgnj_vf_w)
1676
+GEN_VEXT_VF(vfsgnj_vf_d)
1677
1678
static uint16_t fsgnjn16(uint16_t a, uint16_t b, float_status *s)
1679
{
1680
@@ -XXX,XX +XXX,XX @@ static uint64_t fsgnjn64(uint64_t a, uint64_t b, float_status *s)
1681
RVVCALL(OPFVV2, vfsgnjn_vv_h, OP_UUU_H, H2, H2, H2, fsgnjn16)
1682
RVVCALL(OPFVV2, vfsgnjn_vv_w, OP_UUU_W, H4, H4, H4, fsgnjn32)
1683
RVVCALL(OPFVV2, vfsgnjn_vv_d, OP_UUU_D, H8, H8, H8, fsgnjn64)
1684
-GEN_VEXT_VV_ENV(vfsgnjn_vv_h, 2, 2)
1685
-GEN_VEXT_VV_ENV(vfsgnjn_vv_w, 4, 4)
1686
-GEN_VEXT_VV_ENV(vfsgnjn_vv_d, 8, 8)
1687
+GEN_VEXT_VV_ENV(vfsgnjn_vv_h)
1688
+GEN_VEXT_VV_ENV(vfsgnjn_vv_w)
1689
+GEN_VEXT_VV_ENV(vfsgnjn_vv_d)
1690
RVVCALL(OPFVF2, vfsgnjn_vf_h, OP_UUU_H, H2, H2, fsgnjn16)
1691
RVVCALL(OPFVF2, vfsgnjn_vf_w, OP_UUU_W, H4, H4, fsgnjn32)
1692
RVVCALL(OPFVF2, vfsgnjn_vf_d, OP_UUU_D, H8, H8, fsgnjn64)
1693
-GEN_VEXT_VF(vfsgnjn_vf_h, 2, 2)
1694
-GEN_VEXT_VF(vfsgnjn_vf_w, 4, 4)
1695
-GEN_VEXT_VF(vfsgnjn_vf_d, 8, 8)
1696
+GEN_VEXT_VF(vfsgnjn_vf_h)
1697
+GEN_VEXT_VF(vfsgnjn_vf_w)
1698
+GEN_VEXT_VF(vfsgnjn_vf_d)
1699
1700
static uint16_t fsgnjx16(uint16_t a, uint16_t b, float_status *s)
1701
{
1702
@@ -XXX,XX +XXX,XX @@ static uint64_t fsgnjx64(uint64_t a, uint64_t b, float_status *s)
1703
RVVCALL(OPFVV2, vfsgnjx_vv_h, OP_UUU_H, H2, H2, H2, fsgnjx16)
1704
RVVCALL(OPFVV2, vfsgnjx_vv_w, OP_UUU_W, H4, H4, H4, fsgnjx32)
1705
RVVCALL(OPFVV2, vfsgnjx_vv_d, OP_UUU_D, H8, H8, H8, fsgnjx64)
1706
-GEN_VEXT_VV_ENV(vfsgnjx_vv_h, 2, 2)
1707
-GEN_VEXT_VV_ENV(vfsgnjx_vv_w, 4, 4)
1708
-GEN_VEXT_VV_ENV(vfsgnjx_vv_d, 8, 8)
1709
+GEN_VEXT_VV_ENV(vfsgnjx_vv_h)
1710
+GEN_VEXT_VV_ENV(vfsgnjx_vv_w)
1711
+GEN_VEXT_VV_ENV(vfsgnjx_vv_d)
1712
RVVCALL(OPFVF2, vfsgnjx_vf_h, OP_UUU_H, H2, H2, fsgnjx16)
1713
RVVCALL(OPFVF2, vfsgnjx_vf_w, OP_UUU_W, H4, H4, fsgnjx32)
1714
RVVCALL(OPFVF2, vfsgnjx_vf_d, OP_UUU_D, H8, H8, fsgnjx64)
1715
-GEN_VEXT_VF(vfsgnjx_vf_h, 2, 2)
1716
-GEN_VEXT_VF(vfsgnjx_vf_w, 4, 4)
1717
-GEN_VEXT_VF(vfsgnjx_vf_d, 8, 8)
1718
+GEN_VEXT_VF(vfsgnjx_vf_h)
1719
+GEN_VEXT_VF(vfsgnjx_vf_w)
1720
+GEN_VEXT_VF(vfsgnjx_vf_d)
1721
1722
/* Vector Floating-Point Compare Instructions */
1723
#define GEN_VEXT_CMP_VV_ENV(NAME, ETYPE, H, DO_OP) \
1724
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, void *vs2, int i) \
1725
*((TD *)vd + HD(i)) = OP(s2); \
1726
}
1727
1728
-#define GEN_VEXT_V(NAME, ESZ, DSZ) \
1729
+#define GEN_VEXT_V(NAME) \
1730
void HELPER(NAME)(void *vd, void *v0, void *vs2, \
1731
CPURISCVState *env, uint32_t desc) \
1732
{ \
1733
@@ -XXX,XX +XXX,XX @@ target_ulong fclass_d(uint64_t frs1)
1734
RVVCALL(OPIVV1, vfclass_v_h, OP_UU_H, H2, H2, fclass_h)
1735
RVVCALL(OPIVV1, vfclass_v_w, OP_UU_W, H4, H4, fclass_s)
1736
RVVCALL(OPIVV1, vfclass_v_d, OP_UU_D, H8, H8, fclass_d)
1737
-GEN_VEXT_V(vfclass_v_h, 2, 2)
1738
-GEN_VEXT_V(vfclass_v_w, 4, 4)
1739
-GEN_VEXT_V(vfclass_v_d, 8, 8)
1740
+GEN_VEXT_V(vfclass_v_h)
1741
+GEN_VEXT_V(vfclass_v_w)
1742
+GEN_VEXT_V(vfclass_v_d)
1743
1744
/* Vector Floating-Point Merge Instruction */
1745
#define GEN_VFMERGE_VF(NAME, ETYPE, H) \
1746
@@ -XXX,XX +XXX,XX @@ GEN_VFMERGE_VF(vfmerge_vfm_d, int64_t, H8)
1747
RVVCALL(OPFVV1, vfcvt_xu_f_v_h, OP_UU_H, H2, H2, float16_to_uint16)
1748
RVVCALL(OPFVV1, vfcvt_xu_f_v_w, OP_UU_W, H4, H4, float32_to_uint32)
1749
RVVCALL(OPFVV1, vfcvt_xu_f_v_d, OP_UU_D, H8, H8, float64_to_uint64)
1750
-GEN_VEXT_V_ENV(vfcvt_xu_f_v_h, 2, 2)
1751
-GEN_VEXT_V_ENV(vfcvt_xu_f_v_w, 4, 4)
1752
-GEN_VEXT_V_ENV(vfcvt_xu_f_v_d, 8, 8)
1753
+GEN_VEXT_V_ENV(vfcvt_xu_f_v_h)
1754
+GEN_VEXT_V_ENV(vfcvt_xu_f_v_w)
1755
+GEN_VEXT_V_ENV(vfcvt_xu_f_v_d)
1756
1757
/* vfcvt.x.f.v vd, vs2, vm # Convert float to signed integer. */
1758
RVVCALL(OPFVV1, vfcvt_x_f_v_h, OP_UU_H, H2, H2, float16_to_int16)
1759
RVVCALL(OPFVV1, vfcvt_x_f_v_w, OP_UU_W, H4, H4, float32_to_int32)
1760
RVVCALL(OPFVV1, vfcvt_x_f_v_d, OP_UU_D, H8, H8, float64_to_int64)
1761
-GEN_VEXT_V_ENV(vfcvt_x_f_v_h, 2, 2)
1762
-GEN_VEXT_V_ENV(vfcvt_x_f_v_w, 4, 4)
1763
-GEN_VEXT_V_ENV(vfcvt_x_f_v_d, 8, 8)
1764
+GEN_VEXT_V_ENV(vfcvt_x_f_v_h)
1765
+GEN_VEXT_V_ENV(vfcvt_x_f_v_w)
1766
+GEN_VEXT_V_ENV(vfcvt_x_f_v_d)
1767
1768
/* vfcvt.f.xu.v vd, vs2, vm # Convert unsigned integer to float. */
1769
RVVCALL(OPFVV1, vfcvt_f_xu_v_h, OP_UU_H, H2, H2, uint16_to_float16)
1770
RVVCALL(OPFVV1, vfcvt_f_xu_v_w, OP_UU_W, H4, H4, uint32_to_float32)
1771
RVVCALL(OPFVV1, vfcvt_f_xu_v_d, OP_UU_D, H8, H8, uint64_to_float64)
1772
-GEN_VEXT_V_ENV(vfcvt_f_xu_v_h, 2, 2)
1773
-GEN_VEXT_V_ENV(vfcvt_f_xu_v_w, 4, 4)
1774
-GEN_VEXT_V_ENV(vfcvt_f_xu_v_d, 8, 8)
1775
+GEN_VEXT_V_ENV(vfcvt_f_xu_v_h)
1776
+GEN_VEXT_V_ENV(vfcvt_f_xu_v_w)
1777
+GEN_VEXT_V_ENV(vfcvt_f_xu_v_d)
1778
1779
/* vfcvt.f.x.v vd, vs2, vm # Convert integer to float. */
1780
RVVCALL(OPFVV1, vfcvt_f_x_v_h, OP_UU_H, H2, H2, int16_to_float16)
1781
RVVCALL(OPFVV1, vfcvt_f_x_v_w, OP_UU_W, H4, H4, int32_to_float32)
1782
RVVCALL(OPFVV1, vfcvt_f_x_v_d, OP_UU_D, H8, H8, int64_to_float64)
1783
-GEN_VEXT_V_ENV(vfcvt_f_x_v_h, 2, 2)
1784
-GEN_VEXT_V_ENV(vfcvt_f_x_v_w, 4, 4)
1785
-GEN_VEXT_V_ENV(vfcvt_f_x_v_d, 8, 8)
1786
+GEN_VEXT_V_ENV(vfcvt_f_x_v_h)
1787
+GEN_VEXT_V_ENV(vfcvt_f_x_v_w)
1788
+GEN_VEXT_V_ENV(vfcvt_f_x_v_d)
1789
1790
/* Widening Floating-Point/Integer Type-Convert Instructions */
1791
/* (TD, T2, TX2) */
1792
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_V_ENV(vfcvt_f_x_v_d, 8, 8)
1793
/* vfwcvt.xu.f.v vd, vs2, vm # Convert float to double-width unsigned integer.*/
1794
RVVCALL(OPFVV1, vfwcvt_xu_f_v_h, WOP_UU_H, H4, H2, float16_to_uint32)
1795
RVVCALL(OPFVV1, vfwcvt_xu_f_v_w, WOP_UU_W, H8, H4, float32_to_uint64)
1796
-GEN_VEXT_V_ENV(vfwcvt_xu_f_v_h, 2, 4)
1797
-GEN_VEXT_V_ENV(vfwcvt_xu_f_v_w, 4, 8)
1798
+GEN_VEXT_V_ENV(vfwcvt_xu_f_v_h)
1799
+GEN_VEXT_V_ENV(vfwcvt_xu_f_v_w)
1800
1801
/* vfwcvt.x.f.v vd, vs2, vm # Convert float to double-width signed integer. */
1802
RVVCALL(OPFVV1, vfwcvt_x_f_v_h, WOP_UU_H, H4, H2, float16_to_int32)
1803
RVVCALL(OPFVV1, vfwcvt_x_f_v_w, WOP_UU_W, H8, H4, float32_to_int64)
1804
-GEN_VEXT_V_ENV(vfwcvt_x_f_v_h, 2, 4)
1805
-GEN_VEXT_V_ENV(vfwcvt_x_f_v_w, 4, 8)
1806
+GEN_VEXT_V_ENV(vfwcvt_x_f_v_h)
1807
+GEN_VEXT_V_ENV(vfwcvt_x_f_v_w)
1808
1809
/* vfwcvt.f.xu.v vd, vs2, vm # Convert unsigned integer to double-width float */
1810
RVVCALL(OPFVV1, vfwcvt_f_xu_v_b, WOP_UU_B, H2, H1, uint8_to_float16)
1811
RVVCALL(OPFVV1, vfwcvt_f_xu_v_h, WOP_UU_H, H4, H2, uint16_to_float32)
1812
RVVCALL(OPFVV1, vfwcvt_f_xu_v_w, WOP_UU_W, H8, H4, uint32_to_float64)
1813
-GEN_VEXT_V_ENV(vfwcvt_f_xu_v_b, 1, 2)
1814
-GEN_VEXT_V_ENV(vfwcvt_f_xu_v_h, 2, 4)
1815
-GEN_VEXT_V_ENV(vfwcvt_f_xu_v_w, 4, 8)
1816
+GEN_VEXT_V_ENV(vfwcvt_f_xu_v_b)
1817
+GEN_VEXT_V_ENV(vfwcvt_f_xu_v_h)
1818
+GEN_VEXT_V_ENV(vfwcvt_f_xu_v_w)
1819
1820
/* vfwcvt.f.x.v vd, vs2, vm # Convert integer to double-width float. */
1821
RVVCALL(OPFVV1, vfwcvt_f_x_v_b, WOP_UU_B, H2, H1, int8_to_float16)
1822
RVVCALL(OPFVV1, vfwcvt_f_x_v_h, WOP_UU_H, H4, H2, int16_to_float32)
1823
RVVCALL(OPFVV1, vfwcvt_f_x_v_w, WOP_UU_W, H8, H4, int32_to_float64)
1824
-GEN_VEXT_V_ENV(vfwcvt_f_x_v_b, 1, 2)
1825
-GEN_VEXT_V_ENV(vfwcvt_f_x_v_h, 2, 4)
1826
-GEN_VEXT_V_ENV(vfwcvt_f_x_v_w, 4, 8)
1827
+GEN_VEXT_V_ENV(vfwcvt_f_x_v_b)
1828
+GEN_VEXT_V_ENV(vfwcvt_f_x_v_h)
1829
+GEN_VEXT_V_ENV(vfwcvt_f_x_v_w)
1830
1831
/*
1832
* vfwcvt.f.f.v vd, vs2, vm
1833
@@ -XXX,XX +XXX,XX @@ static uint32_t vfwcvtffv16(uint16_t a, float_status *s)
1834
1835
RVVCALL(OPFVV1, vfwcvt_f_f_v_h, WOP_UU_H, H4, H2, vfwcvtffv16)
1836
RVVCALL(OPFVV1, vfwcvt_f_f_v_w, WOP_UU_W, H8, H4, float32_to_float64)
1837
-GEN_VEXT_V_ENV(vfwcvt_f_f_v_h, 2, 4)
1838
-GEN_VEXT_V_ENV(vfwcvt_f_f_v_w, 4, 8)
1839
+GEN_VEXT_V_ENV(vfwcvt_f_f_v_h)
1840
+GEN_VEXT_V_ENV(vfwcvt_f_f_v_w)
1841
1842
/* Narrowing Floating-Point/Integer Type-Convert Instructions */
1843
/* (TD, T2, TX2) */
1844
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_V_ENV(vfwcvt_f_f_v_w, 4, 8)
1845
RVVCALL(OPFVV1, vfncvt_xu_f_w_b, NOP_UU_B, H1, H2, float16_to_uint8)
1846
RVVCALL(OPFVV1, vfncvt_xu_f_w_h, NOP_UU_H, H2, H4, float32_to_uint16)
1847
RVVCALL(OPFVV1, vfncvt_xu_f_w_w, NOP_UU_W, H4, H8, float64_to_uint32)
1848
-GEN_VEXT_V_ENV(vfncvt_xu_f_w_b, 1, 1)
1849
-GEN_VEXT_V_ENV(vfncvt_xu_f_w_h, 2, 2)
1850
-GEN_VEXT_V_ENV(vfncvt_xu_f_w_w, 4, 4)
1851
+GEN_VEXT_V_ENV(vfncvt_xu_f_w_b)
1852
+GEN_VEXT_V_ENV(vfncvt_xu_f_w_h)
1853
+GEN_VEXT_V_ENV(vfncvt_xu_f_w_w)
1854
1855
/* vfncvt.x.f.v vd, vs2, vm # Convert double-width float to signed integer. */
1856
RVVCALL(OPFVV1, vfncvt_x_f_w_b, NOP_UU_B, H1, H2, float16_to_int8)
1857
RVVCALL(OPFVV1, vfncvt_x_f_w_h, NOP_UU_H, H2, H4, float32_to_int16)
1858
RVVCALL(OPFVV1, vfncvt_x_f_w_w, NOP_UU_W, H4, H8, float64_to_int32)
1859
-GEN_VEXT_V_ENV(vfncvt_x_f_w_b, 1, 1)
1860
-GEN_VEXT_V_ENV(vfncvt_x_f_w_h, 2, 2)
1861
-GEN_VEXT_V_ENV(vfncvt_x_f_w_w, 4, 4)
1862
+GEN_VEXT_V_ENV(vfncvt_x_f_w_b)
1863
+GEN_VEXT_V_ENV(vfncvt_x_f_w_h)
1864
+GEN_VEXT_V_ENV(vfncvt_x_f_w_w)
1865
1866
/* vfncvt.f.xu.v vd, vs2, vm # Convert double-width unsigned integer to float */
1867
RVVCALL(OPFVV1, vfncvt_f_xu_w_h, NOP_UU_H, H2, H4, uint32_to_float16)
1868
RVVCALL(OPFVV1, vfncvt_f_xu_w_w, NOP_UU_W, H4, H8, uint64_to_float32)
1869
-GEN_VEXT_V_ENV(vfncvt_f_xu_w_h, 2, 2)
1870
-GEN_VEXT_V_ENV(vfncvt_f_xu_w_w, 4, 4)
1871
+GEN_VEXT_V_ENV(vfncvt_f_xu_w_h)
1872
+GEN_VEXT_V_ENV(vfncvt_f_xu_w_w)
1873
1874
/* vfncvt.f.x.v vd, vs2, vm # Convert double-width integer to float. */
1875
RVVCALL(OPFVV1, vfncvt_f_x_w_h, NOP_UU_H, H2, H4, int32_to_float16)
1876
RVVCALL(OPFVV1, vfncvt_f_x_w_w, NOP_UU_W, H4, H8, int64_to_float32)
1877
-GEN_VEXT_V_ENV(vfncvt_f_x_w_h, 2, 2)
1878
-GEN_VEXT_V_ENV(vfncvt_f_x_w_w, 4, 4)
1879
+GEN_VEXT_V_ENV(vfncvt_f_x_w_h)
1880
+GEN_VEXT_V_ENV(vfncvt_f_x_w_w)
1881
1882
/* vfncvt.f.f.v vd, vs2, vm # Convert double float to single-width float. */
1883
static uint16_t vfncvtffv16(uint32_t a, float_status *s)
1884
@@ -XXX,XX +XXX,XX @@ static uint16_t vfncvtffv16(uint32_t a, float_status *s)
1885
1886
RVVCALL(OPFVV1, vfncvt_f_f_w_h, NOP_UU_H, H2, H4, vfncvtffv16)
1887
RVVCALL(OPFVV1, vfncvt_f_f_w_w, NOP_UU_W, H4, H8, float64_to_float32)
1888
-GEN_VEXT_V_ENV(vfncvt_f_f_w_h, 2, 2)
1889
-GEN_VEXT_V_ENV(vfncvt_f_f_w_w, 4, 4)
1890
+GEN_VEXT_V_ENV(vfncvt_f_f_w_h)
1891
+GEN_VEXT_V_ENV(vfncvt_f_f_w_w)
1892
1893
/*
1894
*** Vector Reduction Operations
1895
--
1896
2.36.1
diff view generated by jsdifflib
New patch
1
From: eopXD <yueh.ting.chen@gmail.com>
1
2
3
No functional change intended in this commit.
4
5
Signed-off-by: eop Chen <eop.chen@sifive.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-Id: <165449614532.19704.7000832880482980398-2@git.sr.ht>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
9
---
10
target/riscv/vector_helper.c | 35 ++++++++++++++++-------------------
11
1 file changed, 16 insertions(+), 19 deletions(-)
12
13
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/riscv/vector_helper.c
16
+++ b/target/riscv/vector_helper.c
17
@@ -XXX,XX +XXX,XX @@ vext_ldst_stride(void *vd, void *v0, target_ulong base,
18
target_ulong stride, CPURISCVState *env,
19
uint32_t desc, uint32_t vm,
20
vext_ldst_elem_fn *ldst_elem,
21
- uint32_t esz, uintptr_t ra, MMUAccessType access_type)
22
+ uint32_t esz, uintptr_t ra)
23
{
24
uint32_t i, k;
25
uint32_t nf = vext_nf(desc);
26
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void * v0, target_ulong base, \
27
{ \
28
uint32_t vm = vext_vm(desc); \
29
vext_ldst_stride(vd, v0, base, stride, env, desc, vm, LOAD_FN, \
30
- ctzl(sizeof(ETYPE)), GETPC(), MMU_DATA_LOAD); \
31
+ ctzl(sizeof(ETYPE)), GETPC()); \
32
}
33
34
GEN_VEXT_LD_STRIDE(vlse8_v, int8_t, lde_b)
35
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong base, \
36
{ \
37
uint32_t vm = vext_vm(desc); \
38
vext_ldst_stride(vd, v0, base, stride, env, desc, vm, STORE_FN, \
39
- ctzl(sizeof(ETYPE)), GETPC(), MMU_DATA_STORE); \
40
+ ctzl(sizeof(ETYPE)), GETPC()); \
41
}
42
43
GEN_VEXT_ST_STRIDE(vsse8_v, int8_t, ste_b)
44
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_ST_STRIDE(vsse64_v, int64_t, ste_d)
45
static void
46
vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
47
vext_ldst_elem_fn *ldst_elem, uint32_t esz, uint32_t evl,
48
- uintptr_t ra, MMUAccessType access_type)
49
+ uintptr_t ra)
50
{
51
uint32_t i, k;
52
uint32_t nf = vext_nf(desc);
53
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME##_mask)(void *vd, void *v0, target_ulong base, \
54
{ \
55
uint32_t stride = vext_nf(desc) << ctzl(sizeof(ETYPE)); \
56
vext_ldst_stride(vd, v0, base, stride, env, desc, false, LOAD_FN, \
57
- ctzl(sizeof(ETYPE)), GETPC(), MMU_DATA_LOAD); \
58
+ ctzl(sizeof(ETYPE)), GETPC()); \
59
} \
60
\
61
void HELPER(NAME)(void *vd, void *v0, target_ulong base, \
62
CPURISCVState *env, uint32_t desc) \
63
{ \
64
vext_ldst_us(vd, base, env, desc, LOAD_FN, \
65
- ctzl(sizeof(ETYPE)), env->vl, GETPC(), MMU_DATA_LOAD); \
66
+ ctzl(sizeof(ETYPE)), env->vl, GETPC()); \
67
}
68
69
GEN_VEXT_LD_US(vle8_v, int8_t, lde_b)
70
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME##_mask)(void *vd, void *v0, target_ulong base, \
71
{ \
72
uint32_t stride = vext_nf(desc) << ctzl(sizeof(ETYPE)); \
73
vext_ldst_stride(vd, v0, base, stride, env, desc, false, STORE_FN, \
74
- ctzl(sizeof(ETYPE)), GETPC(), MMU_DATA_STORE); \
75
+ ctzl(sizeof(ETYPE)), GETPC()); \
76
} \
77
\
78
void HELPER(NAME)(void *vd, void *v0, target_ulong base, \
79
CPURISCVState *env, uint32_t desc) \
80
{ \
81
vext_ldst_us(vd, base, env, desc, STORE_FN, \
82
- ctzl(sizeof(ETYPE)), env->vl, GETPC(), MMU_DATA_STORE); \
83
+ ctzl(sizeof(ETYPE)), env->vl, GETPC()); \
84
}
85
86
GEN_VEXT_ST_US(vse8_v, int8_t, ste_b)
87
@@ -XXX,XX +XXX,XX @@ void HELPER(vlm_v)(void *vd, void *v0, target_ulong base,
88
/* evl = ceil(vl/8) */
89
uint8_t evl = (env->vl + 7) >> 3;
90
vext_ldst_us(vd, base, env, desc, lde_b,
91
- 0, evl, GETPC(), MMU_DATA_LOAD);
92
+ 0, evl, GETPC());
93
}
94
95
void HELPER(vsm_v)(void *vd, void *v0, target_ulong base,
96
@@ -XXX,XX +XXX,XX @@ void HELPER(vsm_v)(void *vd, void *v0, target_ulong base,
97
/* evl = ceil(vl/8) */
98
uint8_t evl = (env->vl + 7) >> 3;
99
vext_ldst_us(vd, base, env, desc, ste_b,
100
- 0, evl, GETPC(), MMU_DATA_STORE);
101
+ 0, evl, GETPC());
102
}
103
104
/*
105
@@ -XXX,XX +XXX,XX @@ vext_ldst_index(void *vd, void *v0, target_ulong base,
106
void *vs2, CPURISCVState *env, uint32_t desc,
107
vext_get_index_addr get_index_addr,
108
vext_ldst_elem_fn *ldst_elem,
109
- uint32_t esz, uintptr_t ra, MMUAccessType access_type)
110
+ uint32_t esz, uintptr_t ra)
111
{
112
uint32_t i, k;
113
uint32_t nf = vext_nf(desc);
114
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong base, \
115
void *vs2, CPURISCVState *env, uint32_t desc) \
116
{ \
117
vext_ldst_index(vd, v0, base, vs2, env, desc, INDEX_FN, \
118
- LOAD_FN, ctzl(sizeof(ETYPE)), GETPC(), MMU_DATA_LOAD); \
119
+ LOAD_FN, ctzl(sizeof(ETYPE)), GETPC()); \
120
}
121
122
GEN_VEXT_LD_INDEX(vlxei8_8_v, int8_t, idx_b, lde_b)
123
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong base, \
124
{ \
125
vext_ldst_index(vd, v0, base, vs2, env, desc, INDEX_FN, \
126
STORE_FN, ctzl(sizeof(ETYPE)), \
127
- GETPC(), MMU_DATA_STORE); \
128
+ GETPC()); \
129
}
130
131
GEN_VEXT_ST_INDEX(vsxei8_8_v, int8_t, idx_b, ste_b)
132
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_LDFF(vle64ff_v, int64_t, lde_d)
133
*/
134
static void
135
vext_ldst_whole(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
136
- vext_ldst_elem_fn *ldst_elem, uint32_t esz, uintptr_t ra,
137
- MMUAccessType access_type)
138
+ vext_ldst_elem_fn *ldst_elem, uint32_t esz, uintptr_t ra)
139
{
140
uint32_t i, k, off, pos;
141
uint32_t nf = vext_nf(desc);
142
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, target_ulong base, \
143
CPURISCVState *env, uint32_t desc) \
144
{ \
145
vext_ldst_whole(vd, base, env, desc, LOAD_FN, \
146
- ctzl(sizeof(ETYPE)), GETPC(), \
147
- MMU_DATA_LOAD); \
148
+ ctzl(sizeof(ETYPE)), GETPC()); \
149
}
150
151
GEN_VEXT_LD_WHOLE(vl1re8_v, int8_t, lde_b)
152
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, target_ulong base, \
153
CPURISCVState *env, uint32_t desc) \
154
{ \
155
vext_ldst_whole(vd, base, env, desc, STORE_FN, \
156
- ctzl(sizeof(ETYPE)), GETPC(), \
157
- MMU_DATA_STORE); \
158
+ ctzl(sizeof(ETYPE)), GETPC()); \
159
}
160
161
GEN_VEXT_ST_WHOLE(vs1r_v, int8_t, ste_b)
162
--
163
2.36.1
diff view generated by jsdifflib
New patch
1
From: eopXD <yueh.ting.chen@gmail.com>
1
2
3
No functional change intended in this commit.
4
5
Signed-off-by: eop Chen <eop.chen@sifive.com>
6
Reviewed-by: Frank Chang <frank.chang@sifive.com>
7
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-Id: <165449614532.19704.7000832880482980398-3@git.sr.ht>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
target/riscv/vector_helper.c | 76 ++++++++++++++++++------------------
13
1 file changed, 38 insertions(+), 38 deletions(-)
14
15
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/riscv/vector_helper.c
18
+++ b/target/riscv/vector_helper.c
19
@@ -XXX,XX +XXX,XX @@ static inline int32_t vext_lmul(uint32_t desc)
20
/*
21
* Get the maximum number of elements can be operated.
22
*
23
- * esz: log2 of element size in bytes.
24
+ * log2_esz: log2 of element size in bytes.
25
*/
26
-static inline uint32_t vext_max_elems(uint32_t desc, uint32_t esz)
27
+static inline uint32_t vext_max_elems(uint32_t desc, uint32_t log2_esz)
28
{
29
/*
30
* As simd_desc support at most 2048 bytes, the max vlen is 1024 bits.
31
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vext_max_elems(uint32_t desc, uint32_t esz)
32
uint32_t vlenb = simd_maxsz(desc);
33
34
/* Return VLMAX */
35
- int scale = vext_lmul(desc) - esz;
36
+ int scale = vext_lmul(desc) - log2_esz;
37
return scale < 0 ? vlenb >> -scale : vlenb << scale;
38
}
39
40
@@ -XXX,XX +XXX,XX @@ vext_ldst_stride(void *vd, void *v0, target_ulong base,
41
target_ulong stride, CPURISCVState *env,
42
uint32_t desc, uint32_t vm,
43
vext_ldst_elem_fn *ldst_elem,
44
- uint32_t esz, uintptr_t ra)
45
+ uint32_t log2_esz, uintptr_t ra)
46
{
47
uint32_t i, k;
48
uint32_t nf = vext_nf(desc);
49
- uint32_t max_elems = vext_max_elems(desc, esz);
50
+ uint32_t max_elems = vext_max_elems(desc, log2_esz);
51
52
for (i = env->vstart; i < env->vl; i++, env->vstart++) {
53
if (!vm && !vext_elem_mask(v0, i)) {
54
@@ -XXX,XX +XXX,XX @@ vext_ldst_stride(void *vd, void *v0, target_ulong base,
55
56
k = 0;
57
while (k < nf) {
58
- target_ulong addr = base + stride * i + (k << esz);
59
+ target_ulong addr = base + stride * i + (k << log2_esz);
60
ldst_elem(env, adjust_addr(env, addr), i + k * max_elems, vd, ra);
61
k++;
62
}
63
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_ST_STRIDE(vsse64_v, int64_t, ste_d)
64
/* unmasked unit-stride load and store operation*/
65
static void
66
vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
67
- vext_ldst_elem_fn *ldst_elem, uint32_t esz, uint32_t evl,
68
+ vext_ldst_elem_fn *ldst_elem, uint32_t log2_esz, uint32_t evl,
69
uintptr_t ra)
70
{
71
uint32_t i, k;
72
uint32_t nf = vext_nf(desc);
73
- uint32_t max_elems = vext_max_elems(desc, esz);
74
+ uint32_t max_elems = vext_max_elems(desc, log2_esz);
75
76
/* load bytes from guest memory */
77
for (i = env->vstart; i < evl; i++, env->vstart++) {
78
k = 0;
79
while (k < nf) {
80
- target_ulong addr = base + ((i * nf + k) << esz);
81
+ target_ulong addr = base + ((i * nf + k) << log2_esz);
82
ldst_elem(env, adjust_addr(env, addr), i + k * max_elems, vd, ra);
83
k++;
84
}
85
@@ -XXX,XX +XXX,XX @@ vext_ldst_index(void *vd, void *v0, target_ulong base,
86
void *vs2, CPURISCVState *env, uint32_t desc,
87
vext_get_index_addr get_index_addr,
88
vext_ldst_elem_fn *ldst_elem,
89
- uint32_t esz, uintptr_t ra)
90
+ uint32_t log2_esz, uintptr_t ra)
91
{
92
uint32_t i, k;
93
uint32_t nf = vext_nf(desc);
94
uint32_t vm = vext_vm(desc);
95
- uint32_t max_elems = vext_max_elems(desc, esz);
96
+ uint32_t max_elems = vext_max_elems(desc, log2_esz);
97
98
/* load bytes from guest memory */
99
for (i = env->vstart; i < env->vl; i++, env->vstart++) {
100
@@ -XXX,XX +XXX,XX @@ vext_ldst_index(void *vd, void *v0, target_ulong base,
101
102
k = 0;
103
while (k < nf) {
104
- abi_ptr addr = get_index_addr(base, i, vs2) + (k << esz);
105
+ abi_ptr addr = get_index_addr(base, i, vs2) + (k << log2_esz);
106
ldst_elem(env, adjust_addr(env, addr), i + k * max_elems, vd, ra);
107
k++;
108
}
109
@@ -XXX,XX +XXX,XX @@ static inline void
110
vext_ldff(void *vd, void *v0, target_ulong base,
111
CPURISCVState *env, uint32_t desc,
112
vext_ldst_elem_fn *ldst_elem,
113
- uint32_t esz, uintptr_t ra)
114
+ uint32_t log2_esz, uintptr_t ra)
115
{
116
void *host;
117
uint32_t i, k, vl = 0;
118
uint32_t nf = vext_nf(desc);
119
uint32_t vm = vext_vm(desc);
120
- uint32_t max_elems = vext_max_elems(desc, esz);
121
+ uint32_t max_elems = vext_max_elems(desc, log2_esz);
122
target_ulong addr, offset, remain;
123
124
/* probe every access*/
125
@@ -XXX,XX +XXX,XX @@ vext_ldff(void *vd, void *v0, target_ulong base,
126
if (!vm && !vext_elem_mask(v0, i)) {
127
continue;
128
}
129
- addr = adjust_addr(env, base + i * (nf << esz));
130
+ addr = adjust_addr(env, base + i * (nf << log2_esz));
131
if (i == 0) {
132
- probe_pages(env, addr, nf << esz, ra, MMU_DATA_LOAD);
133
+ probe_pages(env, addr, nf << log2_esz, ra, MMU_DATA_LOAD);
134
} else {
135
/* if it triggers an exception, no need to check watchpoint */
136
- remain = nf << esz;
137
+ remain = nf << log2_esz;
138
while (remain > 0) {
139
offset = -(addr | TARGET_PAGE_MASK);
140
host = tlb_vaddr_to_host(env, addr, MMU_DATA_LOAD,
141
@@ -XXX,XX +XXX,XX @@ ProbeSuccess:
142
continue;
143
}
144
while (k < nf) {
145
- target_ulong addr = base + ((i * nf + k) << esz);
146
+ target_ulong addr = base + ((i * nf + k) << log2_esz);
147
ldst_elem(env, adjust_addr(env, addr), i + k * max_elems, vd, ra);
148
k++;
149
}
150
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_LDFF(vle64ff_v, int64_t, lde_d)
151
*/
152
static void
153
vext_ldst_whole(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
154
- vext_ldst_elem_fn *ldst_elem, uint32_t esz, uintptr_t ra)
155
+ vext_ldst_elem_fn *ldst_elem, uint32_t log2_esz, uintptr_t ra)
156
{
157
uint32_t i, k, off, pos;
158
uint32_t nf = vext_nf(desc);
159
uint32_t vlenb = env_archcpu(env)->cfg.vlen >> 3;
160
- uint32_t max_elems = vlenb >> esz;
161
+ uint32_t max_elems = vlenb >> log2_esz;
162
163
k = env->vstart / max_elems;
164
off = env->vstart % max_elems;
165
@@ -XXX,XX +XXX,XX @@ vext_ldst_whole(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
166
if (off) {
167
/* load/store rest of elements of current segment pointed by vstart */
168
for (pos = off; pos < max_elems; pos++, env->vstart++) {
169
- target_ulong addr = base + ((pos + k * max_elems) << esz);
170
+ target_ulong addr = base + ((pos + k * max_elems) << log2_esz);
171
ldst_elem(env, adjust_addr(env, addr), pos + k * max_elems, vd, ra);
172
}
173
k++;
174
@@ -XXX,XX +XXX,XX @@ vext_ldst_whole(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
175
/* load/store elements for rest of segments */
176
for (; k < nf; k++) {
177
for (i = 0; i < max_elems; i++, env->vstart++) {
178
- target_ulong addr = base + ((i + k * max_elems) << esz);
179
+ target_ulong addr = base + ((i + k * max_elems) << log2_esz);
180
ldst_elem(env, adjust_addr(env, addr), i + k * max_elems, vd, ra);
181
}
182
}
183
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_VSLIDEDOWN_VX(vslidedown_vx_h, uint16_t, H2)
184
GEN_VEXT_VSLIDEDOWN_VX(vslidedown_vx_w, uint32_t, H4)
185
GEN_VEXT_VSLIDEDOWN_VX(vslidedown_vx_d, uint64_t, H8)
186
187
-#define GEN_VEXT_VSLIE1UP(ESZ, H) \
188
-static void vslide1up_##ESZ(void *vd, void *v0, target_ulong s1, void *vs2, \
189
- CPURISCVState *env, uint32_t desc) \
190
+#define GEN_VEXT_VSLIE1UP(BITWIDTH, H) \
191
+static void vslide1up_##BITWIDTH(void *vd, void *v0, target_ulong s1, \
192
+ void *vs2, CPURISCVState *env, uint32_t desc) \
193
{ \
194
- typedef uint##ESZ##_t ETYPE; \
195
+ typedef uint##BITWIDTH##_t ETYPE; \
196
uint32_t vm = vext_vm(desc); \
197
uint32_t vl = env->vl; \
198
uint32_t i; \
199
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_VSLIE1UP(16, H2)
200
GEN_VEXT_VSLIE1UP(32, H4)
201
GEN_VEXT_VSLIE1UP(64, H8)
202
203
-#define GEN_VEXT_VSLIDE1UP_VX(NAME, ESZ) \
204
+#define GEN_VEXT_VSLIDE1UP_VX(NAME, BITWIDTH) \
205
void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
206
CPURISCVState *env, uint32_t desc) \
207
{ \
208
- vslide1up_##ESZ(vd, v0, s1, vs2, env, desc); \
209
+ vslide1up_##BITWIDTH(vd, v0, s1, vs2, env, desc); \
210
}
211
212
/* vslide1up.vx vd, vs2, rs1, vm # vd[0]=x[rs1], vd[i+1] = vs2[i] */
213
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_VSLIDE1UP_VX(vslide1up_vx_h, 16)
214
GEN_VEXT_VSLIDE1UP_VX(vslide1up_vx_w, 32)
215
GEN_VEXT_VSLIDE1UP_VX(vslide1up_vx_d, 64)
216
217
-#define GEN_VEXT_VSLIDE1DOWN(ESZ, H) \
218
-static void vslide1down_##ESZ(void *vd, void *v0, target_ulong s1, void *vs2, \
219
- CPURISCVState *env, uint32_t desc) \
220
+#define GEN_VEXT_VSLIDE1DOWN(BITWIDTH, H) \
221
+static void vslide1down_##BITWIDTH(void *vd, void *v0, target_ulong s1, \
222
+ void *vs2, CPURISCVState *env, uint32_t desc) \
223
{ \
224
- typedef uint##ESZ##_t ETYPE; \
225
+ typedef uint##BITWIDTH##_t ETYPE; \
226
uint32_t vm = vext_vm(desc); \
227
uint32_t vl = env->vl; \
228
uint32_t i; \
229
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_VSLIDE1DOWN(16, H2)
230
GEN_VEXT_VSLIDE1DOWN(32, H4)
231
GEN_VEXT_VSLIDE1DOWN(64, H8)
232
233
-#define GEN_VEXT_VSLIDE1DOWN_VX(NAME, ESZ) \
234
+#define GEN_VEXT_VSLIDE1DOWN_VX(NAME, BITWIDTH) \
235
void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
236
CPURISCVState *env, uint32_t desc) \
237
{ \
238
- vslide1down_##ESZ(vd, v0, s1, vs2, env, desc); \
239
+ vslide1down_##BITWIDTH(vd, v0, s1, vs2, env, desc); \
240
}
241
242
/* vslide1down.vx vd, vs2, rs1, vm # vd[i] = vs2[i+1], vd[vl-1]=x[rs1] */
243
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_VSLIDE1DOWN_VX(vslide1down_vx_w, 32)
244
GEN_VEXT_VSLIDE1DOWN_VX(vslide1down_vx_d, 64)
245
246
/* Vector Floating-Point Slide Instructions */
247
-#define GEN_VEXT_VFSLIDE1UP_VF(NAME, ESZ) \
248
+#define GEN_VEXT_VFSLIDE1UP_VF(NAME, BITWIDTH) \
249
void HELPER(NAME)(void *vd, void *v0, uint64_t s1, void *vs2, \
250
CPURISCVState *env, uint32_t desc) \
251
{ \
252
- vslide1up_##ESZ(vd, v0, s1, vs2, env, desc); \
253
+ vslide1up_##BITWIDTH(vd, v0, s1, vs2, env, desc); \
254
}
255
256
/* vfslide1up.vf vd, vs2, rs1, vm # vd[0]=f[rs1], vd[i+1] = vs2[i] */
257
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_VFSLIDE1UP_VF(vfslide1up_vf_h, 16)
258
GEN_VEXT_VFSLIDE1UP_VF(vfslide1up_vf_w, 32)
259
GEN_VEXT_VFSLIDE1UP_VF(vfslide1up_vf_d, 64)
260
261
-#define GEN_VEXT_VFSLIDE1DOWN_VF(NAME, ESZ) \
262
+#define GEN_VEXT_VFSLIDE1DOWN_VF(NAME, BITWIDTH) \
263
void HELPER(NAME)(void *vd, void *v0, uint64_t s1, void *vs2, \
264
CPURISCVState *env, uint32_t desc) \
265
{ \
266
- vslide1down_##ESZ(vd, v0, s1, vs2, env, desc); \
267
+ vslide1down_##BITWIDTH(vd, v0, s1, vs2, env, desc); \
268
}
269
270
/* vfslide1down.vf vd, vs2, rs1, vm # vd[i] = vs2[i+1], vd[vl-1]=f[rs1] */
271
--
272
2.36.1
diff view generated by jsdifflib
New patch
1
1
From: eopXD <yueh.ting.chen@gmail.com>
2
3
According to v-spec (section 5.4):
4
When vstart ≥ vl, there are no body elements, and no elements are
5
updated in any destination vector register group, including that
6
no tail elements are updated with agnostic values.
7
8
vmsbf.m, vmsif.m, vmsof.m, viota.m, vcompress instructions themselves
9
require vstart to be zero. So they don't need the early exit.
10
11
Signed-off-by: eop Chen <eop.chen@sifive.com>
12
Reviewed-by: Frank Chang <frank.chang@sifive.com>
13
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
14
Acked-by: Alistair Francis <alistair.francis@wdc.com>
15
Message-Id: <165449614532.19704.7000832880482980398-4@git.sr.ht>
16
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
---
18
target/riscv/insn_trans/trans_rvv.c.inc | 27 +++++++++++++++++++++++++
19
1 file changed, 27 insertions(+)
20
21
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
22
index XXXXXXX..XXXXXXX 100644
23
--- a/target/riscv/insn_trans/trans_rvv.c.inc
24
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
25
@@ -XXX,XX +XXX,XX @@ static bool ldst_us_trans(uint32_t vd, uint32_t rs1, uint32_t data,
26
27
TCGLabel *over = gen_new_label();
28
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
29
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
30
31
dest = tcg_temp_new_ptr();
32
mask = tcg_temp_new_ptr();
33
@@ -XXX,XX +XXX,XX @@ static bool ldst_stride_trans(uint32_t vd, uint32_t rs1, uint32_t rs2,
34
35
TCGLabel *over = gen_new_label();
36
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
37
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
38
39
dest = tcg_temp_new_ptr();
40
mask = tcg_temp_new_ptr();
41
@@ -XXX,XX +XXX,XX @@ static bool ldst_index_trans(uint32_t vd, uint32_t rs1, uint32_t vs2,
42
43
TCGLabel *over = gen_new_label();
44
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
45
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
46
47
dest = tcg_temp_new_ptr();
48
mask = tcg_temp_new_ptr();
49
@@ -XXX,XX +XXX,XX @@ static bool ldff_trans(uint32_t vd, uint32_t rs1, uint32_t data,
50
51
TCGLabel *over = gen_new_label();
52
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
53
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
54
55
dest = tcg_temp_new_ptr();
56
mask = tcg_temp_new_ptr();
57
@@ -XXX,XX +XXX,XX @@ do_opivv_gvec(DisasContext *s, arg_rmrr *a, GVecGen3Fn *gvec_fn,
58
}
59
60
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
61
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
62
63
if (a->vm && s->vl_eq_vlmax) {
64
gvec_fn(s->sew, vreg_ofs(s, a->rd),
65
@@ -XXX,XX +XXX,XX @@ static bool opivx_trans(uint32_t vd, uint32_t rs1, uint32_t vs2, uint32_t vm,
66
67
TCGLabel *over = gen_new_label();
68
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
69
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
70
71
dest = tcg_temp_new_ptr();
72
mask = tcg_temp_new_ptr();
73
@@ -XXX,XX +XXX,XX @@ static bool opivi_trans(uint32_t vd, uint32_t imm, uint32_t vs2, uint32_t vm,
74
75
TCGLabel *over = gen_new_label();
76
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
77
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
78
79
dest = tcg_temp_new_ptr();
80
mask = tcg_temp_new_ptr();
81
@@ -XXX,XX +XXX,XX @@ static bool do_opivv_widen(DisasContext *s, arg_rmrr *a,
82
uint32_t data = 0;
83
TCGLabel *over = gen_new_label();
84
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
85
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
86
87
data = FIELD_DP32(data, VDATA, VM, a->vm);
88
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
89
@@ -XXX,XX +XXX,XX @@ static bool do_opiwv_widen(DisasContext *s, arg_rmrr *a,
90
uint32_t data = 0;
91
TCGLabel *over = gen_new_label();
92
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
93
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
94
95
data = FIELD_DP32(data, VDATA, VM, a->vm);
96
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
97
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
98
}; \
99
TCGLabel *over = gen_new_label(); \
100
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
101
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
102
\
103
data = FIELD_DP32(data, VDATA, VM, a->vm); \
104
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
105
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
106
}; \
107
TCGLabel *over = gen_new_label(); \
108
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
109
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
110
\
111
data = FIELD_DP32(data, VDATA, VM, a->vm); \
112
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
113
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_v(DisasContext *s, arg_vmv_v_v *a)
114
};
115
TCGLabel *over = gen_new_label();
116
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
117
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
118
119
tcg_gen_gvec_2_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, a->rs1),
120
cpu_env, s->cfg_ptr->vlen / 8,
121
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_x(DisasContext *s, arg_vmv_v_x *a)
122
TCGv s1;
123
TCGLabel *over = gen_new_label();
124
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
125
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
126
127
s1 = get_gpr(s, a->rs1, EXT_SIGN);
128
129
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
130
};
131
TCGLabel *over = gen_new_label();
132
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
133
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
134
135
s1 = tcg_constant_i64(simm);
136
dest = tcg_temp_new_ptr();
137
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
138
TCGLabel *over = gen_new_label(); \
139
gen_set_rm(s, RISCV_FRM_DYN); \
140
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
141
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
142
\
143
data = FIELD_DP32(data, VDATA, VM, a->vm); \
144
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
145
@@ -XXX,XX +XXX,XX @@ static bool opfvf_trans(uint32_t vd, uint32_t rs1, uint32_t vs2,
146
147
TCGLabel *over = gen_new_label();
148
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
149
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
150
151
dest = tcg_temp_new_ptr();
152
mask = tcg_temp_new_ptr();
153
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
154
TCGLabel *over = gen_new_label(); \
155
gen_set_rm(s, RISCV_FRM_DYN); \
156
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
157
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);\
158
\
159
data = FIELD_DP32(data, VDATA, VM, a->vm); \
160
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
161
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
162
TCGLabel *over = gen_new_label(); \
163
gen_set_rm(s, RISCV_FRM_DYN); \
164
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
165
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
166
\
167
data = FIELD_DP32(data, VDATA, VM, a->vm); \
168
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
169
@@ -XXX,XX +XXX,XX @@ static bool do_opfv(DisasContext *s, arg_rmr *a,
170
TCGLabel *over = gen_new_label();
171
gen_set_rm(s, rm);
172
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
173
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
174
175
data = FIELD_DP32(data, VDATA, VM, a->vm);
176
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
177
@@ -XXX,XX +XXX,XX @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a)
178
};
179
TCGLabel *over = gen_new_label();
180
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
181
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
182
183
t1 = tcg_temp_new_i64();
184
/* NaN-box f[rs1] */
185
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
186
TCGLabel *over = gen_new_label(); \
187
gen_set_rm(s, FRM); \
188
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
189
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
190
\
191
data = FIELD_DP32(data, VDATA, VM, a->vm); \
192
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
193
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
194
TCGLabel *over = gen_new_label(); \
195
gen_set_rm(s, RISCV_FRM_DYN); \
196
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
197
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
198
\
199
data = FIELD_DP32(data, VDATA, VM, a->vm); \
200
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
201
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
202
TCGLabel *over = gen_new_label(); \
203
gen_set_rm(s, FRM); \
204
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
205
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
206
\
207
data = FIELD_DP32(data, VDATA, VM, a->vm); \
208
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
209
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
210
TCGLabel *over = gen_new_label(); \
211
gen_set_rm(s, FRM); \
212
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
213
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
214
\
215
data = FIELD_DP32(data, VDATA, VM, a->vm); \
216
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
217
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_r *a) \
218
gen_helper_gvec_4_ptr *fn = gen_helper_##NAME; \
219
TCGLabel *over = gen_new_label(); \
220
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over); \
221
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
222
\
223
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
224
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
225
@@ -XXX,XX +XXX,XX @@ static bool trans_vid_v(DisasContext *s, arg_vid_v *a)
226
uint32_t data = 0;
227
TCGLabel *over = gen_new_label();
228
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
229
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
230
231
data = FIELD_DP32(data, VDATA, VM, a->vm);
232
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
233
@@ -XXX,XX +XXX,XX @@ static bool int_ext_op(DisasContext *s, arg_rmr *a, uint8_t seq)
234
gen_helper_gvec_3_ptr *fn;
235
TCGLabel *over = gen_new_label();
236
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
237
+ tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
238
239
static gen_helper_gvec_3_ptr * const fns[6][4] = {
240
{
241
--
242
2.36.1
diff view generated by jsdifflib
1
From: Jim Shu <cwshu@andestech.com>
1
From: eopXD <eop.chen@sifive.com>
2
2
3
Currently, PMP permission checking of TLB page is bypassed if TLB hits
3
According to v-spec, tail agnostic behavior can be either kept as
4
Fix it by propagating PMP permission to TLB page permission.
4
undisturbed or set elements' bits to all 1s. To distinguish the
5
difference of tail policies, QEMU should be able to simulate the tail
6
agnostic behavior as "set tail elements' bits to all 1s".
5
7
6
PMP permission checking also use MMU-style API to change TLB permission
8
There are multiple possibility for agnostic elements according to
7
and size.
9
v-spec. The main intent of this patch-set tries to add option that
10
can distinguish between tail policies. Setting agnostic elements to
11
all 1s allows QEMU to express this.
8
12
9
Signed-off-by: Jim Shu <cwshu@andestech.com>
13
This is the first commit regarding the optional tail agnostic
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
behavior. Follow-up commits will add this optional behavior
11
Message-id: 1613916082-19528-2-git-send-email-cwshu@andestech.com
15
for all rvv instructions.
16
17
Signed-off-by: eop Chen <eop.chen@sifive.com>
18
Reviewed-by: Frank Chang <frank.chang@sifive.com>
19
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
20
Acked-by: Alistair Francis <alistair.francis@wdc.com>
21
Message-Id: <165449614532.19704.7000832880482980398-5@git.sr.ht>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
22
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
23
---
14
target/riscv/pmp.h | 4 +-
24
target/riscv/cpu.h | 2 +
15
target/riscv/cpu_helper.c | 84 +++++++++++++++++++++++++++++----------
25
target/riscv/internals.h | 5 +-
16
target/riscv/pmp.c | 80 +++++++++++++++++++++++++++----------
26
target/riscv/cpu_helper.c | 2 +
17
3 files changed, 125 insertions(+), 43 deletions(-)
27
target/riscv/translate.c | 2 +
28
target/riscv/vector_helper.c | 296 +++++++++++++-----------
29
target/riscv/insn_trans/trans_rvv.c.inc | 3 +-
30
6 files changed, 178 insertions(+), 132 deletions(-)
18
31
19
diff --git a/target/riscv/pmp.h b/target/riscv/pmp.h
32
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
20
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
21
--- a/target/riscv/pmp.h
34
--- a/target/riscv/cpu.h
22
+++ b/target/riscv/pmp.h
35
+++ b/target/riscv/cpu.h
23
@@ -XXX,XX +XXX,XX @@ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
36
@@ -XXX,XX +XXX,XX @@ struct RISCVCPUConfig {
24
target_ulong val);
37
bool ext_zve32f;
25
target_ulong pmpaddr_csr_read(CPURISCVState *env, uint32_t addr_index);
38
bool ext_zve64f;
26
bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
39
bool ext_zmmul;
27
- target_ulong size, pmp_priv_t priv, target_ulong mode);
40
+ bool rvv_ta_all_1s;
28
+ target_ulong size, pmp_priv_t privs, pmp_priv_t *allowed_privs,
41
29
+ target_ulong mode);
42
uint32_t mvendorid;
30
bool pmp_is_range_in_tlb(CPURISCVState *env, hwaddr tlb_sa,
43
uint64_t marchid;
31
target_ulong *tlb_size);
44
@@ -XXX,XX +XXX,XX @@ FIELD(TB_FLAGS, XL, 20, 2)
32
void pmp_update_rule_addr(CPURISCVState *env, uint32_t pmp_index);
45
/* If PointerMasking should be applied */
33
void pmp_update_rule_nums(CPURISCVState *env);
46
FIELD(TB_FLAGS, PM_MASK_ENABLED, 22, 1)
34
uint32_t pmp_get_num_rules(CPURISCVState *env);
47
FIELD(TB_FLAGS, PM_BASE_ENABLED, 23, 1)
35
+int pmp_priv_to_page_prot(pmp_priv_t pmp_priv);
48
+FIELD(TB_FLAGS, VTA, 24, 1)
36
49
37
#endif
50
#ifdef TARGET_RISCV32
51
#define riscv_cpu_mxl(env) ((void)(env), MXL_RV32)
52
diff --git a/target/riscv/internals.h b/target/riscv/internals.h
53
index XXXXXXX..XXXXXXX 100644
54
--- a/target/riscv/internals.h
55
+++ b/target/riscv/internals.h
56
@@ -XXX,XX +XXX,XX @@
57
/* share data between vector helpers and decode code */
58
FIELD(VDATA, VM, 0, 1)
59
FIELD(VDATA, LMUL, 1, 3)
60
-FIELD(VDATA, NF, 4, 4)
61
-FIELD(VDATA, WD, 4, 1)
62
+FIELD(VDATA, VTA, 4, 1)
63
+FIELD(VDATA, NF, 5, 4)
64
+FIELD(VDATA, WD, 5, 1)
65
66
/* float point classify helpers */
67
target_ulong fclass_h(uint64_t frs1);
38
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
68
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
39
index XXXXXXX..XXXXXXX 100644
69
index XXXXXXX..XXXXXXX 100644
40
--- a/target/riscv/cpu_helper.c
70
--- a/target/riscv/cpu_helper.c
41
+++ b/target/riscv/cpu_helper.c
71
+++ b/target/riscv/cpu_helper.c
42
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_set_mode(CPURISCVState *env, target_ulong newpriv)
72
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
43
env->load_res = -1;
73
flags = FIELD_DP32(flags, TB_FLAGS, LMUL,
74
FIELD_EX64(env->vtype, VTYPE, VLMUL));
75
flags = FIELD_DP32(flags, TB_FLAGS, VL_EQ_VLMAX, vl_eq_vlmax);
76
+ flags = FIELD_DP32(flags, TB_FLAGS, VTA,
77
+ FIELD_EX64(env->vtype, VTYPE, VTA));
78
} else {
79
flags = FIELD_DP32(flags, TB_FLAGS, VILL, 1);
80
}
81
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/riscv/translate.c
84
+++ b/target/riscv/translate.c
85
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
86
*/
87
int8_t lmul;
88
uint8_t sew;
89
+ uint8_t vta;
90
target_ulong vstart;
91
bool vl_eq_vlmax;
92
uint8_t ntemp;
93
@@ -XXX,XX +XXX,XX @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
94
ctx->vill = FIELD_EX32(tb_flags, TB_FLAGS, VILL);
95
ctx->sew = FIELD_EX32(tb_flags, TB_FLAGS, SEW);
96
ctx->lmul = sextract32(FIELD_EX32(tb_flags, TB_FLAGS, LMUL), 0, 3);
97
+ ctx->vta = FIELD_EX32(tb_flags, TB_FLAGS, VTA) && cpu->cfg.rvv_ta_all_1s;
98
ctx->vstart = env->vstart;
99
ctx->vl_eq_vlmax = FIELD_EX32(tb_flags, TB_FLAGS, VL_EQ_VLMAX);
100
ctx->misa_mxl_max = env->misa_mxl_max;
101
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
102
index XXXXXXX..XXXXXXX 100644
103
--- a/target/riscv/vector_helper.c
104
+++ b/target/riscv/vector_helper.c
105
@@ -XXX,XX +XXX,XX @@ static inline int32_t vext_lmul(uint32_t desc)
106
return sextract32(FIELD_EX32(simd_data(desc), VDATA, LMUL), 0, 3);
44
}
107
}
45
108
46
+/*
109
+static inline uint32_t vext_vta(uint32_t desc)
47
+ * get_physical_address_pmp - check PMP permission for this physical address
48
+ *
49
+ * Match the PMP region and check permission for this physical address and it's
50
+ * TLB page. Returns 0 if the permission checking was successful
51
+ *
52
+ * @env: CPURISCVState
53
+ * @prot: The returned protection attributes
54
+ * @tlb_size: TLB page size containing addr. It could be modified after PMP
55
+ * permission checking. NULL if not set TLB page for addr.
56
+ * @addr: The physical address to be checked permission
57
+ * @access_type: The type of MMU access
58
+ * @mode: Indicates current privilege level.
59
+ */
60
+static int get_physical_address_pmp(CPURISCVState *env, int *prot,
61
+ target_ulong *tlb_size, hwaddr addr,
62
+ int size, MMUAccessType access_type,
63
+ int mode)
64
+{
110
+{
65
+ pmp_priv_t pmp_priv;
111
+ return FIELD_EX32(simd_data(desc), VDATA, VTA);
66
+ target_ulong tlb_size_pmp = 0;
67
+
68
+ if (!riscv_feature(env, RISCV_FEATURE_PMP)) {
69
+ *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
70
+ return TRANSLATE_SUCCESS;
71
+ }
72
+
73
+ if (!pmp_hart_has_privs(env, addr, size, 1 << access_type, &pmp_priv,
74
+ mode)) {
75
+ *prot = 0;
76
+ return TRANSLATE_PMP_FAIL;
77
+ }
78
+
79
+ *prot = pmp_priv_to_page_prot(pmp_priv);
80
+ if (tlb_size != NULL) {
81
+ if (pmp_is_range_in_tlb(env, addr & ~(*tlb_size - 1), &tlb_size_pmp)) {
82
+ *tlb_size = tlb_size_pmp;
83
+ }
84
+ }
85
+
86
+ return TRANSLATE_SUCCESS;
87
+}
112
+}
88
+
113
+
89
/* get_physical_address - get the physical address for this virtual address
114
/*
115
* Get the maximum number of elements can be operated.
90
*
116
*
91
* Do a page table walk to obtain the physical address corresponding to a
117
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vext_max_elems(uint32_t desc, uint32_t log2_esz)
92
@@ -XXX,XX +XXX,XX @@ restart:
118
return scale < 0 ? vlenb >> -scale : vlenb << scale;
93
pte_addr = base + idx * ptesize;
94
}
95
96
- if (riscv_feature(env, RISCV_FEATURE_PMP) &&
97
- !pmp_hart_has_privs(env, pte_addr, sizeof(target_ulong),
98
- 1 << MMU_DATA_LOAD, PRV_S)) {
99
+ int pmp_prot;
100
+ int pmp_ret = get_physical_address_pmp(env, &pmp_prot, NULL, pte_addr,
101
+ sizeof(target_ulong),
102
+ MMU_DATA_LOAD, PRV_S);
103
+ if (pmp_ret != TRANSLATE_SUCCESS) {
104
return TRANSLATE_PMP_FAIL;
105
}
106
107
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
108
#ifndef CONFIG_USER_ONLY
109
vaddr im_address;
110
hwaddr pa = 0;
111
- int prot, prot2;
112
+ int prot, prot2, prot_pmp;
113
bool pmp_violation = false;
114
bool first_stage_error = true;
115
bool two_stage_lookup = false;
116
int ret = TRANSLATE_FAIL;
117
int mode = mmu_idx;
118
- target_ulong tlb_size = 0;
119
+ /* default TLB page size */
120
+ target_ulong tlb_size = TARGET_PAGE_SIZE;
121
122
env->guest_phys_fault_addr = 0;
123
124
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
125
126
prot &= prot2;
127
128
- if (riscv_feature(env, RISCV_FEATURE_PMP) &&
129
- (ret == TRANSLATE_SUCCESS) &&
130
- !pmp_hart_has_privs(env, pa, size, 1 << access_type, mode)) {
131
- ret = TRANSLATE_PMP_FAIL;
132
+ if (ret == TRANSLATE_SUCCESS) {
133
+ ret = get_physical_address_pmp(env, &prot_pmp, &tlb_size, pa,
134
+ size, access_type, mode);
135
+ prot &= prot_pmp;
136
}
137
138
if (ret != TRANSLATE_SUCCESS) {
139
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
140
"%s address=%" VADDR_PRIx " ret %d physical "
141
TARGET_FMT_plx " prot %d\n",
142
__func__, address, ret, pa, prot);
143
- }
144
145
- if (riscv_feature(env, RISCV_FEATURE_PMP) &&
146
- (ret == TRANSLATE_SUCCESS) &&
147
- !pmp_hart_has_privs(env, pa, size, 1 << access_type, mode)) {
148
- ret = TRANSLATE_PMP_FAIL;
149
+ if (ret == TRANSLATE_SUCCESS) {
150
+ ret = get_physical_address_pmp(env, &prot_pmp, &tlb_size, pa,
151
+ size, access_type, mode);
152
+ prot &= prot_pmp;
153
+ }
154
}
155
+
156
if (ret == TRANSLATE_PMP_FAIL) {
157
pmp_violation = true;
158
}
159
160
if (ret == TRANSLATE_SUCCESS) {
161
- if (pmp_is_range_in_tlb(env, pa & TARGET_PAGE_MASK, &tlb_size)) {
162
- tlb_set_page(cs, address & ~(tlb_size - 1), pa & ~(tlb_size - 1),
163
- prot, mmu_idx, tlb_size);
164
- } else {
165
- tlb_set_page(cs, address & TARGET_PAGE_MASK, pa & TARGET_PAGE_MASK,
166
- prot, mmu_idx, TARGET_PAGE_SIZE);
167
- }
168
+ tlb_set_page(cs, address & ~(tlb_size - 1), pa & ~(tlb_size - 1),
169
+ prot, mmu_idx, tlb_size);
170
return true;
171
} else if (probe) {
172
return false;
173
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
174
index XXXXXXX..XXXXXXX 100644
175
--- a/target/riscv/pmp.c
176
+++ b/target/riscv/pmp.c
177
@@ -XXX,XX +XXX,XX @@ static int pmp_is_in_range(CPURISCVState *env, int pmp_index, target_ulong addr)
178
return result;
179
}
119
}
180
120
181
+/*
121
+/*
182
+ * Check if the address has required RWX privs when no PMP entry is matched.
122
+ * Get number of total elements, including prestart, body and tail elements.
123
+ * Note that when LMUL < 1, the tail includes the elements past VLMAX that
124
+ * are held in the same vector register.
183
+ */
125
+ */
184
+static bool pmp_hart_has_privs_default(CPURISCVState *env, target_ulong addr,
126
+static inline uint32_t vext_get_total_elems(CPURISCVState *env, uint32_t desc,
185
+ target_ulong size, pmp_priv_t privs, pmp_priv_t *allowed_privs,
127
+ uint32_t esz)
186
+ target_ulong mode)
187
+{
128
+{
188
+ bool ret;
129
+ uint32_t vlenb = simd_maxsz(desc);
189
+
130
+ uint32_t sew = 1 << FIELD_EX64(env->vtype, VTYPE, VSEW);
190
+ if ((!riscv_feature(env, RISCV_FEATURE_PMP)) || (mode == PRV_M)) {
131
+ int8_t emul = ctzl(esz) - ctzl(sew) + vext_lmul(desc) < 0 ? 0 :
191
+ /*
132
+ ctzl(esz) - ctzl(sew) + vext_lmul(desc);
192
+ * Privileged spec v1.10 states if HW doesn't implement any PMP entry
133
+ return (vlenb << emul) / esz;
193
+ * or no PMP entry matches an M-Mode access, the access succeeds.
194
+ */
195
+ ret = true;
196
+ *allowed_privs = PMP_READ | PMP_WRITE | PMP_EXEC;
197
+ } else {
198
+ /*
199
+ * Other modes are not allowed to succeed if they don't * match a rule,
200
+ * but there are rules. We've checked for no rule earlier in this
201
+ * function.
202
+ */
203
+ ret = false;
204
+ *allowed_privs = 0;
205
+ }
206
+
207
+ return ret;
208
+}
134
+}
209
+
135
+
210
136
static inline target_ulong adjust_addr(CPURISCVState *env, target_ulong addr)
211
/*
212
* Public Interface
213
@@ -XXX,XX +XXX,XX @@ static int pmp_is_in_range(CPURISCVState *env, int pmp_index, target_ulong addr)
214
* Check if the address has required RWX privs to complete desired operation
215
*/
216
bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
217
- target_ulong size, pmp_priv_t privs, target_ulong mode)
218
+ target_ulong size, pmp_priv_t privs, pmp_priv_t *allowed_privs,
219
+ target_ulong mode)
220
{
137
{
221
int i = 0;
138
return (addr & env->cur_pmmask) | env->cur_pmbase;
222
int ret = -1;
139
@@ -XXX,XX +XXX,XX @@ static void probe_pages(CPURISCVState *env, target_ulong addr,
223
int pmp_size = 0;
224
target_ulong s = 0;
225
target_ulong e = 0;
226
- pmp_priv_t allowed_privs = 0;
227
228
/* Short cut if no rules */
229
if (0 == pmp_get_num_rules(env)) {
230
- return (env->priv == PRV_M) ? true : false;
231
+ return pmp_hart_has_privs_default(env, addr, size, privs,
232
+ allowed_privs, mode);
233
}
140
}
234
141
}
235
if (size == 0) {
142
236
@@ -XXX,XX +XXX,XX @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
143
+/* set agnostic elements to 1s */
237
* check
144
+static void vext_set_elems_1s(void *base, uint32_t is_agnostic, uint32_t cnt,
238
*/
145
+ uint32_t tot)
239
if (((s + e) == 2) && (PMP_AMATCH_OFF != a_field)) {
146
+{
240
- allowed_privs = PMP_READ | PMP_WRITE | PMP_EXEC;
147
+ if (is_agnostic == 0) {
241
+ *allowed_privs = PMP_READ | PMP_WRITE | PMP_EXEC;
148
+ /* policy undisturbed */
242
if ((mode != PRV_M) || pmp_is_locked(env, i)) {
149
+ return;
243
- allowed_privs &= env->pmp_state.pmp[i].cfg_reg;
150
+ }
244
+ *allowed_privs &= env->pmp_state.pmp[i].cfg_reg;
151
+ if (tot - cnt == 0) {
245
}
152
+ return ;
246
153
+ }
247
- if ((privs & allowed_privs) == privs) {
154
+ memset(base + cnt, -1, tot - cnt);
248
- ret = 1;
155
+}
249
- break;
156
+
250
- } else {
157
static inline void vext_set_elem_mask(void *v0, int index,
251
- ret = 0;
158
uint8_t value)
252
- break;
159
{
253
- }
160
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vsub_vv_d, OP_SSS_D, H8, H8, H8, DO_SUB)
254
+ ret = ((privs & *allowed_privs) == privs);
161
255
+ break;
162
static void do_vext_vv(void *vd, void *v0, void *vs1, void *vs2,
256
}
163
CPURISCVState *env, uint32_t desc,
164
- opivv2_fn *fn)
165
+ opivv2_fn *fn, uint32_t esz)
166
{
167
uint32_t vm = vext_vm(desc);
168
uint32_t vl = env->vl;
169
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
170
+ uint32_t vta = vext_vta(desc);
171
uint32_t i;
172
173
for (i = env->vstart; i < vl; i++) {
174
@@ -XXX,XX +XXX,XX @@ static void do_vext_vv(void *vd, void *v0, void *vs1, void *vs2,
175
fn(vd, vs1, vs2, i);
257
}
176
}
258
177
env->vstart = 0;
259
/* No rule matched */
178
+ /* set tail elements to 1s */
260
if (ret == -1) {
179
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
261
- if (mode == PRV_M) {
262
- ret = 1; /* Privileged spec v1.10 states if no PMP entry matches an
263
- * M-Mode access, the access succeeds */
264
- } else {
265
- ret = 0; /* Other modes are not allowed to succeed if they don't
266
- * match a rule, but there are rules. We've checked for
267
- * no rule earlier in this function. */
268
- }
269
+ return pmp_hart_has_privs_default(env, addr, size, privs,
270
+ allowed_privs, mode);
271
}
272
273
return ret == 1 ? true : false;
274
}
180
}
275
181
276
-
182
/* generate the helpers for OPIVV */
277
/*
183
-#define GEN_VEXT_VV(NAME) \
278
* Handle a write to a pmpcfg CSP
184
+#define GEN_VEXT_VV(NAME, ESZ) \
279
*/
185
void HELPER(NAME)(void *vd, void *v0, void *vs1, \
280
@@ -XXX,XX +XXX,XX @@ bool pmp_is_range_in_tlb(CPURISCVState *env, hwaddr tlb_sa,
186
void *vs2, CPURISCVState *env, \
281
187
uint32_t desc) \
282
return false;
188
{ \
189
do_vext_vv(vd, v0, vs1, vs2, env, desc, \
190
- do_##NAME); \
191
+ do_##NAME, ESZ); \
283
}
192
}
284
+
193
285
+/*
194
-GEN_VEXT_VV(vadd_vv_b)
286
+ * Convert PMP privilege to TLB page privilege.
195
-GEN_VEXT_VV(vadd_vv_h)
287
+ */
196
-GEN_VEXT_VV(vadd_vv_w)
288
+int pmp_priv_to_page_prot(pmp_priv_t pmp_priv)
197
-GEN_VEXT_VV(vadd_vv_d)
289
+{
198
-GEN_VEXT_VV(vsub_vv_b)
290
+ int prot = 0;
199
-GEN_VEXT_VV(vsub_vv_h)
291
+
200
-GEN_VEXT_VV(vsub_vv_w)
292
+ if (pmp_priv & PMP_READ) {
201
-GEN_VEXT_VV(vsub_vv_d)
293
+ prot |= PAGE_READ;
202
+GEN_VEXT_VV(vadd_vv_b, 1)
294
+ }
203
+GEN_VEXT_VV(vadd_vv_h, 2)
295
+ if (pmp_priv & PMP_WRITE) {
204
+GEN_VEXT_VV(vadd_vv_w, 4)
296
+ prot |= PAGE_WRITE;
205
+GEN_VEXT_VV(vadd_vv_d, 8)
297
+ }
206
+GEN_VEXT_VV(vsub_vv_b, 1)
298
+ if (pmp_priv & PMP_EXEC) {
207
+GEN_VEXT_VV(vsub_vv_h, 2)
299
+ prot |= PAGE_EXEC;
208
+GEN_VEXT_VV(vsub_vv_w, 4)
300
+ }
209
+GEN_VEXT_VV(vsub_vv_d, 8)
301
+
210
302
+ return prot;
211
typedef void opivx2_fn(void *vd, target_long s1, void *vs2, int i);
303
+}
212
213
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vwadd_wv_w, WOP_WSSS_W, H8, H4, H4, DO_ADD)
214
RVVCALL(OPIVV2, vwsub_wv_b, WOP_WSSS_B, H2, H1, H1, DO_SUB)
215
RVVCALL(OPIVV2, vwsub_wv_h, WOP_WSSS_H, H4, H2, H2, DO_SUB)
216
RVVCALL(OPIVV2, vwsub_wv_w, WOP_WSSS_W, H8, H4, H4, DO_SUB)
217
-GEN_VEXT_VV(vwaddu_vv_b)
218
-GEN_VEXT_VV(vwaddu_vv_h)
219
-GEN_VEXT_VV(vwaddu_vv_w)
220
-GEN_VEXT_VV(vwsubu_vv_b)
221
-GEN_VEXT_VV(vwsubu_vv_h)
222
-GEN_VEXT_VV(vwsubu_vv_w)
223
-GEN_VEXT_VV(vwadd_vv_b)
224
-GEN_VEXT_VV(vwadd_vv_h)
225
-GEN_VEXT_VV(vwadd_vv_w)
226
-GEN_VEXT_VV(vwsub_vv_b)
227
-GEN_VEXT_VV(vwsub_vv_h)
228
-GEN_VEXT_VV(vwsub_vv_w)
229
-GEN_VEXT_VV(vwaddu_wv_b)
230
-GEN_VEXT_VV(vwaddu_wv_h)
231
-GEN_VEXT_VV(vwaddu_wv_w)
232
-GEN_VEXT_VV(vwsubu_wv_b)
233
-GEN_VEXT_VV(vwsubu_wv_h)
234
-GEN_VEXT_VV(vwsubu_wv_w)
235
-GEN_VEXT_VV(vwadd_wv_b)
236
-GEN_VEXT_VV(vwadd_wv_h)
237
-GEN_VEXT_VV(vwadd_wv_w)
238
-GEN_VEXT_VV(vwsub_wv_b)
239
-GEN_VEXT_VV(vwsub_wv_h)
240
-GEN_VEXT_VV(vwsub_wv_w)
241
+GEN_VEXT_VV(vwaddu_vv_b, 2)
242
+GEN_VEXT_VV(vwaddu_vv_h, 4)
243
+GEN_VEXT_VV(vwaddu_vv_w, 8)
244
+GEN_VEXT_VV(vwsubu_vv_b, 2)
245
+GEN_VEXT_VV(vwsubu_vv_h, 4)
246
+GEN_VEXT_VV(vwsubu_vv_w, 8)
247
+GEN_VEXT_VV(vwadd_vv_b, 2)
248
+GEN_VEXT_VV(vwadd_vv_h, 4)
249
+GEN_VEXT_VV(vwadd_vv_w, 8)
250
+GEN_VEXT_VV(vwsub_vv_b, 2)
251
+GEN_VEXT_VV(vwsub_vv_h, 4)
252
+GEN_VEXT_VV(vwsub_vv_w, 8)
253
+GEN_VEXT_VV(vwaddu_wv_b, 2)
254
+GEN_VEXT_VV(vwaddu_wv_h, 4)
255
+GEN_VEXT_VV(vwaddu_wv_w, 8)
256
+GEN_VEXT_VV(vwsubu_wv_b, 2)
257
+GEN_VEXT_VV(vwsubu_wv_h, 4)
258
+GEN_VEXT_VV(vwsubu_wv_w, 8)
259
+GEN_VEXT_VV(vwadd_wv_b, 2)
260
+GEN_VEXT_VV(vwadd_wv_h, 4)
261
+GEN_VEXT_VV(vwadd_wv_w, 8)
262
+GEN_VEXT_VV(vwsub_wv_b, 2)
263
+GEN_VEXT_VV(vwsub_wv_h, 4)
264
+GEN_VEXT_VV(vwsub_wv_w, 8)
265
266
RVVCALL(OPIVX2, vwaddu_vx_b, WOP_UUU_B, H2, H1, DO_ADD)
267
RVVCALL(OPIVX2, vwaddu_vx_h, WOP_UUU_H, H4, H2, DO_ADD)
268
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vxor_vv_b, OP_SSS_B, H1, H1, H1, DO_XOR)
269
RVVCALL(OPIVV2, vxor_vv_h, OP_SSS_H, H2, H2, H2, DO_XOR)
270
RVVCALL(OPIVV2, vxor_vv_w, OP_SSS_W, H4, H4, H4, DO_XOR)
271
RVVCALL(OPIVV2, vxor_vv_d, OP_SSS_D, H8, H8, H8, DO_XOR)
272
-GEN_VEXT_VV(vand_vv_b)
273
-GEN_VEXT_VV(vand_vv_h)
274
-GEN_VEXT_VV(vand_vv_w)
275
-GEN_VEXT_VV(vand_vv_d)
276
-GEN_VEXT_VV(vor_vv_b)
277
-GEN_VEXT_VV(vor_vv_h)
278
-GEN_VEXT_VV(vor_vv_w)
279
-GEN_VEXT_VV(vor_vv_d)
280
-GEN_VEXT_VV(vxor_vv_b)
281
-GEN_VEXT_VV(vxor_vv_h)
282
-GEN_VEXT_VV(vxor_vv_w)
283
-GEN_VEXT_VV(vxor_vv_d)
284
+GEN_VEXT_VV(vand_vv_b, 1)
285
+GEN_VEXT_VV(vand_vv_h, 2)
286
+GEN_VEXT_VV(vand_vv_w, 4)
287
+GEN_VEXT_VV(vand_vv_d, 8)
288
+GEN_VEXT_VV(vor_vv_b, 1)
289
+GEN_VEXT_VV(vor_vv_h, 2)
290
+GEN_VEXT_VV(vor_vv_w, 4)
291
+GEN_VEXT_VV(vor_vv_d, 8)
292
+GEN_VEXT_VV(vxor_vv_b, 1)
293
+GEN_VEXT_VV(vxor_vv_h, 2)
294
+GEN_VEXT_VV(vxor_vv_w, 4)
295
+GEN_VEXT_VV(vxor_vv_d, 8)
296
297
RVVCALL(OPIVX2, vand_vx_b, OP_SSS_B, H1, H1, DO_AND)
298
RVVCALL(OPIVX2, vand_vx_h, OP_SSS_H, H2, H2, DO_AND)
299
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vmax_vv_b, OP_SSS_B, H1, H1, H1, DO_MAX)
300
RVVCALL(OPIVV2, vmax_vv_h, OP_SSS_H, H2, H2, H2, DO_MAX)
301
RVVCALL(OPIVV2, vmax_vv_w, OP_SSS_W, H4, H4, H4, DO_MAX)
302
RVVCALL(OPIVV2, vmax_vv_d, OP_SSS_D, H8, H8, H8, DO_MAX)
303
-GEN_VEXT_VV(vminu_vv_b)
304
-GEN_VEXT_VV(vminu_vv_h)
305
-GEN_VEXT_VV(vminu_vv_w)
306
-GEN_VEXT_VV(vminu_vv_d)
307
-GEN_VEXT_VV(vmin_vv_b)
308
-GEN_VEXT_VV(vmin_vv_h)
309
-GEN_VEXT_VV(vmin_vv_w)
310
-GEN_VEXT_VV(vmin_vv_d)
311
-GEN_VEXT_VV(vmaxu_vv_b)
312
-GEN_VEXT_VV(vmaxu_vv_h)
313
-GEN_VEXT_VV(vmaxu_vv_w)
314
-GEN_VEXT_VV(vmaxu_vv_d)
315
-GEN_VEXT_VV(vmax_vv_b)
316
-GEN_VEXT_VV(vmax_vv_h)
317
-GEN_VEXT_VV(vmax_vv_w)
318
-GEN_VEXT_VV(vmax_vv_d)
319
+GEN_VEXT_VV(vminu_vv_b, 1)
320
+GEN_VEXT_VV(vminu_vv_h, 2)
321
+GEN_VEXT_VV(vminu_vv_w, 4)
322
+GEN_VEXT_VV(vminu_vv_d, 8)
323
+GEN_VEXT_VV(vmin_vv_b, 1)
324
+GEN_VEXT_VV(vmin_vv_h, 2)
325
+GEN_VEXT_VV(vmin_vv_w, 4)
326
+GEN_VEXT_VV(vmin_vv_d, 8)
327
+GEN_VEXT_VV(vmaxu_vv_b, 1)
328
+GEN_VEXT_VV(vmaxu_vv_h, 2)
329
+GEN_VEXT_VV(vmaxu_vv_w, 4)
330
+GEN_VEXT_VV(vmaxu_vv_d, 8)
331
+GEN_VEXT_VV(vmax_vv_b, 1)
332
+GEN_VEXT_VV(vmax_vv_h, 2)
333
+GEN_VEXT_VV(vmax_vv_w, 4)
334
+GEN_VEXT_VV(vmax_vv_d, 8)
335
336
RVVCALL(OPIVX2, vminu_vx_b, OP_UUU_B, H1, H1, DO_MIN)
337
RVVCALL(OPIVX2, vminu_vx_h, OP_UUU_H, H2, H2, DO_MIN)
338
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vmul_vv_b, OP_SSS_B, H1, H1, H1, DO_MUL)
339
RVVCALL(OPIVV2, vmul_vv_h, OP_SSS_H, H2, H2, H2, DO_MUL)
340
RVVCALL(OPIVV2, vmul_vv_w, OP_SSS_W, H4, H4, H4, DO_MUL)
341
RVVCALL(OPIVV2, vmul_vv_d, OP_SSS_D, H8, H8, H8, DO_MUL)
342
-GEN_VEXT_VV(vmul_vv_b)
343
-GEN_VEXT_VV(vmul_vv_h)
344
-GEN_VEXT_VV(vmul_vv_w)
345
-GEN_VEXT_VV(vmul_vv_d)
346
+GEN_VEXT_VV(vmul_vv_b, 1)
347
+GEN_VEXT_VV(vmul_vv_h, 2)
348
+GEN_VEXT_VV(vmul_vv_w, 4)
349
+GEN_VEXT_VV(vmul_vv_d, 8)
350
351
static int8_t do_mulh_b(int8_t s2, int8_t s1)
352
{
353
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vmulhsu_vv_b, OP_SUS_B, H1, H1, H1, do_mulhsu_b)
354
RVVCALL(OPIVV2, vmulhsu_vv_h, OP_SUS_H, H2, H2, H2, do_mulhsu_h)
355
RVVCALL(OPIVV2, vmulhsu_vv_w, OP_SUS_W, H4, H4, H4, do_mulhsu_w)
356
RVVCALL(OPIVV2, vmulhsu_vv_d, OP_SUS_D, H8, H8, H8, do_mulhsu_d)
357
-GEN_VEXT_VV(vmulh_vv_b)
358
-GEN_VEXT_VV(vmulh_vv_h)
359
-GEN_VEXT_VV(vmulh_vv_w)
360
-GEN_VEXT_VV(vmulh_vv_d)
361
-GEN_VEXT_VV(vmulhu_vv_b)
362
-GEN_VEXT_VV(vmulhu_vv_h)
363
-GEN_VEXT_VV(vmulhu_vv_w)
364
-GEN_VEXT_VV(vmulhu_vv_d)
365
-GEN_VEXT_VV(vmulhsu_vv_b)
366
-GEN_VEXT_VV(vmulhsu_vv_h)
367
-GEN_VEXT_VV(vmulhsu_vv_w)
368
-GEN_VEXT_VV(vmulhsu_vv_d)
369
+GEN_VEXT_VV(vmulh_vv_b, 1)
370
+GEN_VEXT_VV(vmulh_vv_h, 2)
371
+GEN_VEXT_VV(vmulh_vv_w, 4)
372
+GEN_VEXT_VV(vmulh_vv_d, 8)
373
+GEN_VEXT_VV(vmulhu_vv_b, 1)
374
+GEN_VEXT_VV(vmulhu_vv_h, 2)
375
+GEN_VEXT_VV(vmulhu_vv_w, 4)
376
+GEN_VEXT_VV(vmulhu_vv_d, 8)
377
+GEN_VEXT_VV(vmulhsu_vv_b, 1)
378
+GEN_VEXT_VV(vmulhsu_vv_h, 2)
379
+GEN_VEXT_VV(vmulhsu_vv_w, 4)
380
+GEN_VEXT_VV(vmulhsu_vv_d, 8)
381
382
RVVCALL(OPIVX2, vmul_vx_b, OP_SSS_B, H1, H1, DO_MUL)
383
RVVCALL(OPIVX2, vmul_vx_h, OP_SSS_H, H2, H2, DO_MUL)
384
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vrem_vv_b, OP_SSS_B, H1, H1, H1, DO_REM)
385
RVVCALL(OPIVV2, vrem_vv_h, OP_SSS_H, H2, H2, H2, DO_REM)
386
RVVCALL(OPIVV2, vrem_vv_w, OP_SSS_W, H4, H4, H4, DO_REM)
387
RVVCALL(OPIVV2, vrem_vv_d, OP_SSS_D, H8, H8, H8, DO_REM)
388
-GEN_VEXT_VV(vdivu_vv_b)
389
-GEN_VEXT_VV(vdivu_vv_h)
390
-GEN_VEXT_VV(vdivu_vv_w)
391
-GEN_VEXT_VV(vdivu_vv_d)
392
-GEN_VEXT_VV(vdiv_vv_b)
393
-GEN_VEXT_VV(vdiv_vv_h)
394
-GEN_VEXT_VV(vdiv_vv_w)
395
-GEN_VEXT_VV(vdiv_vv_d)
396
-GEN_VEXT_VV(vremu_vv_b)
397
-GEN_VEXT_VV(vremu_vv_h)
398
-GEN_VEXT_VV(vremu_vv_w)
399
-GEN_VEXT_VV(vremu_vv_d)
400
-GEN_VEXT_VV(vrem_vv_b)
401
-GEN_VEXT_VV(vrem_vv_h)
402
-GEN_VEXT_VV(vrem_vv_w)
403
-GEN_VEXT_VV(vrem_vv_d)
404
+GEN_VEXT_VV(vdivu_vv_b, 1)
405
+GEN_VEXT_VV(vdivu_vv_h, 2)
406
+GEN_VEXT_VV(vdivu_vv_w, 4)
407
+GEN_VEXT_VV(vdivu_vv_d, 8)
408
+GEN_VEXT_VV(vdiv_vv_b, 1)
409
+GEN_VEXT_VV(vdiv_vv_h, 2)
410
+GEN_VEXT_VV(vdiv_vv_w, 4)
411
+GEN_VEXT_VV(vdiv_vv_d, 8)
412
+GEN_VEXT_VV(vremu_vv_b, 1)
413
+GEN_VEXT_VV(vremu_vv_h, 2)
414
+GEN_VEXT_VV(vremu_vv_w, 4)
415
+GEN_VEXT_VV(vremu_vv_d, 8)
416
+GEN_VEXT_VV(vrem_vv_b, 1)
417
+GEN_VEXT_VV(vrem_vv_h, 2)
418
+GEN_VEXT_VV(vrem_vv_w, 4)
419
+GEN_VEXT_VV(vrem_vv_d, 8)
420
421
RVVCALL(OPIVX2, vdivu_vx_b, OP_UUU_B, H1, H1, DO_DIVU)
422
RVVCALL(OPIVX2, vdivu_vx_h, OP_UUU_H, H2, H2, DO_DIVU)
423
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2, vwmulu_vv_w, WOP_UUU_W, H8, H4, H4, DO_MUL)
424
RVVCALL(OPIVV2, vwmulsu_vv_b, WOP_SUS_B, H2, H1, H1, DO_MUL)
425
RVVCALL(OPIVV2, vwmulsu_vv_h, WOP_SUS_H, H4, H2, H2, DO_MUL)
426
RVVCALL(OPIVV2, vwmulsu_vv_w, WOP_SUS_W, H8, H4, H4, DO_MUL)
427
-GEN_VEXT_VV(vwmul_vv_b)
428
-GEN_VEXT_VV(vwmul_vv_h)
429
-GEN_VEXT_VV(vwmul_vv_w)
430
-GEN_VEXT_VV(vwmulu_vv_b)
431
-GEN_VEXT_VV(vwmulu_vv_h)
432
-GEN_VEXT_VV(vwmulu_vv_w)
433
-GEN_VEXT_VV(vwmulsu_vv_b)
434
-GEN_VEXT_VV(vwmulsu_vv_h)
435
-GEN_VEXT_VV(vwmulsu_vv_w)
436
+GEN_VEXT_VV(vwmul_vv_b, 2)
437
+GEN_VEXT_VV(vwmul_vv_h, 4)
438
+GEN_VEXT_VV(vwmul_vv_w, 8)
439
+GEN_VEXT_VV(vwmulu_vv_b, 2)
440
+GEN_VEXT_VV(vwmulu_vv_h, 4)
441
+GEN_VEXT_VV(vwmulu_vv_w, 8)
442
+GEN_VEXT_VV(vwmulsu_vv_b, 2)
443
+GEN_VEXT_VV(vwmulsu_vv_h, 4)
444
+GEN_VEXT_VV(vwmulsu_vv_w, 8)
445
446
RVVCALL(OPIVX2, vwmul_vx_b, WOP_SSS_B, H2, H1, DO_MUL)
447
RVVCALL(OPIVX2, vwmul_vx_h, WOP_SSS_H, H4, H2, DO_MUL)
448
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV3, vnmsub_vv_b, OP_SSS_B, H1, H1, H1, DO_NMSUB)
449
RVVCALL(OPIVV3, vnmsub_vv_h, OP_SSS_H, H2, H2, H2, DO_NMSUB)
450
RVVCALL(OPIVV3, vnmsub_vv_w, OP_SSS_W, H4, H4, H4, DO_NMSUB)
451
RVVCALL(OPIVV3, vnmsub_vv_d, OP_SSS_D, H8, H8, H8, DO_NMSUB)
452
-GEN_VEXT_VV(vmacc_vv_b)
453
-GEN_VEXT_VV(vmacc_vv_h)
454
-GEN_VEXT_VV(vmacc_vv_w)
455
-GEN_VEXT_VV(vmacc_vv_d)
456
-GEN_VEXT_VV(vnmsac_vv_b)
457
-GEN_VEXT_VV(vnmsac_vv_h)
458
-GEN_VEXT_VV(vnmsac_vv_w)
459
-GEN_VEXT_VV(vnmsac_vv_d)
460
-GEN_VEXT_VV(vmadd_vv_b)
461
-GEN_VEXT_VV(vmadd_vv_h)
462
-GEN_VEXT_VV(vmadd_vv_w)
463
-GEN_VEXT_VV(vmadd_vv_d)
464
-GEN_VEXT_VV(vnmsub_vv_b)
465
-GEN_VEXT_VV(vnmsub_vv_h)
466
-GEN_VEXT_VV(vnmsub_vv_w)
467
-GEN_VEXT_VV(vnmsub_vv_d)
468
+GEN_VEXT_VV(vmacc_vv_b, 1)
469
+GEN_VEXT_VV(vmacc_vv_h, 2)
470
+GEN_VEXT_VV(vmacc_vv_w, 4)
471
+GEN_VEXT_VV(vmacc_vv_d, 8)
472
+GEN_VEXT_VV(vnmsac_vv_b, 1)
473
+GEN_VEXT_VV(vnmsac_vv_h, 2)
474
+GEN_VEXT_VV(vnmsac_vv_w, 4)
475
+GEN_VEXT_VV(vnmsac_vv_d, 8)
476
+GEN_VEXT_VV(vmadd_vv_b, 1)
477
+GEN_VEXT_VV(vmadd_vv_h, 2)
478
+GEN_VEXT_VV(vmadd_vv_w, 4)
479
+GEN_VEXT_VV(vmadd_vv_d, 8)
480
+GEN_VEXT_VV(vnmsub_vv_b, 1)
481
+GEN_VEXT_VV(vnmsub_vv_h, 2)
482
+GEN_VEXT_VV(vnmsub_vv_w, 4)
483
+GEN_VEXT_VV(vnmsub_vv_d, 8)
484
485
#define OPIVX3(NAME, TD, T1, T2, TX1, TX2, HD, HS2, OP) \
486
static void do_##NAME(void *vd, target_long s1, void *vs2, int i) \
487
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV3, vwmacc_vv_w, WOP_SSS_W, H8, H4, H4, DO_MACC)
488
RVVCALL(OPIVV3, vwmaccsu_vv_b, WOP_SSU_B, H2, H1, H1, DO_MACC)
489
RVVCALL(OPIVV3, vwmaccsu_vv_h, WOP_SSU_H, H4, H2, H2, DO_MACC)
490
RVVCALL(OPIVV3, vwmaccsu_vv_w, WOP_SSU_W, H8, H4, H4, DO_MACC)
491
-GEN_VEXT_VV(vwmaccu_vv_b)
492
-GEN_VEXT_VV(vwmaccu_vv_h)
493
-GEN_VEXT_VV(vwmaccu_vv_w)
494
-GEN_VEXT_VV(vwmacc_vv_b)
495
-GEN_VEXT_VV(vwmacc_vv_h)
496
-GEN_VEXT_VV(vwmacc_vv_w)
497
-GEN_VEXT_VV(vwmaccsu_vv_b)
498
-GEN_VEXT_VV(vwmaccsu_vv_h)
499
-GEN_VEXT_VV(vwmaccsu_vv_w)
500
+GEN_VEXT_VV(vwmaccu_vv_b, 2)
501
+GEN_VEXT_VV(vwmaccu_vv_h, 4)
502
+GEN_VEXT_VV(vwmaccu_vv_w, 8)
503
+GEN_VEXT_VV(vwmacc_vv_b, 2)
504
+GEN_VEXT_VV(vwmacc_vv_h, 4)
505
+GEN_VEXT_VV(vwmacc_vv_w, 8)
506
+GEN_VEXT_VV(vwmaccsu_vv_b, 2)
507
+GEN_VEXT_VV(vwmaccsu_vv_h, 4)
508
+GEN_VEXT_VV(vwmaccsu_vv_w, 8)
509
510
RVVCALL(OPIVX3, vwmaccu_vx_b, WOP_UUU_B, H2, H1, DO_MACC)
511
RVVCALL(OPIVX3, vwmaccu_vx_h, WOP_UUU_H, H4, H2, DO_MACC)
512
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
513
index XXXXXXX..XXXXXXX 100644
514
--- a/target/riscv/insn_trans/trans_rvv.c.inc
515
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
516
@@ -XXX,XX +XXX,XX @@ do_opivv_gvec(DisasContext *s, arg_rmrr *a, GVecGen3Fn *gvec_fn,
517
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
518
tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over);
519
520
- if (a->vm && s->vl_eq_vlmax) {
521
+ if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
522
gvec_fn(s->sew, vreg_ofs(s, a->rd),
523
vreg_ofs(s, a->rs2), vreg_ofs(s, a->rs1),
524
MAXSZ(s), MAXSZ(s));
525
@@ -XXX,XX +XXX,XX @@ do_opivv_gvec(DisasContext *s, arg_rmrr *a, GVecGen3Fn *gvec_fn,
526
527
data = FIELD_DP32(data, VDATA, VM, a->vm);
528
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
529
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
530
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0),
531
vreg_ofs(s, a->rs1), vreg_ofs(s, a->rs2),
532
cpu_env, s->cfg_ptr->vlen / 8,
304
--
533
--
305
2.30.1
534
2.36.1
306
307
diff view generated by jsdifflib
1
From: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
When decode_insn16() fails, we fall back to decode_RV32_64C() for
3
Destination register of unit-stride mask load and store instructions are
4
further compressed instruction decoding. However, prior to this change,
4
always written with a tail-agnostic policy.
5
we did not raise an illegal instruction exception, if decode_RV32_64C()
5
6
fails to decode the instruction. This means that we skipped illegal
6
A vector segment load / store instruction may contain fractional lmul
7
compressed instructions instead of raising an illegal instruction
7
with nf * lmul > 1. The rest of the elements in the last register should
8
exception.
8
be treated as tail elements.
9
9
10
Instead of patching decode_RV32_64C(), we can just remove it,
10
Signed-off-by: eop Chen <eop.chen@sifive.com>
11
as it is dead code since f330433b363 anyway.
11
Reviewed-by: Frank Chang <frank.chang@sifive.com>
12
12
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
13
Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
13
Acked-by: Alistair Francis <alistair.francis@wdc.com>
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Message-Id: <165449614532.19704.7000832880482980398-6@git.sr.ht>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20210322121609.3097928-1-georg.kotheimer@kernkonzept.com
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
18
---
16
---
19
target/riscv/translate.c | 179 +--------------------------------------
17
target/riscv/translate.c | 2 +
20
1 file changed, 1 insertion(+), 178 deletions(-)
18
target/riscv/vector_helper.c | 60 +++++++++++++++++++++++++
19
target/riscv/insn_trans/trans_rvv.c.inc | 6 +++
20
3 files changed, 68 insertions(+)
21
21
22
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
22
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
23
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
24
--- a/target/riscv/translate.c
24
--- a/target/riscv/translate.c
25
+++ b/target/riscv/translate.c
25
+++ b/target/riscv/translate.c
26
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
26
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
27
CPUState *cs;
27
int8_t lmul;
28
} DisasContext;
28
uint8_t sew;
29
29
uint8_t vta;
30
-#ifdef TARGET_RISCV64
30
+ bool cfg_vta_all_1s;
31
-/* convert riscv funct3 to qemu memop for load/store */
31
target_ulong vstart;
32
-static const int tcg_memop_lookup[8] = {
32
bool vl_eq_vlmax;
33
- [0 ... 7] = -1,
33
uint8_t ntemp;
34
- [0] = MO_SB,
34
@@ -XXX,XX +XXX,XX @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
35
- [1] = MO_TESW,
35
ctx->sew = FIELD_EX32(tb_flags, TB_FLAGS, SEW);
36
- [2] = MO_TESL,
36
ctx->lmul = sextract32(FIELD_EX32(tb_flags, TB_FLAGS, LMUL), 0, 3);
37
- [3] = MO_TEQ,
37
ctx->vta = FIELD_EX32(tb_flags, TB_FLAGS, VTA) && cpu->cfg.rvv_ta_all_1s;
38
- [4] = MO_UB,
38
+ ctx->cfg_vta_all_1s = cpu->cfg.rvv_ta_all_1s;
39
- [5] = MO_TEUW,
39
ctx->vstart = env->vstart;
40
- [6] = MO_TEUL,
40
ctx->vl_eq_vlmax = FIELD_EX32(tb_flags, TB_FLAGS, VL_EQ_VLMAX);
41
-};
41
ctx->misa_mxl_max = env->misa_mxl_max;
42
-#endif
42
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
43
-
43
index XXXXXXX..XXXXXXX 100644
44
#ifdef TARGET_RISCV64
44
--- a/target/riscv/vector_helper.c
45
#define CASE_OP_32_64(X) case X: case glue(X, W)
45
+++ b/target/riscv/vector_helper.c
46
#else
46
@@ -XXX,XX +XXX,XX @@ vext_ldst_stride(void *vd, void *v0, target_ulong base,
47
@@ -XXX,XX +XXX,XX @@ static void gen_jal(DisasContext *ctx, int rd, target_ulong imm)
47
uint32_t i, k;
48
ctx->base.is_jmp = DISAS_NORETURN;
48
uint32_t nf = vext_nf(desc);
49
}
49
uint32_t max_elems = vext_max_elems(desc, log2_esz);
50
50
+ uint32_t esz = 1 << log2_esz;
51
-#ifdef TARGET_RISCV64
51
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
52
-static void gen_load_c(DisasContext *ctx, uint32_t opc, int rd, int rs1,
52
+ uint32_t vta = vext_vta(desc);
53
- target_long imm)
53
54
-{
54
for (i = env->vstart; i < env->vl; i++, env->vstart++) {
55
- TCGv t0 = tcg_temp_new();
55
if (!vm && !vext_elem_mask(v0, i)) {
56
- TCGv t1 = tcg_temp_new();
56
@@ -XXX,XX +XXX,XX @@ vext_ldst_stride(void *vd, void *v0, target_ulong base,
57
- gen_get_gpr(t0, rs1);
57
}
58
- tcg_gen_addi_tl(t0, t0, imm);
58
}
59
- int memop = tcg_memop_lookup[(opc >> 12) & 0x7];
59
env->vstart = 0;
60
-
60
+ /* set tail elements to 1s */
61
- if (memop < 0) {
61
+ for (k = 0; k < nf; ++k) {
62
- gen_exception_illegal(ctx);
62
+ vext_set_elems_1s(vd, vta, (k * max_elems + env->vl) * esz,
63
- return;
63
+ (k * max_elems + max_elems) * esz);
64
- }
64
+ }
65
-
65
+ if (nf * max_elems % total_elems != 0) {
66
- tcg_gen_qemu_ld_tl(t1, t0, ctx->mem_idx, memop);
66
+ uint32_t vlenb = env_archcpu(env)->cfg.vlen >> 3;
67
- gen_set_gpr(rd, t1);
67
+ uint32_t registers_used =
68
- tcg_temp_free(t0);
68
+ ((nf * max_elems) * esz + (vlenb - 1)) / vlenb;
69
- tcg_temp_free(t1);
69
+ vext_set_elems_1s(vd, vta, (nf * max_elems) * esz,
70
-}
70
+ registers_used * vlenb);
71
-
71
+ }
72
-static void gen_store_c(DisasContext *ctx, uint32_t opc, int rs1, int rs2,
72
}
73
- target_long imm)
73
74
-{
74
#define GEN_VEXT_LD_STRIDE(NAME, ETYPE, LOAD_FN) \
75
- TCGv t0 = tcg_temp_new();
75
@@ -XXX,XX +XXX,XX @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
76
- TCGv dat = tcg_temp_new();
76
uint32_t i, k;
77
- gen_get_gpr(t0, rs1);
77
uint32_t nf = vext_nf(desc);
78
- tcg_gen_addi_tl(t0, t0, imm);
78
uint32_t max_elems = vext_max_elems(desc, log2_esz);
79
- gen_get_gpr(dat, rs2);
79
+ uint32_t esz = 1 << log2_esz;
80
- int memop = tcg_memop_lookup[(opc >> 12) & 0x7];
80
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
81
-
81
+ uint32_t vta = vext_vta(desc);
82
- if (memop < 0) {
82
83
- gen_exception_illegal(ctx);
83
/* load bytes from guest memory */
84
- return;
84
for (i = env->vstart; i < evl; i++, env->vstart++) {
85
- }
85
@@ -XXX,XX +XXX,XX @@ vext_ldst_us(void *vd, target_ulong base, CPURISCVState *env, uint32_t desc,
86
-
86
}
87
- tcg_gen_qemu_st_tl(dat, t0, ctx->mem_idx, memop);
87
}
88
- tcg_temp_free(t0);
88
env->vstart = 0;
89
- tcg_temp_free(dat);
89
+ /* set tail elements to 1s */
90
-}
90
+ for (k = 0; k < nf; ++k) {
91
-#endif
91
+ vext_set_elems_1s(vd, vta, (k * max_elems + evl) * esz,
92
-
92
+ (k * max_elems + max_elems) * esz);
93
#ifndef CONFIG_USER_ONLY
93
+ }
94
/* The states of mstatus_fs are:
94
+ if (nf * max_elems % total_elems != 0) {
95
* 0 = disabled, 1 = initial, 2 = clean, 3 = dirty
95
+ uint32_t vlenb = env_archcpu(env)->cfg.vlen >> 3;
96
@@ -XXX,XX +XXX,XX @@ static void mark_fs_dirty(DisasContext *ctx)
96
+ uint32_t registers_used =
97
static inline void mark_fs_dirty(DisasContext *ctx) { }
97
+ ((nf * max_elems) * esz + (vlenb - 1)) / vlenb;
98
#endif
98
+ vext_set_elems_1s(vd, vta, (nf * max_elems) * esz,
99
99
+ registers_used * vlenb);
100
-#if !defined(TARGET_RISCV64)
100
+ }
101
-static void gen_fp_load(DisasContext *ctx, uint32_t opc, int rd,
101
}
102
- int rs1, target_long imm)
102
103
-{
103
/*
104
- TCGv t0;
104
@@ -XXX,XX +XXX,XX @@ vext_ldst_index(void *vd, void *v0, target_ulong base,
105
-
105
uint32_t nf = vext_nf(desc);
106
- if (ctx->mstatus_fs == 0) {
106
uint32_t vm = vext_vm(desc);
107
- gen_exception_illegal(ctx);
107
uint32_t max_elems = vext_max_elems(desc, log2_esz);
108
- return;
108
+ uint32_t esz = 1 << log2_esz;
109
- }
109
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
110
-
110
+ uint32_t vta = vext_vta(desc);
111
- t0 = tcg_temp_new();
111
112
- gen_get_gpr(t0, rs1);
112
/* load bytes from guest memory */
113
- tcg_gen_addi_tl(t0, t0, imm);
113
for (i = env->vstart; i < env->vl; i++, env->vstart++) {
114
-
114
@@ -XXX,XX +XXX,XX @@ vext_ldst_index(void *vd, void *v0, target_ulong base,
115
- switch (opc) {
115
}
116
- case OPC_RISC_FLW:
116
}
117
- if (!has_ext(ctx, RVF)) {
117
env->vstart = 0;
118
- goto do_illegal;
118
+ /* set tail elements to 1s */
119
- }
119
+ for (k = 0; k < nf; ++k) {
120
- tcg_gen_qemu_ld_i64(cpu_fpr[rd], t0, ctx->mem_idx, MO_TEUL);
120
+ vext_set_elems_1s(vd, vta, (k * max_elems + env->vl) * esz,
121
- /* RISC-V requires NaN-boxing of narrower width floating point values */
121
+ (k * max_elems + max_elems) * esz);
122
- tcg_gen_ori_i64(cpu_fpr[rd], cpu_fpr[rd], 0xffffffff00000000ULL);
122
+ }
123
- break;
123
+ if (nf * max_elems % total_elems != 0) {
124
- case OPC_RISC_FLD:
124
+ uint32_t vlenb = env_archcpu(env)->cfg.vlen >> 3;
125
- if (!has_ext(ctx, RVD)) {
125
+ uint32_t registers_used =
126
- goto do_illegal;
126
+ ((nf * max_elems) * esz + (vlenb - 1)) / vlenb;
127
- }
127
+ vext_set_elems_1s(vd, vta, (nf * max_elems) * esz,
128
- tcg_gen_qemu_ld_i64(cpu_fpr[rd], t0, ctx->mem_idx, MO_TEQ);
128
+ registers_used * vlenb);
129
- break;
129
+ }
130
- do_illegal:
130
}
131
- default:
131
132
- gen_exception_illegal(ctx);
132
#define GEN_VEXT_LD_INDEX(NAME, ETYPE, INDEX_FN, LOAD_FN) \
133
- break;
133
@@ -XXX,XX +XXX,XX @@ vext_ldff(void *vd, void *v0, target_ulong base,
134
- }
134
uint32_t nf = vext_nf(desc);
135
- tcg_temp_free(t0);
135
uint32_t vm = vext_vm(desc);
136
-
136
uint32_t max_elems = vext_max_elems(desc, log2_esz);
137
- mark_fs_dirty(ctx);
137
+ uint32_t esz = 1 << log2_esz;
138
-}
138
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
139
-
139
+ uint32_t vta = vext_vta(desc);
140
-static void gen_fp_store(DisasContext *ctx, uint32_t opc, int rs1,
140
target_ulong addr, offset, remain;
141
- int rs2, target_long imm)
141
142
-{
142
/* probe every access*/
143
- TCGv t0;
143
@@ -XXX,XX +XXX,XX @@ ProbeSuccess:
144
-
144
}
145
- if (ctx->mstatus_fs == 0) {
145
}
146
- gen_exception_illegal(ctx);
146
env->vstart = 0;
147
- return;
147
+ /* set tail elements to 1s */
148
- }
148
+ for (k = 0; k < nf; ++k) {
149
-
149
+ vext_set_elems_1s(vd, vta, (k * max_elems + env->vl) * esz,
150
- t0 = tcg_temp_new();
150
+ (k * max_elems + max_elems) * esz);
151
- gen_get_gpr(t0, rs1);
151
+ }
152
- tcg_gen_addi_tl(t0, t0, imm);
152
+ if (nf * max_elems % total_elems != 0) {
153
-
153
+ uint32_t vlenb = env_archcpu(env)->cfg.vlen >> 3;
154
- switch (opc) {
154
+ uint32_t registers_used =
155
- case OPC_RISC_FSW:
155
+ ((nf * max_elems) * esz + (vlenb - 1)) / vlenb;
156
- if (!has_ext(ctx, RVF)) {
156
+ vext_set_elems_1s(vd, vta, (nf * max_elems) * esz,
157
- goto do_illegal;
157
+ registers_used * vlenb);
158
- }
158
+ }
159
- tcg_gen_qemu_st_i64(cpu_fpr[rs2], t0, ctx->mem_idx, MO_TEUL);
159
}
160
- break;
160
161
- case OPC_RISC_FSD:
161
#define GEN_VEXT_LDFF(NAME, ETYPE, LOAD_FN) \
162
- if (!has_ext(ctx, RVD)) {
162
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
163
- goto do_illegal;
163
index XXXXXXX..XXXXXXX 100644
164
- }
164
--- a/target/riscv/insn_trans/trans_rvv.c.inc
165
- tcg_gen_qemu_st_i64(cpu_fpr[rs2], t0, ctx->mem_idx, MO_TEQ);
165
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
166
- break;
166
@@ -XXX,XX +XXX,XX @@ static bool ld_us_op(DisasContext *s, arg_r2nfvm *a, uint8_t eew)
167
- do_illegal:
167
data = FIELD_DP32(data, VDATA, VM, a->vm);
168
- default:
168
data = FIELD_DP32(data, VDATA, LMUL, emul);
169
- gen_exception_illegal(ctx);
169
data = FIELD_DP32(data, VDATA, NF, a->nf);
170
- break;
170
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
171
- }
171
return ldst_us_trans(a->rd, a->rs1, data, fn, s, false);
172
-
172
}
173
- tcg_temp_free(t0);
173
174
-}
174
@@ -XXX,XX +XXX,XX @@ static bool ld_us_mask_op(DisasContext *s, arg_vlm_v *a, uint8_t eew)
175
-#endif
175
/* EMUL = 1, NFIELDS = 1 */
176
-
176
data = FIELD_DP32(data, VDATA, LMUL, 0);
177
static void gen_set_rm(DisasContext *ctx, int rm)
177
data = FIELD_DP32(data, VDATA, NF, 1);
178
{
178
+ /* Mask destination register are always tail-agnostic */
179
TCGv_i32 t0;
179
+ data = FIELD_DP32(data, VDATA, VTA, s->cfg_vta_all_1s);
180
@@ -XXX,XX +XXX,XX @@ static void gen_set_rm(DisasContext *ctx, int rm)
180
return ldst_us_trans(a->rd, a->rs1, data, fn, s, false);
181
tcg_temp_free_i32(t0);
181
}
182
}
182
183
183
@@ -XXX,XX +XXX,XX @@ static bool ld_stride_op(DisasContext *s, arg_rnfvm *a, uint8_t eew)
184
-static void decode_RV32_64C0(DisasContext *ctx, uint16_t opcode)
184
data = FIELD_DP32(data, VDATA, VM, a->vm);
185
-{
185
data = FIELD_DP32(data, VDATA, LMUL, emul);
186
- uint8_t funct3 = extract16(opcode, 13, 3);
186
data = FIELD_DP32(data, VDATA, NF, a->nf);
187
- uint8_t rd_rs2 = GET_C_RS2S(opcode);
187
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
188
- uint8_t rs1s = GET_C_RS1S(opcode);
188
return ldst_stride_trans(a->rd, a->rs1, a->rs2, data, fn, s, false);
189
-
189
}
190
- switch (funct3) {
190
191
- case 3:
191
@@ -XXX,XX +XXX,XX @@ static bool ld_index_op(DisasContext *s, arg_rnfvm *a, uint8_t eew)
192
-#if defined(TARGET_RISCV64)
192
data = FIELD_DP32(data, VDATA, VM, a->vm);
193
- /* C.LD(RV64/128) -> ld rd', offset[7:3](rs1')*/
193
data = FIELD_DP32(data, VDATA, LMUL, emul);
194
- gen_load_c(ctx, OPC_RISC_LD, rd_rs2, rs1s,
194
data = FIELD_DP32(data, VDATA, NF, a->nf);
195
- GET_C_LD_IMM(opcode));
195
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
196
-#else
196
return ldst_index_trans(a->rd, a->rs1, a->rs2, data, fn, s, false);
197
- /* C.FLW (RV32) -> flw rd', offset[6:2](rs1')*/
197
}
198
- gen_fp_load(ctx, OPC_RISC_FLW, rd_rs2, rs1s,
198
199
- GET_C_LW_IMM(opcode));
199
@@ -XXX,XX +XXX,XX @@ static bool ldff_op(DisasContext *s, arg_r2nfvm *a, uint8_t eew)
200
-#endif
200
data = FIELD_DP32(data, VDATA, VM, a->vm);
201
- break;
201
data = FIELD_DP32(data, VDATA, LMUL, emul);
202
- case 7:
202
data = FIELD_DP32(data, VDATA, NF, a->nf);
203
-#if defined(TARGET_RISCV64)
203
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
204
- /* C.SD (RV64/128) -> sd rs2', offset[7:3](rs1')*/
204
return ldff_trans(a->rd, a->rs1, data, fn, s);
205
- gen_store_c(ctx, OPC_RISC_SD, rs1s, rd_rs2,
205
}
206
- GET_C_LD_IMM(opcode));
206
207
-#else
208
- /* C.FSW (RV32) -> fsw rs2', offset[6:2](rs1')*/
209
- gen_fp_store(ctx, OPC_RISC_FSW, rs1s, rd_rs2,
210
- GET_C_LW_IMM(opcode));
211
-#endif
212
- break;
213
- }
214
-}
215
-
216
-static void decode_RV32_64C(DisasContext *ctx, uint16_t opcode)
217
-{
218
- uint8_t op = extract16(opcode, 0, 2);
219
-
220
- switch (op) {
221
- case 0:
222
- decode_RV32_64C0(ctx, opcode);
223
- break;
224
- }
225
-}
226
-
227
static int ex_plus_1(DisasContext *ctx, int nf)
228
{
229
return nf + 1;
230
@@ -XXX,XX +XXX,XX @@ static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
231
} else {
232
ctx->pc_succ_insn = ctx->base.pc_next + 2;
233
if (!decode_insn16(ctx, opcode)) {
234
- /* fall back to old decoder */
235
- decode_RV32_64C(ctx, opcode);
236
+ gen_exception_illegal(ctx);
237
}
238
}
239
} else {
240
--
207
--
241
2.30.1
208
2.36.1
242
243
diff view generated by jsdifflib
1
From: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
The previous implementation was broken in many ways:
3
`vmadc` and `vmsbc` produces a mask value, they always operate with
4
- Used mideleg instead of hideleg to mask accesses
4
a tail agnostic policy.
5
- Used MIP_VSSIP instead of VS_MODE_INTERRUPTS to mask writes to vsie
6
- Did not shift between S bits and VS bits (VSEIP <-> SEIP, ...)
7
5
8
Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
6
Signed-off-by: eop Chen <eop.chen@sifive.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Frank Chang <frank.chang@sifive.com>
10
Message-id: 20210311094738.1376795-1-georg.kotheimer@kernkonzept.com
8
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-Id: <165449614532.19704.7000832880482980398-7@git.sr.ht>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
12
---
13
target/riscv/csr.c | 68 +++++++++++++++++++++++-----------------------
13
target/riscv/internals.h | 5 +-
14
1 file changed, 34 insertions(+), 34 deletions(-)
14
target/riscv/vector_helper.c | 314 +++++++++++++-----------
15
target/riscv/insn_trans/trans_rvv.c.inc | 13 +-
16
3 files changed, 190 insertions(+), 142 deletions(-)
15
17
16
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
18
diff --git a/target/riscv/internals.h b/target/riscv/internals.h
17
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
18
--- a/target/riscv/csr.c
20
--- a/target/riscv/internals.h
19
+++ b/target/riscv/csr.c
21
+++ b/target/riscv/internals.h
20
@@ -XXX,XX +XXX,XX @@ static int write_sstatus(CPURISCVState *env, int csrno, target_ulong val)
22
@@ -XXX,XX +XXX,XX @@
21
return write_mstatus(env, CSR_MSTATUS, newval);
23
FIELD(VDATA, VM, 0, 1)
24
FIELD(VDATA, LMUL, 1, 3)
25
FIELD(VDATA, VTA, 4, 1)
26
-FIELD(VDATA, NF, 5, 4)
27
-FIELD(VDATA, WD, 5, 1)
28
+FIELD(VDATA, VTA_ALL_1S, 5, 1)
29
+FIELD(VDATA, NF, 6, 4)
30
+FIELD(VDATA, WD, 6, 1)
31
32
/* float point classify helpers */
33
target_ulong fclass_h(uint64_t frs1);
34
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/riscv/vector_helper.c
37
+++ b/target/riscv/vector_helper.c
38
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vext_vta(uint32_t desc)
39
return FIELD_EX32(simd_data(desc), VDATA, VTA);
22
}
40
}
23
41
24
+static int read_vsie(CPURISCVState *env, int csrno, target_ulong *val)
42
+static inline uint32_t vext_vta_all_1s(uint32_t desc)
25
+{
43
+{
26
+ /* Shift the VS bits to their S bit location in vsie */
44
+ return FIELD_EX32(simd_data(desc), VDATA, VTA_ALL_1S);
27
+ *val = (env->mie & env->hideleg & VS_MODE_INTERRUPTS) >> 1;
28
+ return 0;
29
+}
45
+}
30
+
46
+
31
static int read_sie(CPURISCVState *env, int csrno, target_ulong *val)
47
/*
48
* Get the maximum number of elements can be operated.
49
*
50
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vrsub_vx_d, OP_SSS_D, H8, H8, DO_RSUB)
51
52
static void do_vext_vx(void *vd, void *v0, target_long s1, void *vs2,
53
CPURISCVState *env, uint32_t desc,
54
- opivx2_fn fn)
55
+ opivx2_fn fn, uint32_t esz)
32
{
56
{
33
if (riscv_cpu_virt_enabled(env)) {
57
uint32_t vm = vext_vm(desc);
34
- /* Tell the guest the VS bits, shifted to the S bit locations */
58
uint32_t vl = env->vl;
35
- *val = (env->mie & env->mideleg & VS_MODE_INTERRUPTS) >> 1;
59
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
36
+ read_vsie(env, CSR_VSIE, val);
60
+ uint32_t vta = vext_vta(desc);
37
} else {
61
uint32_t i;
38
*val = env->mie & env->mideleg;
62
63
for (i = env->vstart; i < vl; i++) {
64
@@ -XXX,XX +XXX,XX @@ static void do_vext_vx(void *vd, void *v0, target_long s1, void *vs2,
65
fn(vd, s1, vs2, i);
39
}
66
}
40
return 0;
67
env->vstart = 0;
68
+ /* set tail elements to 1s */
69
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
41
}
70
}
42
71
43
-static int write_sie(CPURISCVState *env, int csrno, target_ulong val)
72
/* generate the helpers for OPIVX */
44
+static int write_vsie(CPURISCVState *env, int csrno, target_ulong val)
73
-#define GEN_VEXT_VX(NAME) \
45
{
74
+#define GEN_VEXT_VX(NAME, ESZ) \
46
- target_ulong newval;
75
void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
47
+ /* Shift the S bits to their VS bit location in mie */
76
void *vs2, CPURISCVState *env, \
48
+ target_ulong newval = (env->mie & ~VS_MODE_INTERRUPTS) |
77
uint32_t desc) \
49
+ ((val << 1) & env->hideleg & VS_MODE_INTERRUPTS);
78
{ \
50
+ return write_mie(env, CSR_MIE, newval);
79
do_vext_vx(vd, v0, s1, vs2, env, desc, \
51
+}
80
- do_##NAME); \
52
81
-}
53
+static int write_sie(CPURISCVState *env, int csrno, target_ulong val)
82
-
54
+{
83
-GEN_VEXT_VX(vadd_vx_b)
55
if (riscv_cpu_virt_enabled(env)) {
84
-GEN_VEXT_VX(vadd_vx_h)
56
- /* Shift the guests S bits to VS */
85
-GEN_VEXT_VX(vadd_vx_w)
57
- newval = (env->mie & ~VS_MODE_INTERRUPTS) |
86
-GEN_VEXT_VX(vadd_vx_d)
58
- ((val << 1) & VS_MODE_INTERRUPTS);
87
-GEN_VEXT_VX(vsub_vx_b)
59
+ write_vsie(env, CSR_VSIE, val);
88
-GEN_VEXT_VX(vsub_vx_h)
60
} else {
89
-GEN_VEXT_VX(vsub_vx_w)
61
- newval = (env->mie & ~S_MODE_INTERRUPTS) | (val & S_MODE_INTERRUPTS);
90
-GEN_VEXT_VX(vsub_vx_d)
62
+ target_ulong newval = (env->mie & ~S_MODE_INTERRUPTS) |
91
-GEN_VEXT_VX(vrsub_vx_b)
63
+ (val & S_MODE_INTERRUPTS);
92
-GEN_VEXT_VX(vrsub_vx_h)
64
+ write_mie(env, CSR_MIE, newval);
93
-GEN_VEXT_VX(vrsub_vx_w)
65
}
94
-GEN_VEXT_VX(vrsub_vx_d)
66
95
+ do_##NAME, ESZ); \
67
- return write_mie(env, CSR_MIE, newval);
68
+ return 0;
69
}
70
71
static int read_stvec(CPURISCVState *env, int csrno, target_ulong *val)
72
@@ -XXX,XX +XXX,XX @@ static int write_sbadaddr(CPURISCVState *env, int csrno, target_ulong val)
73
return 0;
74
}
75
76
+static int rmw_vsip(CPURISCVState *env, int csrno, target_ulong *ret_value,
77
+ target_ulong new_value, target_ulong write_mask)
78
+{
79
+ /* Shift the S bits to their VS bit location in mip */
80
+ int ret = rmw_mip(env, 0, ret_value, new_value << 1,
81
+ (write_mask << 1) & vsip_writable_mask & env->hideleg);
82
+ *ret_value &= VS_MODE_INTERRUPTS;
83
+ /* Shift the VS bits to their S bit location in vsip */
84
+ *ret_value >>= 1;
85
+ return ret;
86
+}
96
+}
87
+
97
+
88
static int rmw_sip(CPURISCVState *env, int csrno, target_ulong *ret_value,
98
+GEN_VEXT_VX(vadd_vx_b, 1)
89
target_ulong new_value, target_ulong write_mask)
99
+GEN_VEXT_VX(vadd_vx_h, 2)
100
+GEN_VEXT_VX(vadd_vx_w, 4)
101
+GEN_VEXT_VX(vadd_vx_d, 8)
102
+GEN_VEXT_VX(vsub_vx_b, 1)
103
+GEN_VEXT_VX(vsub_vx_h, 2)
104
+GEN_VEXT_VX(vsub_vx_w, 4)
105
+GEN_VEXT_VX(vsub_vx_d, 8)
106
+GEN_VEXT_VX(vrsub_vx_b, 1)
107
+GEN_VEXT_VX(vrsub_vx_h, 2)
108
+GEN_VEXT_VX(vrsub_vx_w, 4)
109
+GEN_VEXT_VX(vrsub_vx_d, 8)
110
111
void HELPER(vec_rsubs8)(void *d, void *a, uint64_t b, uint32_t desc)
90
{
112
{
91
int ret;
113
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vwadd_wx_w, WOP_WSSS_W, H8, H4, DO_ADD)
92
114
RVVCALL(OPIVX2, vwsub_wx_b, WOP_WSSS_B, H2, H1, DO_SUB)
93
if (riscv_cpu_virt_enabled(env)) {
115
RVVCALL(OPIVX2, vwsub_wx_h, WOP_WSSS_H, H4, H2, DO_SUB)
94
- /* Shift the new values to line up with the VS bits */
116
RVVCALL(OPIVX2, vwsub_wx_w, WOP_WSSS_W, H8, H4, DO_SUB)
95
- ret = rmw_mip(env, CSR_MSTATUS, ret_value, new_value << 1,
117
-GEN_VEXT_VX(vwaddu_vx_b)
96
- (write_mask & sip_writable_mask) << 1 & env->mideleg);
118
-GEN_VEXT_VX(vwaddu_vx_h)
97
- ret &= vsip_writable_mask;
119
-GEN_VEXT_VX(vwaddu_vx_w)
98
- ret >>= 1;
120
-GEN_VEXT_VX(vwsubu_vx_b)
99
+ ret = rmw_vsip(env, CSR_VSIP, ret_value, new_value, write_mask);
121
-GEN_VEXT_VX(vwsubu_vx_h)
100
} else {
122
-GEN_VEXT_VX(vwsubu_vx_w)
101
ret = rmw_mip(env, CSR_MSTATUS, ret_value, new_value,
123
-GEN_VEXT_VX(vwadd_vx_b)
102
write_mask & env->mideleg & sip_writable_mask);
124
-GEN_VEXT_VX(vwadd_vx_h)
103
@@ -XXX,XX +XXX,XX @@ static int write_vsstatus(CPURISCVState *env, int csrno, target_ulong val)
125
-GEN_VEXT_VX(vwadd_vx_w)
104
return 0;
126
-GEN_VEXT_VX(vwsub_vx_b)
127
-GEN_VEXT_VX(vwsub_vx_h)
128
-GEN_VEXT_VX(vwsub_vx_w)
129
-GEN_VEXT_VX(vwaddu_wx_b)
130
-GEN_VEXT_VX(vwaddu_wx_h)
131
-GEN_VEXT_VX(vwaddu_wx_w)
132
-GEN_VEXT_VX(vwsubu_wx_b)
133
-GEN_VEXT_VX(vwsubu_wx_h)
134
-GEN_VEXT_VX(vwsubu_wx_w)
135
-GEN_VEXT_VX(vwadd_wx_b)
136
-GEN_VEXT_VX(vwadd_wx_h)
137
-GEN_VEXT_VX(vwadd_wx_w)
138
-GEN_VEXT_VX(vwsub_wx_b)
139
-GEN_VEXT_VX(vwsub_wx_h)
140
-GEN_VEXT_VX(vwsub_wx_w)
141
+GEN_VEXT_VX(vwaddu_vx_b, 2)
142
+GEN_VEXT_VX(vwaddu_vx_h, 4)
143
+GEN_VEXT_VX(vwaddu_vx_w, 8)
144
+GEN_VEXT_VX(vwsubu_vx_b, 2)
145
+GEN_VEXT_VX(vwsubu_vx_h, 4)
146
+GEN_VEXT_VX(vwsubu_vx_w, 8)
147
+GEN_VEXT_VX(vwadd_vx_b, 2)
148
+GEN_VEXT_VX(vwadd_vx_h, 4)
149
+GEN_VEXT_VX(vwadd_vx_w, 8)
150
+GEN_VEXT_VX(vwsub_vx_b, 2)
151
+GEN_VEXT_VX(vwsub_vx_h, 4)
152
+GEN_VEXT_VX(vwsub_vx_w, 8)
153
+GEN_VEXT_VX(vwaddu_wx_b, 2)
154
+GEN_VEXT_VX(vwaddu_wx_h, 4)
155
+GEN_VEXT_VX(vwaddu_wx_w, 8)
156
+GEN_VEXT_VX(vwsubu_wx_b, 2)
157
+GEN_VEXT_VX(vwsubu_wx_h, 4)
158
+GEN_VEXT_VX(vwsubu_wx_w, 8)
159
+GEN_VEXT_VX(vwadd_wx_b, 2)
160
+GEN_VEXT_VX(vwadd_wx_h, 4)
161
+GEN_VEXT_VX(vwadd_wx_w, 8)
162
+GEN_VEXT_VX(vwsub_wx_b, 2)
163
+GEN_VEXT_VX(vwsub_wx_h, 4)
164
+GEN_VEXT_VX(vwsub_wx_w, 8)
165
166
/* Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions */
167
#define DO_VADC(N, M, C) (N + M + C)
168
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
169
CPURISCVState *env, uint32_t desc) \
170
{ \
171
uint32_t vl = env->vl; \
172
+ uint32_t esz = sizeof(ETYPE); \
173
+ uint32_t total_elems = \
174
+ vext_get_total_elems(env, desc, esz); \
175
+ uint32_t vta = vext_vta(desc); \
176
uint32_t i; \
177
\
178
for (i = env->vstart; i < vl; i++) { \
179
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
180
*((ETYPE *)vd + H(i)) = DO_OP(s2, s1, carry); \
181
} \
182
env->vstart = 0; \
183
+ /* set tail elements to 1s */ \
184
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
105
}
185
}
106
186
107
-static int rmw_vsip(CPURISCVState *env, int csrno, target_ulong *ret_value,
187
GEN_VEXT_VADC_VVM(vadc_vvm_b, uint8_t, H1, DO_VADC)
108
- target_ulong new_value, target_ulong write_mask)
188
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
109
-{
189
CPURISCVState *env, uint32_t desc) \
110
- int ret = rmw_mip(env, 0, ret_value, new_value,
190
{ \
111
- write_mask & env->mideleg & vsip_writable_mask);
191
uint32_t vl = env->vl; \
112
- return ret;
192
+ uint32_t esz = sizeof(ETYPE); \
113
-}
193
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
114
-
194
+ uint32_t vta = vext_vta(desc); \
115
-static int read_vsie(CPURISCVState *env, int csrno, target_ulong *val)
195
uint32_t i; \
116
-{
196
\
117
- *val = env->mie & env->mideleg & VS_MODE_INTERRUPTS;
197
for (i = env->vstart; i < vl; i++) { \
118
- return 0;
198
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
119
-}
199
*((ETYPE *)vd + H(i)) = DO_OP(s2, (ETYPE)(target_long)s1, carry);\
120
-
200
} \
121
-static int write_vsie(CPURISCVState *env, int csrno, target_ulong val)
201
env->vstart = 0; \
122
-{
202
+ /* set tail elements to 1s */ \
123
- target_ulong newval = (env->mie & ~env->mideleg) | (val & env->mideleg & MIP_VSSIP);
203
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
124
- return write_mie(env, CSR_MIE, newval);
204
}
125
-}
205
126
-
206
GEN_VEXT_VADC_VXM(vadc_vxm_b, uint8_t, H1, DO_VADC)
127
static int read_vstvec(CPURISCVState *env, int csrno, target_ulong *val)
207
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
128
{
208
{ \
129
*val = env->vstvec;
209
uint32_t vl = env->vl; \
210
uint32_t vm = vext_vm(desc); \
211
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen; \
212
+ uint32_t vta_all_1s = vext_vta_all_1s(desc); \
213
uint32_t i; \
214
\
215
for (i = env->vstart; i < vl; i++) { \
216
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
217
vext_set_elem_mask(vd, i, DO_OP(s2, s1, carry)); \
218
} \
219
env->vstart = 0; \
220
+ /* mask destination register are always tail-agnostic */ \
221
+ /* set tail elements to 1s */ \
222
+ if (vta_all_1s) { \
223
+ for (; i < total_elems; i++) { \
224
+ vext_set_elem_mask(vd, i, 1); \
225
+ } \
226
+ } \
227
}
228
229
GEN_VEXT_VMADC_VVM(vmadc_vvm_b, uint8_t, H1, DO_MADC)
230
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
231
{ \
232
uint32_t vl = env->vl; \
233
uint32_t vm = vext_vm(desc); \
234
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen; \
235
+ uint32_t vta_all_1s = vext_vta_all_1s(desc); \
236
uint32_t i; \
237
\
238
for (i = env->vstart; i < vl; i++) { \
239
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
240
DO_OP(s2, (ETYPE)(target_long)s1, carry)); \
241
} \
242
env->vstart = 0; \
243
+ /* mask destination register are always tail-agnostic */ \
244
+ /* set tail elements to 1s */ \
245
+ if (vta_all_1s) { \
246
+ for (; i < total_elems; i++) { \
247
+ vext_set_elem_mask(vd, i, 1); \
248
+ } \
249
+ } \
250
}
251
252
GEN_VEXT_VMADC_VXM(vmadc_vxm_b, uint8_t, H1, DO_MADC)
253
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vxor_vx_b, OP_SSS_B, H1, H1, DO_XOR)
254
RVVCALL(OPIVX2, vxor_vx_h, OP_SSS_H, H2, H2, DO_XOR)
255
RVVCALL(OPIVX2, vxor_vx_w, OP_SSS_W, H4, H4, DO_XOR)
256
RVVCALL(OPIVX2, vxor_vx_d, OP_SSS_D, H8, H8, DO_XOR)
257
-GEN_VEXT_VX(vand_vx_b)
258
-GEN_VEXT_VX(vand_vx_h)
259
-GEN_VEXT_VX(vand_vx_w)
260
-GEN_VEXT_VX(vand_vx_d)
261
-GEN_VEXT_VX(vor_vx_b)
262
-GEN_VEXT_VX(vor_vx_h)
263
-GEN_VEXT_VX(vor_vx_w)
264
-GEN_VEXT_VX(vor_vx_d)
265
-GEN_VEXT_VX(vxor_vx_b)
266
-GEN_VEXT_VX(vxor_vx_h)
267
-GEN_VEXT_VX(vxor_vx_w)
268
-GEN_VEXT_VX(vxor_vx_d)
269
+GEN_VEXT_VX(vand_vx_b, 1)
270
+GEN_VEXT_VX(vand_vx_h, 2)
271
+GEN_VEXT_VX(vand_vx_w, 4)
272
+GEN_VEXT_VX(vand_vx_d, 8)
273
+GEN_VEXT_VX(vor_vx_b, 1)
274
+GEN_VEXT_VX(vor_vx_h, 2)
275
+GEN_VEXT_VX(vor_vx_w, 4)
276
+GEN_VEXT_VX(vor_vx_d, 8)
277
+GEN_VEXT_VX(vxor_vx_b, 1)
278
+GEN_VEXT_VX(vxor_vx_h, 2)
279
+GEN_VEXT_VX(vxor_vx_w, 4)
280
+GEN_VEXT_VX(vxor_vx_d, 8)
281
282
/* Vector Single-Width Bit Shift Instructions */
283
#define DO_SLL(N, M) (N << (M))
284
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vmax_vx_b, OP_SSS_B, H1, H1, DO_MAX)
285
RVVCALL(OPIVX2, vmax_vx_h, OP_SSS_H, H2, H2, DO_MAX)
286
RVVCALL(OPIVX2, vmax_vx_w, OP_SSS_W, H4, H4, DO_MAX)
287
RVVCALL(OPIVX2, vmax_vx_d, OP_SSS_D, H8, H8, DO_MAX)
288
-GEN_VEXT_VX(vminu_vx_b)
289
-GEN_VEXT_VX(vminu_vx_h)
290
-GEN_VEXT_VX(vminu_vx_w)
291
-GEN_VEXT_VX(vminu_vx_d)
292
-GEN_VEXT_VX(vmin_vx_b)
293
-GEN_VEXT_VX(vmin_vx_h)
294
-GEN_VEXT_VX(vmin_vx_w)
295
-GEN_VEXT_VX(vmin_vx_d)
296
-GEN_VEXT_VX(vmaxu_vx_b)
297
-GEN_VEXT_VX(vmaxu_vx_h)
298
-GEN_VEXT_VX(vmaxu_vx_w)
299
-GEN_VEXT_VX(vmaxu_vx_d)
300
-GEN_VEXT_VX(vmax_vx_b)
301
-GEN_VEXT_VX(vmax_vx_h)
302
-GEN_VEXT_VX(vmax_vx_w)
303
-GEN_VEXT_VX(vmax_vx_d)
304
+GEN_VEXT_VX(vminu_vx_b, 1)
305
+GEN_VEXT_VX(vminu_vx_h, 2)
306
+GEN_VEXT_VX(vminu_vx_w, 4)
307
+GEN_VEXT_VX(vminu_vx_d, 8)
308
+GEN_VEXT_VX(vmin_vx_b, 1)
309
+GEN_VEXT_VX(vmin_vx_h, 2)
310
+GEN_VEXT_VX(vmin_vx_w, 4)
311
+GEN_VEXT_VX(vmin_vx_d, 8)
312
+GEN_VEXT_VX(vmaxu_vx_b, 1)
313
+GEN_VEXT_VX(vmaxu_vx_h, 2)
314
+GEN_VEXT_VX(vmaxu_vx_w, 4)
315
+GEN_VEXT_VX(vmaxu_vx_d, 8)
316
+GEN_VEXT_VX(vmax_vx_b, 1)
317
+GEN_VEXT_VX(vmax_vx_h, 2)
318
+GEN_VEXT_VX(vmax_vx_w, 4)
319
+GEN_VEXT_VX(vmax_vx_d, 8)
320
321
/* Vector Single-Width Integer Multiply Instructions */
322
#define DO_MUL(N, M) (N * M)
323
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vmulhsu_vx_b, OP_SUS_B, H1, H1, do_mulhsu_b)
324
RVVCALL(OPIVX2, vmulhsu_vx_h, OP_SUS_H, H2, H2, do_mulhsu_h)
325
RVVCALL(OPIVX2, vmulhsu_vx_w, OP_SUS_W, H4, H4, do_mulhsu_w)
326
RVVCALL(OPIVX2, vmulhsu_vx_d, OP_SUS_D, H8, H8, do_mulhsu_d)
327
-GEN_VEXT_VX(vmul_vx_b)
328
-GEN_VEXT_VX(vmul_vx_h)
329
-GEN_VEXT_VX(vmul_vx_w)
330
-GEN_VEXT_VX(vmul_vx_d)
331
-GEN_VEXT_VX(vmulh_vx_b)
332
-GEN_VEXT_VX(vmulh_vx_h)
333
-GEN_VEXT_VX(vmulh_vx_w)
334
-GEN_VEXT_VX(vmulh_vx_d)
335
-GEN_VEXT_VX(vmulhu_vx_b)
336
-GEN_VEXT_VX(vmulhu_vx_h)
337
-GEN_VEXT_VX(vmulhu_vx_w)
338
-GEN_VEXT_VX(vmulhu_vx_d)
339
-GEN_VEXT_VX(vmulhsu_vx_b)
340
-GEN_VEXT_VX(vmulhsu_vx_h)
341
-GEN_VEXT_VX(vmulhsu_vx_w)
342
-GEN_VEXT_VX(vmulhsu_vx_d)
343
+GEN_VEXT_VX(vmul_vx_b, 1)
344
+GEN_VEXT_VX(vmul_vx_h, 2)
345
+GEN_VEXT_VX(vmul_vx_w, 4)
346
+GEN_VEXT_VX(vmul_vx_d, 8)
347
+GEN_VEXT_VX(vmulh_vx_b, 1)
348
+GEN_VEXT_VX(vmulh_vx_h, 2)
349
+GEN_VEXT_VX(vmulh_vx_w, 4)
350
+GEN_VEXT_VX(vmulh_vx_d, 8)
351
+GEN_VEXT_VX(vmulhu_vx_b, 1)
352
+GEN_VEXT_VX(vmulhu_vx_h, 2)
353
+GEN_VEXT_VX(vmulhu_vx_w, 4)
354
+GEN_VEXT_VX(vmulhu_vx_d, 8)
355
+GEN_VEXT_VX(vmulhsu_vx_b, 1)
356
+GEN_VEXT_VX(vmulhsu_vx_h, 2)
357
+GEN_VEXT_VX(vmulhsu_vx_w, 4)
358
+GEN_VEXT_VX(vmulhsu_vx_d, 8)
359
360
/* Vector Integer Divide Instructions */
361
#define DO_DIVU(N, M) (unlikely(M == 0) ? (__typeof(N))(-1) : N / M)
362
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vrem_vx_b, OP_SSS_B, H1, H1, DO_REM)
363
RVVCALL(OPIVX2, vrem_vx_h, OP_SSS_H, H2, H2, DO_REM)
364
RVVCALL(OPIVX2, vrem_vx_w, OP_SSS_W, H4, H4, DO_REM)
365
RVVCALL(OPIVX2, vrem_vx_d, OP_SSS_D, H8, H8, DO_REM)
366
-GEN_VEXT_VX(vdivu_vx_b)
367
-GEN_VEXT_VX(vdivu_vx_h)
368
-GEN_VEXT_VX(vdivu_vx_w)
369
-GEN_VEXT_VX(vdivu_vx_d)
370
-GEN_VEXT_VX(vdiv_vx_b)
371
-GEN_VEXT_VX(vdiv_vx_h)
372
-GEN_VEXT_VX(vdiv_vx_w)
373
-GEN_VEXT_VX(vdiv_vx_d)
374
-GEN_VEXT_VX(vremu_vx_b)
375
-GEN_VEXT_VX(vremu_vx_h)
376
-GEN_VEXT_VX(vremu_vx_w)
377
-GEN_VEXT_VX(vremu_vx_d)
378
-GEN_VEXT_VX(vrem_vx_b)
379
-GEN_VEXT_VX(vrem_vx_h)
380
-GEN_VEXT_VX(vrem_vx_w)
381
-GEN_VEXT_VX(vrem_vx_d)
382
+GEN_VEXT_VX(vdivu_vx_b, 1)
383
+GEN_VEXT_VX(vdivu_vx_h, 2)
384
+GEN_VEXT_VX(vdivu_vx_w, 4)
385
+GEN_VEXT_VX(vdivu_vx_d, 8)
386
+GEN_VEXT_VX(vdiv_vx_b, 1)
387
+GEN_VEXT_VX(vdiv_vx_h, 2)
388
+GEN_VEXT_VX(vdiv_vx_w, 4)
389
+GEN_VEXT_VX(vdiv_vx_d, 8)
390
+GEN_VEXT_VX(vremu_vx_b, 1)
391
+GEN_VEXT_VX(vremu_vx_h, 2)
392
+GEN_VEXT_VX(vremu_vx_w, 4)
393
+GEN_VEXT_VX(vremu_vx_d, 8)
394
+GEN_VEXT_VX(vrem_vx_b, 1)
395
+GEN_VEXT_VX(vrem_vx_h, 2)
396
+GEN_VEXT_VX(vrem_vx_w, 4)
397
+GEN_VEXT_VX(vrem_vx_d, 8)
398
399
/* Vector Widening Integer Multiply Instructions */
400
RVVCALL(OPIVV2, vwmul_vv_b, WOP_SSS_B, H2, H1, H1, DO_MUL)
401
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX2, vwmulu_vx_w, WOP_UUU_W, H8, H4, DO_MUL)
402
RVVCALL(OPIVX2, vwmulsu_vx_b, WOP_SUS_B, H2, H1, DO_MUL)
403
RVVCALL(OPIVX2, vwmulsu_vx_h, WOP_SUS_H, H4, H2, DO_MUL)
404
RVVCALL(OPIVX2, vwmulsu_vx_w, WOP_SUS_W, H8, H4, DO_MUL)
405
-GEN_VEXT_VX(vwmul_vx_b)
406
-GEN_VEXT_VX(vwmul_vx_h)
407
-GEN_VEXT_VX(vwmul_vx_w)
408
-GEN_VEXT_VX(vwmulu_vx_b)
409
-GEN_VEXT_VX(vwmulu_vx_h)
410
-GEN_VEXT_VX(vwmulu_vx_w)
411
-GEN_VEXT_VX(vwmulsu_vx_b)
412
-GEN_VEXT_VX(vwmulsu_vx_h)
413
-GEN_VEXT_VX(vwmulsu_vx_w)
414
+GEN_VEXT_VX(vwmul_vx_b, 2)
415
+GEN_VEXT_VX(vwmul_vx_h, 4)
416
+GEN_VEXT_VX(vwmul_vx_w, 8)
417
+GEN_VEXT_VX(vwmulu_vx_b, 2)
418
+GEN_VEXT_VX(vwmulu_vx_h, 4)
419
+GEN_VEXT_VX(vwmulu_vx_w, 8)
420
+GEN_VEXT_VX(vwmulsu_vx_b, 2)
421
+GEN_VEXT_VX(vwmulsu_vx_h, 4)
422
+GEN_VEXT_VX(vwmulsu_vx_w, 8)
423
424
/* Vector Single-Width Integer Multiply-Add Instructions */
425
#define OPIVV3(NAME, TD, T1, T2, TX1, TX2, HD, HS1, HS2, OP) \
426
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX3, vnmsub_vx_b, OP_SSS_B, H1, H1, DO_NMSUB)
427
RVVCALL(OPIVX3, vnmsub_vx_h, OP_SSS_H, H2, H2, DO_NMSUB)
428
RVVCALL(OPIVX3, vnmsub_vx_w, OP_SSS_W, H4, H4, DO_NMSUB)
429
RVVCALL(OPIVX3, vnmsub_vx_d, OP_SSS_D, H8, H8, DO_NMSUB)
430
-GEN_VEXT_VX(vmacc_vx_b)
431
-GEN_VEXT_VX(vmacc_vx_h)
432
-GEN_VEXT_VX(vmacc_vx_w)
433
-GEN_VEXT_VX(vmacc_vx_d)
434
-GEN_VEXT_VX(vnmsac_vx_b)
435
-GEN_VEXT_VX(vnmsac_vx_h)
436
-GEN_VEXT_VX(vnmsac_vx_w)
437
-GEN_VEXT_VX(vnmsac_vx_d)
438
-GEN_VEXT_VX(vmadd_vx_b)
439
-GEN_VEXT_VX(vmadd_vx_h)
440
-GEN_VEXT_VX(vmadd_vx_w)
441
-GEN_VEXT_VX(vmadd_vx_d)
442
-GEN_VEXT_VX(vnmsub_vx_b)
443
-GEN_VEXT_VX(vnmsub_vx_h)
444
-GEN_VEXT_VX(vnmsub_vx_w)
445
-GEN_VEXT_VX(vnmsub_vx_d)
446
+GEN_VEXT_VX(vmacc_vx_b, 1)
447
+GEN_VEXT_VX(vmacc_vx_h, 2)
448
+GEN_VEXT_VX(vmacc_vx_w, 4)
449
+GEN_VEXT_VX(vmacc_vx_d, 8)
450
+GEN_VEXT_VX(vnmsac_vx_b, 1)
451
+GEN_VEXT_VX(vnmsac_vx_h, 2)
452
+GEN_VEXT_VX(vnmsac_vx_w, 4)
453
+GEN_VEXT_VX(vnmsac_vx_d, 8)
454
+GEN_VEXT_VX(vmadd_vx_b, 1)
455
+GEN_VEXT_VX(vmadd_vx_h, 2)
456
+GEN_VEXT_VX(vmadd_vx_w, 4)
457
+GEN_VEXT_VX(vmadd_vx_d, 8)
458
+GEN_VEXT_VX(vnmsub_vx_b, 1)
459
+GEN_VEXT_VX(vnmsub_vx_h, 2)
460
+GEN_VEXT_VX(vnmsub_vx_w, 4)
461
+GEN_VEXT_VX(vnmsub_vx_d, 8)
462
463
/* Vector Widening Integer Multiply-Add Instructions */
464
RVVCALL(OPIVV3, vwmaccu_vv_b, WOP_UUU_B, H2, H1, H1, DO_MACC)
465
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVX3, vwmaccsu_vx_w, WOP_SSU_W, H8, H4, DO_MACC)
466
RVVCALL(OPIVX3, vwmaccus_vx_b, WOP_SUS_B, H2, H1, DO_MACC)
467
RVVCALL(OPIVX3, vwmaccus_vx_h, WOP_SUS_H, H4, H2, DO_MACC)
468
RVVCALL(OPIVX3, vwmaccus_vx_w, WOP_SUS_W, H8, H4, DO_MACC)
469
-GEN_VEXT_VX(vwmaccu_vx_b)
470
-GEN_VEXT_VX(vwmaccu_vx_h)
471
-GEN_VEXT_VX(vwmaccu_vx_w)
472
-GEN_VEXT_VX(vwmacc_vx_b)
473
-GEN_VEXT_VX(vwmacc_vx_h)
474
-GEN_VEXT_VX(vwmacc_vx_w)
475
-GEN_VEXT_VX(vwmaccsu_vx_b)
476
-GEN_VEXT_VX(vwmaccsu_vx_h)
477
-GEN_VEXT_VX(vwmaccsu_vx_w)
478
-GEN_VEXT_VX(vwmaccus_vx_b)
479
-GEN_VEXT_VX(vwmaccus_vx_h)
480
-GEN_VEXT_VX(vwmaccus_vx_w)
481
+GEN_VEXT_VX(vwmaccu_vx_b, 2)
482
+GEN_VEXT_VX(vwmaccu_vx_h, 4)
483
+GEN_VEXT_VX(vwmaccu_vx_w, 8)
484
+GEN_VEXT_VX(vwmacc_vx_b, 2)
485
+GEN_VEXT_VX(vwmacc_vx_h, 4)
486
+GEN_VEXT_VX(vwmacc_vx_w, 8)
487
+GEN_VEXT_VX(vwmaccsu_vx_b, 2)
488
+GEN_VEXT_VX(vwmaccsu_vx_h, 4)
489
+GEN_VEXT_VX(vwmaccsu_vx_w, 8)
490
+GEN_VEXT_VX(vwmaccus_vx_b, 2)
491
+GEN_VEXT_VX(vwmaccus_vx_h, 4)
492
+GEN_VEXT_VX(vwmaccus_vx_w, 8)
493
494
/* Vector Integer Merge and Move Instructions */
495
#define GEN_VEXT_VMV_VV(NAME, ETYPE, H) \
496
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
497
index XXXXXXX..XXXXXXX 100644
498
--- a/target/riscv/insn_trans/trans_rvv.c.inc
499
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
500
@@ -XXX,XX +XXX,XX @@ static bool opivx_trans(uint32_t vd, uint32_t rs1, uint32_t vs2, uint32_t vm,
501
502
data = FIELD_DP32(data, VDATA, VM, vm);
503
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
504
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
505
+ data = FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s);
506
desc = tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8,
507
s->cfg_ptr->vlen / 8, data));
508
509
@@ -XXX,XX +XXX,XX @@ do_opivx_gvec(DisasContext *s, arg_rmrr *a, GVecGen2sFn *gvec_fn,
510
return false;
511
}
512
513
- if (a->vm && s->vl_eq_vlmax) {
514
+ if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
515
TCGv_i64 src1 = tcg_temp_new_i64();
516
517
tcg_gen_ext_tl_i64(src1, get_gpr(s, a->rs1, EXT_SIGN));
518
@@ -XXX,XX +XXX,XX @@ static bool opivi_trans(uint32_t vd, uint32_t imm, uint32_t vs2, uint32_t vm,
519
520
data = FIELD_DP32(data, VDATA, VM, vm);
521
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
522
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
523
+ data = FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s);
524
desc = tcg_constant_i32(simd_desc(s->cfg_ptr->vlen / 8,
525
s->cfg_ptr->vlen / 8, data));
526
527
@@ -XXX,XX +XXX,XX @@ do_opivi_gvec(DisasContext *s, arg_rmrr *a, GVecGen2iFn *gvec_fn,
528
return false;
529
}
530
531
- if (a->vm && s->vl_eq_vlmax) {
532
+ if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
533
gvec_fn(s->sew, vreg_ofs(s, a->rd), vreg_ofs(s, a->rs2),
534
extract_imm(s, a->rs1, imm_mode), MAXSZ(s), MAXSZ(s));
535
mark_vs_dirty(s);
536
@@ -XXX,XX +XXX,XX @@ static bool do_opivv_widen(DisasContext *s, arg_rmrr *a,
537
538
data = FIELD_DP32(data, VDATA, VM, a->vm);
539
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
540
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
541
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0),
542
vreg_ofs(s, a->rs1),
543
vreg_ofs(s, a->rs2),
544
@@ -XXX,XX +XXX,XX @@ static bool do_opiwv_widen(DisasContext *s, arg_rmrr *a,
545
546
data = FIELD_DP32(data, VDATA, VM, a->vm);
547
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
548
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
549
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0),
550
vreg_ofs(s, a->rs1),
551
vreg_ofs(s, a->rs2),
552
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
553
\
554
data = FIELD_DP32(data, VDATA, VM, a->vm); \
555
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
556
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
557
+ data = \
558
+ FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s);\
559
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
560
vreg_ofs(s, a->rs1), \
561
vreg_ofs(s, a->rs2), cpu_env, \
130
--
562
--
131
2.30.1
563
2.36.1
132
133
diff view generated by jsdifflib
1
From: Alexander Wagner <alexander.wagner@ulal.de>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
Not disabling the UART leads to QEMU overwriting the UART receive buffer with
3
Signed-off-by: eop Chen <eop.chen@sifive.com>
4
the newest received byte. The rx_level variable is added to allow the use of
4
Reviewed-by: Frank Chang <frank.chang@sifive.com>
5
the existing OpenTitan driver libraries.
5
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
6
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
Signed-off-by: Alexander Wagner <alexander.wagner@ulal.de>
7
Message-Id: <165449614532.19704.7000832880482980398-8@git.sr.ht>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20210309152130.13038-1-alexander.wagner@ulal.de
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
9
---
12
include/hw/char/ibex_uart.h | 4 ++++
10
target/riscv/vector_helper.c | 11 +++++++++++
13
hw/char/ibex_uart.c | 23 ++++++++++++++++++-----
11
target/riscv/insn_trans/trans_rvv.c.inc | 3 ++-
14
2 files changed, 22 insertions(+), 5 deletions(-)
12
2 files changed, 13 insertions(+), 1 deletion(-)
15
13
16
diff --git a/include/hw/char/ibex_uart.h b/include/hw/char/ibex_uart.h
14
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/char/ibex_uart.h
16
--- a/target/riscv/vector_helper.c
19
+++ b/include/hw/char/ibex_uart.h
17
+++ b/target/riscv/vector_helper.c
20
@@ -XXX,XX +XXX,XX @@ REG32(FIFO_CTRL, 0x1c)
18
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
21
FIELD(FIFO_CTRL, RXILVL, 2, 3)
19
{ \
22
FIELD(FIFO_CTRL, TXILVL, 5, 2)
20
uint32_t vm = vext_vm(desc); \
23
REG32(FIFO_STATUS, 0x20)
21
uint32_t vl = env->vl; \
24
+ FIELD(FIFO_STATUS, TXLVL, 0, 5)
22
+ uint32_t esz = sizeof(TS1); \
25
+ FIELD(FIFO_STATUS, RXLVL, 16, 5)
23
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
26
REG32(OVRD, 0x24)
24
+ uint32_t vta = vext_vta(desc); \
27
REG32(VAL, 0x28)
25
uint32_t i; \
28
REG32(TIMEOUT_CTRL, 0x2c)
26
\
29
@@ -XXX,XX +XXX,XX @@ struct IbexUartState {
27
for (i = env->vstart; i < vl; i++) { \
30
uint8_t tx_fifo[IBEX_UART_TX_FIFO_SIZE];
28
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
31
uint32_t tx_level;
29
*((TS1 *)vd + HS1(i)) = OP(s2, s1 & MASK); \
32
30
} \
33
+ uint32_t rx_level;
31
env->vstart = 0; \
34
+
32
+ /* set tail elements to 1s */ \
35
QEMUTimer *fifo_trigger_handle;
33
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
36
uint64_t char_tx_time;
34
}
37
35
38
diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c
36
GEN_VEXT_SHIFT_VV(vsll_vv_b, uint8_t, uint8_t, H1, H1, DO_SLL, 0x7)
37
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
38
{ \
39
uint32_t vm = vext_vm(desc); \
40
uint32_t vl = env->vl; \
41
+ uint32_t esz = sizeof(TD); \
42
+ uint32_t total_elems = \
43
+ vext_get_total_elems(env, desc, esz); \
44
+ uint32_t vta = vext_vta(desc); \
45
uint32_t i; \
46
\
47
for (i = env->vstart; i < vl; i++) { \
48
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
49
*((TD *)vd + HD(i)) = OP(s2, s1 & MASK); \
50
} \
51
env->vstart = 0; \
52
+ /* set tail elements to 1s */ \
53
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);\
54
}
55
56
GEN_VEXT_SHIFT_VX(vsll_vx_b, uint8_t, int8_t, H1, H1, DO_SLL, 0x7)
57
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
39
index XXXXXXX..XXXXXXX 100644
58
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/char/ibex_uart.c
59
--- a/target/riscv/insn_trans/trans_rvv.c.inc
41
+++ b/hw/char/ibex_uart.c
60
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
42
@@ -XXX,XX +XXX,XX @@ static int ibex_uart_can_receive(void *opaque)
61
@@ -XXX,XX +XXX,XX @@ do_opivx_gvec_shift(DisasContext *s, arg_rmrr *a, GVecGen2sFn32 *gvec_fn,
43
{
62
return false;
44
IbexUartState *s = opaque;
45
46
- if (s->uart_ctrl & R_CTRL_RX_ENABLE_MASK) {
47
+ if ((s->uart_ctrl & R_CTRL_RX_ENABLE_MASK)
48
+ && !(s->uart_status & R_STATUS_RXFULL_MASK)) {
49
return 1;
50
}
63
}
51
64
52
@@ -XXX,XX +XXX,XX @@ static void ibex_uart_receive(void *opaque, const uint8_t *buf, int size)
65
- if (a->vm && s->vl_eq_vlmax) {
53
66
+ if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
54
s->uart_status &= ~R_STATUS_RXIDLE_MASK;
67
TCGv_i32 src1 = tcg_temp_new_i32();
55
s->uart_status &= ~R_STATUS_RXEMPTY_MASK;
68
56
+ /* The RXFULL is set after receiving a single byte
69
tcg_gen_trunc_tl_i32(src1, get_gpr(s, a->rs1, EXT_NONE));
57
+ * as the FIFO buffers are not yet implemented.
70
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
58
+ */
71
\
59
+ s->uart_status |= R_STATUS_RXFULL_MASK;
72
data = FIELD_DP32(data, VDATA, VM, a->vm); \
60
+ s->rx_level += 1;
73
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
61
74
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
62
if (size > rx_fifo_level) {
75
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
63
s->uart_intr_state |= R_INTR_STATE_RX_WATERMARK_MASK;
76
vreg_ofs(s, a->rs1), \
64
@@ -XXX,XX +XXX,XX @@ static void ibex_uart_reset(DeviceState *dev)
77
vreg_ofs(s, a->rs2), cpu_env, \
65
s->uart_timeout_ctrl = 0x00000000;
66
67
s->tx_level = 0;
68
+ s->rx_level = 0;
69
70
s->char_tx_time = (NANOSECONDS_PER_SECOND / 230400) * 10;
71
72
@@ -XXX,XX +XXX,XX @@ static uint64_t ibex_uart_read(void *opaque, hwaddr addr,
73
74
case R_RDATA:
75
retvalue = s->uart_rdata;
76
- if (s->uart_ctrl & R_CTRL_RX_ENABLE_MASK) {
77
+ if ((s->uart_ctrl & R_CTRL_RX_ENABLE_MASK) && (s->rx_level > 0)) {
78
qemu_chr_fe_accept_input(&s->chr);
79
80
- s->uart_status |= R_STATUS_RXIDLE_MASK;
81
- s->uart_status |= R_STATUS_RXEMPTY_MASK;
82
+ s->rx_level -= 1;
83
+ s->uart_status &= ~R_STATUS_RXFULL_MASK;
84
+ if (s->rx_level == 0) {
85
+ s->uart_status |= R_STATUS_RXIDLE_MASK;
86
+ s->uart_status |= R_STATUS_RXEMPTY_MASK;
87
+ }
88
}
89
break;
90
case R_WDATA:
91
@@ -XXX,XX +XXX,XX @@ static uint64_t ibex_uart_read(void *opaque, hwaddr addr,
92
case R_FIFO_STATUS:
93
retvalue = s->uart_fifo_status;
94
95
- retvalue |= s->tx_level & 0x1F;
96
+ retvalue |= (s->rx_level & 0x1F) << R_FIFO_STATUS_RXLVL_SHIFT;
97
+ retvalue |= (s->tx_level & 0x1F) << R_FIFO_STATUS_TXLVL_SHIFT;
98
99
qemu_log_mask(LOG_UNIMP,
100
"%s: RX fifos are not supported\n", __func__);
101
@@ -XXX,XX +XXX,XX @@ static void ibex_uart_write(void *opaque, hwaddr addr,
102
s->uart_fifo_ctrl = value;
103
104
if (value & R_FIFO_CTRL_RXRST_MASK) {
105
+ s->rx_level = 0;
106
qemu_log_mask(LOG_UNIMP,
107
"%s: RX fifos are not supported\n", __func__);
108
}
109
--
78
--
110
2.30.1
79
2.36.1
111
112
diff view generated by jsdifflib
New patch
1
From: eopXD <yueh.ting.chen@gmail.com>
1
2
3
Compares write mask registers, and so always operate under a tail-
4
agnostic policy.
5
6
Signed-off-by: eop Chen <eop.chen@sifive.com>
7
Reviewed-by: Frank Chang <frank.chang@sifive.com>
8
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-Id: <165449614532.19704.7000832880482980398-9@git.sr.ht>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
target/riscv/vector_helper.c | 18 ++++++++++++++++++
14
1 file changed, 18 insertions(+)
15
16
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/riscv/vector_helper.c
19
+++ b/target/riscv/vector_helper.c
20
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
21
{ \
22
uint32_t vm = vext_vm(desc); \
23
uint32_t vl = env->vl; \
24
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen; \
25
+ uint32_t vta_all_1s = vext_vta_all_1s(desc); \
26
uint32_t i; \
27
\
28
for (i = env->vstart; i < vl; i++) { \
29
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
30
vext_set_elem_mask(vd, i, DO_OP(s2, s1)); \
31
} \
32
env->vstart = 0; \
33
+ /* mask destination register are always tail-agnostic */ \
34
+ /* set tail elements to 1s */ \
35
+ if (vta_all_1s) { \
36
+ for (; i < total_elems; i++) { \
37
+ vext_set_elem_mask(vd, i, 1); \
38
+ } \
39
+ } \
40
}
41
42
GEN_VEXT_CMP_VV(vmseq_vv_b, uint8_t, H1, DO_MSEQ)
43
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
44
{ \
45
uint32_t vm = vext_vm(desc); \
46
uint32_t vl = env->vl; \
47
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen; \
48
+ uint32_t vta_all_1s = vext_vta_all_1s(desc); \
49
uint32_t i; \
50
\
51
for (i = env->vstart; i < vl; i++) { \
52
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
53
DO_OP(s2, (ETYPE)(target_long)s1)); \
54
} \
55
env->vstart = 0; \
56
+ /* mask destination register are always tail-agnostic */ \
57
+ /* set tail elements to 1s */ \
58
+ if (vta_all_1s) { \
59
+ for (; i < total_elems; i++) { \
60
+ vext_set_elem_mask(vd, i, 1); \
61
+ } \
62
+ } \
63
}
64
65
GEN_VEXT_CMP_VX(vmseq_vx_b, uint8_t, H1, DO_MSEQ)
66
--
67
2.36.1
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
This adds the documentation to describe what is supported for the
3
Signed-off-by: eop Chen <eop.chen@sifive.com>
4
'microchip-icicle-kit' machine, and how to boot the machine in QEMU.
4
Reviewed-by: Frank Chang <frank.chang@sifive.com>
5
5
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
6
Signed-off-by: Bin Meng <bin.meng@windriver.com>
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-Id: <165449614532.19704.7000832880482980398-10@git.sr.ht>
8
Message-id: 20210322075248.136255-2-bmeng.cn@gmail.com
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
9
---
11
docs/system/riscv/microchip-icicle-kit.rst | 89 ++++++++++++++++++++++
10
target/riscv/vector_helper.c | 20 ++++++++++++++++++++
12
docs/system/target-riscv.rst | 1 +
11
target/riscv/insn_trans/trans_rvv.c.inc | 12 ++++++++----
13
2 files changed, 90 insertions(+)
12
2 files changed, 28 insertions(+), 4 deletions(-)
14
create mode 100644 docs/system/riscv/microchip-icicle-kit.rst
15
13
16
diff --git a/docs/system/riscv/microchip-icicle-kit.rst b/docs/system/riscv/microchip-icicle-kit.rst
14
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
17
new file mode 100644
18
index XXXXXXX..XXXXXXX
19
--- /dev/null
20
+++ b/docs/system/riscv/microchip-icicle-kit.rst
21
@@ -XXX,XX +XXX,XX @@
22
+Microchip PolarFire SoC Icicle Kit (``microchip-icicle-kit``)
23
+=============================================================
24
+
25
+Microchip PolarFire SoC Icicle Kit integrates a PolarFire SoC, with one
26
+SiFive's E51 plus four U54 cores and many on-chip peripherals and an FPGA.
27
+
28
+For more details about Microchip PolarFire SoC, please see:
29
+https://www.microsemi.com/product-directory/soc-fpgas/5498-polarfire-soc-fpga
30
+
31
+The Icicle Kit board information can be found here:
32
+https://www.microsemi.com/existing-parts/parts/152514
33
+
34
+Supported devices
35
+-----------------
36
+
37
+The ``microchip-icicle-kit`` machine supports the following devices:
38
+
39
+ * 1 E51 core
40
+ * 4 U54 cores
41
+ * Core Level Interruptor (CLINT)
42
+ * Platform-Level Interrupt Controller (PLIC)
43
+ * L2 Loosely Integrated Memory (L2-LIM)
44
+ * DDR memory controller
45
+ * 5 MMUARTs
46
+ * 1 DMA controller
47
+ * 2 GEM Ethernet controllers
48
+ * 1 SDHC storage controller
49
+
50
+Boot options
51
+------------
52
+
53
+The ``microchip-icicle-kit`` machine can start using the standard -bios
54
+functionality for loading its BIOS image, aka Hart Software Services (HSS_).
55
+HSS loads the second stage bootloader U-Boot from an SD card. It does not
56
+support direct kernel loading via the -kernel option. One has to load kernel
57
+from U-Boot.
58
+
59
+The memory is set to 1537 MiB by default which is the minimum required high
60
+memory size by HSS. A sanity check on ram size is performed in the machine
61
+init routine to prompt user to increase the RAM size to > 1537 MiB when less
62
+than 1537 MiB ram is detected.
63
+
64
+Boot the machine
65
+----------------
66
+
67
+HSS 2020.12 release is tested at the time of writing. To build an HSS image
68
+that can be booted by the ``microchip-icicle-kit`` machine, type the following
69
+in the HSS source tree:
70
+
71
+.. code-block:: bash
72
+
73
+ $ export CROSS_COMPILE=riscv64-linux-
74
+ $ cp boards/mpfs-icicle-kit-es/def_config .config
75
+ $ make BOARD=mpfs-icicle-kit-es
76
+
77
+Download the official SD card image released by Microchip and prepare it for
78
+QEMU usage:
79
+
80
+.. code-block:: bash
81
+
82
+ $ wget ftp://ftpsoc.microsemi.com/outgoing/core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic.gz
83
+ $ gunzip core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic.gz
84
+ $ qemu-img resize core-image-minimal-dev-icicle-kit-es-sd-20201009141623.rootfs.wic 4G
85
+
86
+Then we can boot the machine by:
87
+
88
+.. code-block:: bash
89
+
90
+ $ qemu-system-riscv64 -M microchip-icicle-kit -smp 5 \
91
+ -bios path/to/hss.bin -sd path/to/sdcard.img \
92
+ -nic user,model=cadence_gem \
93
+ -nic tap,ifname=tap,model=cadence_gem,script=no \
94
+ -display none -serial stdio \
95
+ -chardev socket,id=serial1,path=serial1.sock,server=on,wait=on \
96
+ -serial chardev:serial1
97
+
98
+With above command line, current terminal session will be used for the first
99
+serial port. Open another terminal window, and use `minicom` to connect the
100
+second serial port.
101
+
102
+.. code-block:: bash
103
+
104
+ $ minicom -D unix\#serial1.sock
105
+
106
+HSS output is on the first serial port (stdio) and U-Boot outputs on the
107
+second serial port. U-Boot will automatically load the Linux kernel from
108
+the SD card image.
109
+
110
+.. _HSS: https://github.com/polarfire-soc/hart-software-services
111
diff --git a/docs/system/target-riscv.rst b/docs/system/target-riscv.rst
112
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
113
--- a/docs/system/target-riscv.rst
16
--- a/target/riscv/vector_helper.c
114
+++ b/docs/system/target-riscv.rst
17
+++ b/target/riscv/vector_helper.c
115
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
18
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vs1, CPURISCVState *env, \
116
.. toctree::
19
uint32_t desc) \
117
:maxdepth: 1
20
{ \
118
21
uint32_t vl = env->vl; \
119
+ riscv/microchip-icicle-kit
22
+ uint32_t esz = sizeof(ETYPE); \
120
riscv/sifive_u
23
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
121
24
+ uint32_t vta = vext_vta(desc); \
122
RISC-V CPU features
25
uint32_t i; \
26
\
27
for (i = env->vstart; i < vl; i++) { \
28
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vs1, CPURISCVState *env, \
29
*((ETYPE *)vd + H(i)) = s1; \
30
} \
31
env->vstart = 0; \
32
+ /* set tail elements to 1s */ \
33
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
34
}
35
36
GEN_VEXT_VMV_VV(vmv_v_v_b, int8_t, H1)
37
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, uint64_t s1, CPURISCVState *env, \
38
uint32_t desc) \
39
{ \
40
uint32_t vl = env->vl; \
41
+ uint32_t esz = sizeof(ETYPE); \
42
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
43
+ uint32_t vta = vext_vta(desc); \
44
uint32_t i; \
45
\
46
for (i = env->vstart; i < vl; i++) { \
47
*((ETYPE *)vd + H(i)) = (ETYPE)s1; \
48
} \
49
env->vstart = 0; \
50
+ /* set tail elements to 1s */ \
51
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
52
}
53
54
GEN_VEXT_VMV_VX(vmv_v_x_b, int8_t, H1)
55
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
56
CPURISCVState *env, uint32_t desc) \
57
{ \
58
uint32_t vl = env->vl; \
59
+ uint32_t esz = sizeof(ETYPE); \
60
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
61
+ uint32_t vta = vext_vta(desc); \
62
uint32_t i; \
63
\
64
for (i = env->vstart; i < vl; i++) { \
65
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
66
*((ETYPE *)vd + H(i)) = *(vt + H(i)); \
67
} \
68
env->vstart = 0; \
69
+ /* set tail elements to 1s */ \
70
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
71
}
72
73
GEN_VEXT_VMERGE_VV(vmerge_vvm_b, int8_t, H1)
74
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
75
void *vs2, CPURISCVState *env, uint32_t desc) \
76
{ \
77
uint32_t vl = env->vl; \
78
+ uint32_t esz = sizeof(ETYPE); \
79
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
80
+ uint32_t vta = vext_vta(desc); \
81
uint32_t i; \
82
\
83
for (i = env->vstart; i < vl; i++) { \
84
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
85
*((ETYPE *)vd + H(i)) = d; \
86
} \
87
env->vstart = 0; \
88
+ /* set tail elements to 1s */ \
89
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
90
}
91
92
GEN_VEXT_VMERGE_VX(vmerge_vxm_b, int8_t, H1)
93
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
94
index XXXXXXX..XXXXXXX 100644
95
--- a/target/riscv/insn_trans/trans_rvv.c.inc
96
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
97
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_v(DisasContext *s, arg_vmv_v_v *a)
98
vext_check_isa_ill(s) &&
99
/* vmv.v.v has rs2 = 0 and vm = 1 */
100
vext_check_sss(s, a->rd, a->rs1, 0, 1)) {
101
- if (s->vl_eq_vlmax) {
102
+ if (s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
103
tcg_gen_gvec_mov(s->sew, vreg_ofs(s, a->rd),
104
vreg_ofs(s, a->rs1),
105
MAXSZ(s), MAXSZ(s));
106
} else {
107
uint32_t data = FIELD_DP32(0, VDATA, LMUL, s->lmul);
108
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
109
static gen_helper_gvec_2_ptr * const fns[4] = {
110
gen_helper_vmv_v_v_b, gen_helper_vmv_v_v_h,
111
gen_helper_vmv_v_v_w, gen_helper_vmv_v_v_d,
112
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_x(DisasContext *s, arg_vmv_v_x *a)
113
114
s1 = get_gpr(s, a->rs1, EXT_SIGN);
115
116
- if (s->vl_eq_vlmax) {
117
+ if (s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
118
tcg_gen_gvec_dup_tl(s->sew, vreg_ofs(s, a->rd),
119
MAXSZ(s), MAXSZ(s), s1);
120
} else {
121
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_x(DisasContext *s, arg_vmv_v_x *a)
122
TCGv_i64 s1_i64 = tcg_temp_new_i64();
123
TCGv_ptr dest = tcg_temp_new_ptr();
124
uint32_t data = FIELD_DP32(0, VDATA, LMUL, s->lmul);
125
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
126
static gen_helper_vmv_vx * const fns[4] = {
127
gen_helper_vmv_v_x_b, gen_helper_vmv_v_x_h,
128
gen_helper_vmv_v_x_w, gen_helper_vmv_v_x_d,
129
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
130
/* vmv.v.i has rs2 = 0 and vm = 1 */
131
vext_check_ss(s, a->rd, 0, 1)) {
132
int64_t simm = sextract64(a->rs1, 0, 5);
133
- if (s->vl_eq_vlmax) {
134
+ if (s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
135
tcg_gen_gvec_dup_imm(s->sew, vreg_ofs(s, a->rd),
136
MAXSZ(s), MAXSZ(s), simm);
137
mark_vs_dirty(s);
138
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_i(DisasContext *s, arg_vmv_v_i *a)
139
TCGv_i64 s1;
140
TCGv_ptr dest;
141
uint32_t data = FIELD_DP32(0, VDATA, LMUL, s->lmul);
142
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
143
static gen_helper_vmv_vx * const fns[4] = {
144
gen_helper_vmv_v_x_b, gen_helper_vmv_v_x_h,
145
gen_helper_vmv_v_x_w, gen_helper_vmv_v_x_d,
146
@@ -XXX,XX +XXX,XX @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a)
147
148
TCGv_i64 t1;
149
150
- if (s->vl_eq_vlmax) {
151
+ if (s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
152
t1 = tcg_temp_new_i64();
153
/* NaN-box f[rs1] */
154
do_nanbox(s, t1, cpu_fpr[a->rs1]);
155
@@ -XXX,XX +XXX,XX @@ static bool trans_vfmv_v_f(DisasContext *s, arg_vfmv_v_f *a)
156
TCGv_ptr dest;
157
TCGv_i32 desc;
158
uint32_t data = FIELD_DP32(0, VDATA, LMUL, s->lmul);
159
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
160
static gen_helper_vmv_vx * const fns[3] = {
161
gen_helper_vmv_v_x_h,
162
gen_helper_vmv_v_x_w,
123
--
163
--
124
2.30.1
164
2.36.1
125
126
diff view generated by jsdifflib
1
From: Jim Shu <cwshu@andestech.com>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
If PMP permission of any address has been changed by updating PMP entry,
3
Signed-off-by: eop Chen <eop.chen@sifive.com>
4
flush all TLB pages to prevent from getting old permission.
4
Reviewed-by: Frank Chang <frank.chang@sifive.com>
5
5
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
6
Signed-off-by: Jim Shu <cwshu@andestech.com>
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-Id: <165449614532.19704.7000832880482980398-11@git.sr.ht>
8
Message-id: 1613916082-19528-4-git-send-email-cwshu@andestech.com
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
9
---
11
target/riscv/pmp.c | 4 ++++
10
target/riscv/vector_helper.c | 220 ++++++++++++++++++-----------------
12
1 file changed, 4 insertions(+)
11
1 file changed, 114 insertions(+), 106 deletions(-)
13
12
14
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
13
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/target/riscv/pmp.c
15
--- a/target/riscv/vector_helper.c
17
+++ b/target/riscv/pmp.c
16
+++ b/target/riscv/vector_helper.c
18
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ static inline void
19
#include "qapi/error.h"
18
vext_vv_rm_2(void *vd, void *v0, void *vs1, void *vs2,
20
#include "cpu.h"
19
CPURISCVState *env,
21
#include "trace.h"
20
uint32_t desc,
22
+#include "exec/exec-all.h"
21
- opivv2_rm_fn *fn)
23
22
+ opivv2_rm_fn *fn, uint32_t esz)
24
static void pmp_write_cfg(CPURISCVState *env, uint32_t addr_index,
23
{
25
uint8_t val);
24
uint32_t vm = vext_vm(desc);
26
@@ -XXX,XX +XXX,XX @@ void pmpcfg_csr_write(CPURISCVState *env, uint32_t reg_index,
25
uint32_t vl = env->vl;
27
cfg_val = (val >> 8 * i) & 0xff;
26
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
28
pmp_write_cfg(env, (reg_index * 4) + i, cfg_val);
27
+ uint32_t vta = vext_vta(desc);
28
29
switch (env->vxrm) {
30
case 0: /* rnu */
31
@@ -XXX,XX +XXX,XX @@ vext_vv_rm_2(void *vd, void *v0, void *vs1, void *vs2,
32
env, vl, vm, 3, fn);
33
break;
29
}
34
}
30
+
35
+ /* set tail elements to 1s */
31
+ /* If PMP permission of any addr has been changed, flush TLB pages. */
36
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
32
+ tlb_flush(env_cpu(env));
33
}
37
}
34
38
35
39
/* generate helpers for fixed point instructions with OPIVV format */
40
-#define GEN_VEXT_VV_RM(NAME) \
41
+#define GEN_VEXT_VV_RM(NAME, ESZ) \
42
void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
43
CPURISCVState *env, uint32_t desc) \
44
{ \
45
vext_vv_rm_2(vd, v0, vs1, vs2, env, desc, \
46
- do_##NAME); \
47
+ do_##NAME, ESZ); \
48
}
49
50
static inline uint8_t saddu8(CPURISCVState *env, int vxrm, uint8_t a, uint8_t b)
51
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vsaddu_vv_b, OP_UUU_B, H1, H1, H1, saddu8)
52
RVVCALL(OPIVV2_RM, vsaddu_vv_h, OP_UUU_H, H2, H2, H2, saddu16)
53
RVVCALL(OPIVV2_RM, vsaddu_vv_w, OP_UUU_W, H4, H4, H4, saddu32)
54
RVVCALL(OPIVV2_RM, vsaddu_vv_d, OP_UUU_D, H8, H8, H8, saddu64)
55
-GEN_VEXT_VV_RM(vsaddu_vv_b)
56
-GEN_VEXT_VV_RM(vsaddu_vv_h)
57
-GEN_VEXT_VV_RM(vsaddu_vv_w)
58
-GEN_VEXT_VV_RM(vsaddu_vv_d)
59
+GEN_VEXT_VV_RM(vsaddu_vv_b, 1)
60
+GEN_VEXT_VV_RM(vsaddu_vv_h, 2)
61
+GEN_VEXT_VV_RM(vsaddu_vv_w, 4)
62
+GEN_VEXT_VV_RM(vsaddu_vv_d, 8)
63
64
typedef void opivx2_rm_fn(void *vd, target_long s1, void *vs2, int i,
65
CPURISCVState *env, int vxrm);
66
@@ -XXX,XX +XXX,XX @@ static inline void
67
vext_vx_rm_2(void *vd, void *v0, target_long s1, void *vs2,
68
CPURISCVState *env,
69
uint32_t desc,
70
- opivx2_rm_fn *fn)
71
+ opivx2_rm_fn *fn, uint32_t esz)
72
{
73
uint32_t vm = vext_vm(desc);
74
uint32_t vl = env->vl;
75
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz);
76
+ uint32_t vta = vext_vta(desc);
77
78
switch (env->vxrm) {
79
case 0: /* rnu */
80
@@ -XXX,XX +XXX,XX @@ vext_vx_rm_2(void *vd, void *v0, target_long s1, void *vs2,
81
env, vl, vm, 3, fn);
82
break;
83
}
84
+ /* set tail elements to 1s */
85
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
86
}
87
88
/* generate helpers for fixed point instructions with OPIVX format */
89
-#define GEN_VEXT_VX_RM(NAME) \
90
+#define GEN_VEXT_VX_RM(NAME, ESZ) \
91
void HELPER(NAME)(void *vd, void *v0, target_ulong s1, \
92
void *vs2, CPURISCVState *env, uint32_t desc) \
93
{ \
94
vext_vx_rm_2(vd, v0, s1, vs2, env, desc, \
95
- do_##NAME); \
96
+ do_##NAME, ESZ); \
97
}
98
99
RVVCALL(OPIVX2_RM, vsaddu_vx_b, OP_UUU_B, H1, H1, saddu8)
100
RVVCALL(OPIVX2_RM, vsaddu_vx_h, OP_UUU_H, H2, H2, saddu16)
101
RVVCALL(OPIVX2_RM, vsaddu_vx_w, OP_UUU_W, H4, H4, saddu32)
102
RVVCALL(OPIVX2_RM, vsaddu_vx_d, OP_UUU_D, H8, H8, saddu64)
103
-GEN_VEXT_VX_RM(vsaddu_vx_b)
104
-GEN_VEXT_VX_RM(vsaddu_vx_h)
105
-GEN_VEXT_VX_RM(vsaddu_vx_w)
106
-GEN_VEXT_VX_RM(vsaddu_vx_d)
107
+GEN_VEXT_VX_RM(vsaddu_vx_b, 1)
108
+GEN_VEXT_VX_RM(vsaddu_vx_h, 2)
109
+GEN_VEXT_VX_RM(vsaddu_vx_w, 4)
110
+GEN_VEXT_VX_RM(vsaddu_vx_d, 8)
111
112
static inline int8_t sadd8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
113
{
114
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vsadd_vv_b, OP_SSS_B, H1, H1, H1, sadd8)
115
RVVCALL(OPIVV2_RM, vsadd_vv_h, OP_SSS_H, H2, H2, H2, sadd16)
116
RVVCALL(OPIVV2_RM, vsadd_vv_w, OP_SSS_W, H4, H4, H4, sadd32)
117
RVVCALL(OPIVV2_RM, vsadd_vv_d, OP_SSS_D, H8, H8, H8, sadd64)
118
-GEN_VEXT_VV_RM(vsadd_vv_b)
119
-GEN_VEXT_VV_RM(vsadd_vv_h)
120
-GEN_VEXT_VV_RM(vsadd_vv_w)
121
-GEN_VEXT_VV_RM(vsadd_vv_d)
122
+GEN_VEXT_VV_RM(vsadd_vv_b, 1)
123
+GEN_VEXT_VV_RM(vsadd_vv_h, 2)
124
+GEN_VEXT_VV_RM(vsadd_vv_w, 4)
125
+GEN_VEXT_VV_RM(vsadd_vv_d, 8)
126
127
RVVCALL(OPIVX2_RM, vsadd_vx_b, OP_SSS_B, H1, H1, sadd8)
128
RVVCALL(OPIVX2_RM, vsadd_vx_h, OP_SSS_H, H2, H2, sadd16)
129
RVVCALL(OPIVX2_RM, vsadd_vx_w, OP_SSS_W, H4, H4, sadd32)
130
RVVCALL(OPIVX2_RM, vsadd_vx_d, OP_SSS_D, H8, H8, sadd64)
131
-GEN_VEXT_VX_RM(vsadd_vx_b)
132
-GEN_VEXT_VX_RM(vsadd_vx_h)
133
-GEN_VEXT_VX_RM(vsadd_vx_w)
134
-GEN_VEXT_VX_RM(vsadd_vx_d)
135
+GEN_VEXT_VX_RM(vsadd_vx_b, 1)
136
+GEN_VEXT_VX_RM(vsadd_vx_h, 2)
137
+GEN_VEXT_VX_RM(vsadd_vx_w, 4)
138
+GEN_VEXT_VX_RM(vsadd_vx_d, 8)
139
140
static inline uint8_t ssubu8(CPURISCVState *env, int vxrm, uint8_t a, uint8_t b)
141
{
142
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssubu_vv_b, OP_UUU_B, H1, H1, H1, ssubu8)
143
RVVCALL(OPIVV2_RM, vssubu_vv_h, OP_UUU_H, H2, H2, H2, ssubu16)
144
RVVCALL(OPIVV2_RM, vssubu_vv_w, OP_UUU_W, H4, H4, H4, ssubu32)
145
RVVCALL(OPIVV2_RM, vssubu_vv_d, OP_UUU_D, H8, H8, H8, ssubu64)
146
-GEN_VEXT_VV_RM(vssubu_vv_b)
147
-GEN_VEXT_VV_RM(vssubu_vv_h)
148
-GEN_VEXT_VV_RM(vssubu_vv_w)
149
-GEN_VEXT_VV_RM(vssubu_vv_d)
150
+GEN_VEXT_VV_RM(vssubu_vv_b, 1)
151
+GEN_VEXT_VV_RM(vssubu_vv_h, 2)
152
+GEN_VEXT_VV_RM(vssubu_vv_w, 4)
153
+GEN_VEXT_VV_RM(vssubu_vv_d, 8)
154
155
RVVCALL(OPIVX2_RM, vssubu_vx_b, OP_UUU_B, H1, H1, ssubu8)
156
RVVCALL(OPIVX2_RM, vssubu_vx_h, OP_UUU_H, H2, H2, ssubu16)
157
RVVCALL(OPIVX2_RM, vssubu_vx_w, OP_UUU_W, H4, H4, ssubu32)
158
RVVCALL(OPIVX2_RM, vssubu_vx_d, OP_UUU_D, H8, H8, ssubu64)
159
-GEN_VEXT_VX_RM(vssubu_vx_b)
160
-GEN_VEXT_VX_RM(vssubu_vx_h)
161
-GEN_VEXT_VX_RM(vssubu_vx_w)
162
-GEN_VEXT_VX_RM(vssubu_vx_d)
163
+GEN_VEXT_VX_RM(vssubu_vx_b, 1)
164
+GEN_VEXT_VX_RM(vssubu_vx_h, 2)
165
+GEN_VEXT_VX_RM(vssubu_vx_w, 4)
166
+GEN_VEXT_VX_RM(vssubu_vx_d, 8)
167
168
static inline int8_t ssub8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
169
{
170
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssub_vv_b, OP_SSS_B, H1, H1, H1, ssub8)
171
RVVCALL(OPIVV2_RM, vssub_vv_h, OP_SSS_H, H2, H2, H2, ssub16)
172
RVVCALL(OPIVV2_RM, vssub_vv_w, OP_SSS_W, H4, H4, H4, ssub32)
173
RVVCALL(OPIVV2_RM, vssub_vv_d, OP_SSS_D, H8, H8, H8, ssub64)
174
-GEN_VEXT_VV_RM(vssub_vv_b)
175
-GEN_VEXT_VV_RM(vssub_vv_h)
176
-GEN_VEXT_VV_RM(vssub_vv_w)
177
-GEN_VEXT_VV_RM(vssub_vv_d)
178
+GEN_VEXT_VV_RM(vssub_vv_b, 1)
179
+GEN_VEXT_VV_RM(vssub_vv_h, 2)
180
+GEN_VEXT_VV_RM(vssub_vv_w, 4)
181
+GEN_VEXT_VV_RM(vssub_vv_d, 8)
182
183
RVVCALL(OPIVX2_RM, vssub_vx_b, OP_SSS_B, H1, H1, ssub8)
184
RVVCALL(OPIVX2_RM, vssub_vx_h, OP_SSS_H, H2, H2, ssub16)
185
RVVCALL(OPIVX2_RM, vssub_vx_w, OP_SSS_W, H4, H4, ssub32)
186
RVVCALL(OPIVX2_RM, vssub_vx_d, OP_SSS_D, H8, H8, ssub64)
187
-GEN_VEXT_VX_RM(vssub_vx_b)
188
-GEN_VEXT_VX_RM(vssub_vx_h)
189
-GEN_VEXT_VX_RM(vssub_vx_w)
190
-GEN_VEXT_VX_RM(vssub_vx_d)
191
+GEN_VEXT_VX_RM(vssub_vx_b, 1)
192
+GEN_VEXT_VX_RM(vssub_vx_h, 2)
193
+GEN_VEXT_VX_RM(vssub_vx_w, 4)
194
+GEN_VEXT_VX_RM(vssub_vx_d, 8)
195
196
/* Vector Single-Width Averaging Add and Subtract */
197
static inline uint8_t get_round(int vxrm, uint64_t v, uint8_t shift)
198
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vaadd_vv_b, OP_SSS_B, H1, H1, H1, aadd32)
199
RVVCALL(OPIVV2_RM, vaadd_vv_h, OP_SSS_H, H2, H2, H2, aadd32)
200
RVVCALL(OPIVV2_RM, vaadd_vv_w, OP_SSS_W, H4, H4, H4, aadd32)
201
RVVCALL(OPIVV2_RM, vaadd_vv_d, OP_SSS_D, H8, H8, H8, aadd64)
202
-GEN_VEXT_VV_RM(vaadd_vv_b)
203
-GEN_VEXT_VV_RM(vaadd_vv_h)
204
-GEN_VEXT_VV_RM(vaadd_vv_w)
205
-GEN_VEXT_VV_RM(vaadd_vv_d)
206
+GEN_VEXT_VV_RM(vaadd_vv_b, 1)
207
+GEN_VEXT_VV_RM(vaadd_vv_h, 2)
208
+GEN_VEXT_VV_RM(vaadd_vv_w, 4)
209
+GEN_VEXT_VV_RM(vaadd_vv_d, 8)
210
211
RVVCALL(OPIVX2_RM, vaadd_vx_b, OP_SSS_B, H1, H1, aadd32)
212
RVVCALL(OPIVX2_RM, vaadd_vx_h, OP_SSS_H, H2, H2, aadd32)
213
RVVCALL(OPIVX2_RM, vaadd_vx_w, OP_SSS_W, H4, H4, aadd32)
214
RVVCALL(OPIVX2_RM, vaadd_vx_d, OP_SSS_D, H8, H8, aadd64)
215
-GEN_VEXT_VX_RM(vaadd_vx_b)
216
-GEN_VEXT_VX_RM(vaadd_vx_h)
217
-GEN_VEXT_VX_RM(vaadd_vx_w)
218
-GEN_VEXT_VX_RM(vaadd_vx_d)
219
+GEN_VEXT_VX_RM(vaadd_vx_b, 1)
220
+GEN_VEXT_VX_RM(vaadd_vx_h, 2)
221
+GEN_VEXT_VX_RM(vaadd_vx_w, 4)
222
+GEN_VEXT_VX_RM(vaadd_vx_d, 8)
223
224
static inline uint32_t aaddu32(CPURISCVState *env, int vxrm,
225
uint32_t a, uint32_t b)
226
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vaaddu_vv_b, OP_UUU_B, H1, H1, H1, aaddu32)
227
RVVCALL(OPIVV2_RM, vaaddu_vv_h, OP_UUU_H, H2, H2, H2, aaddu32)
228
RVVCALL(OPIVV2_RM, vaaddu_vv_w, OP_UUU_W, H4, H4, H4, aaddu32)
229
RVVCALL(OPIVV2_RM, vaaddu_vv_d, OP_UUU_D, H8, H8, H8, aaddu64)
230
-GEN_VEXT_VV_RM(vaaddu_vv_b)
231
-GEN_VEXT_VV_RM(vaaddu_vv_h)
232
-GEN_VEXT_VV_RM(vaaddu_vv_w)
233
-GEN_VEXT_VV_RM(vaaddu_vv_d)
234
+GEN_VEXT_VV_RM(vaaddu_vv_b, 1)
235
+GEN_VEXT_VV_RM(vaaddu_vv_h, 2)
236
+GEN_VEXT_VV_RM(vaaddu_vv_w, 4)
237
+GEN_VEXT_VV_RM(vaaddu_vv_d, 8)
238
239
RVVCALL(OPIVX2_RM, vaaddu_vx_b, OP_UUU_B, H1, H1, aaddu32)
240
RVVCALL(OPIVX2_RM, vaaddu_vx_h, OP_UUU_H, H2, H2, aaddu32)
241
RVVCALL(OPIVX2_RM, vaaddu_vx_w, OP_UUU_W, H4, H4, aaddu32)
242
RVVCALL(OPIVX2_RM, vaaddu_vx_d, OP_UUU_D, H8, H8, aaddu64)
243
-GEN_VEXT_VX_RM(vaaddu_vx_b)
244
-GEN_VEXT_VX_RM(vaaddu_vx_h)
245
-GEN_VEXT_VX_RM(vaaddu_vx_w)
246
-GEN_VEXT_VX_RM(vaaddu_vx_d)
247
+GEN_VEXT_VX_RM(vaaddu_vx_b, 1)
248
+GEN_VEXT_VX_RM(vaaddu_vx_h, 2)
249
+GEN_VEXT_VX_RM(vaaddu_vx_w, 4)
250
+GEN_VEXT_VX_RM(vaaddu_vx_d, 8)
251
252
static inline int32_t asub32(CPURISCVState *env, int vxrm, int32_t a, int32_t b)
253
{
254
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vasub_vv_b, OP_SSS_B, H1, H1, H1, asub32)
255
RVVCALL(OPIVV2_RM, vasub_vv_h, OP_SSS_H, H2, H2, H2, asub32)
256
RVVCALL(OPIVV2_RM, vasub_vv_w, OP_SSS_W, H4, H4, H4, asub32)
257
RVVCALL(OPIVV2_RM, vasub_vv_d, OP_SSS_D, H8, H8, H8, asub64)
258
-GEN_VEXT_VV_RM(vasub_vv_b)
259
-GEN_VEXT_VV_RM(vasub_vv_h)
260
-GEN_VEXT_VV_RM(vasub_vv_w)
261
-GEN_VEXT_VV_RM(vasub_vv_d)
262
+GEN_VEXT_VV_RM(vasub_vv_b, 1)
263
+GEN_VEXT_VV_RM(vasub_vv_h, 2)
264
+GEN_VEXT_VV_RM(vasub_vv_w, 4)
265
+GEN_VEXT_VV_RM(vasub_vv_d, 8)
266
267
RVVCALL(OPIVX2_RM, vasub_vx_b, OP_SSS_B, H1, H1, asub32)
268
RVVCALL(OPIVX2_RM, vasub_vx_h, OP_SSS_H, H2, H2, asub32)
269
RVVCALL(OPIVX2_RM, vasub_vx_w, OP_SSS_W, H4, H4, asub32)
270
RVVCALL(OPIVX2_RM, vasub_vx_d, OP_SSS_D, H8, H8, asub64)
271
-GEN_VEXT_VX_RM(vasub_vx_b)
272
-GEN_VEXT_VX_RM(vasub_vx_h)
273
-GEN_VEXT_VX_RM(vasub_vx_w)
274
-GEN_VEXT_VX_RM(vasub_vx_d)
275
+GEN_VEXT_VX_RM(vasub_vx_b, 1)
276
+GEN_VEXT_VX_RM(vasub_vx_h, 2)
277
+GEN_VEXT_VX_RM(vasub_vx_w, 4)
278
+GEN_VEXT_VX_RM(vasub_vx_d, 8)
279
280
static inline uint32_t asubu32(CPURISCVState *env, int vxrm,
281
uint32_t a, uint32_t b)
282
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vasubu_vv_b, OP_UUU_B, H1, H1, H1, asubu32)
283
RVVCALL(OPIVV2_RM, vasubu_vv_h, OP_UUU_H, H2, H2, H2, asubu32)
284
RVVCALL(OPIVV2_RM, vasubu_vv_w, OP_UUU_W, H4, H4, H4, asubu32)
285
RVVCALL(OPIVV2_RM, vasubu_vv_d, OP_UUU_D, H8, H8, H8, asubu64)
286
-GEN_VEXT_VV_RM(vasubu_vv_b)
287
-GEN_VEXT_VV_RM(vasubu_vv_h)
288
-GEN_VEXT_VV_RM(vasubu_vv_w)
289
-GEN_VEXT_VV_RM(vasubu_vv_d)
290
+GEN_VEXT_VV_RM(vasubu_vv_b, 1)
291
+GEN_VEXT_VV_RM(vasubu_vv_h, 2)
292
+GEN_VEXT_VV_RM(vasubu_vv_w, 4)
293
+GEN_VEXT_VV_RM(vasubu_vv_d, 8)
294
295
RVVCALL(OPIVX2_RM, vasubu_vx_b, OP_UUU_B, H1, H1, asubu32)
296
RVVCALL(OPIVX2_RM, vasubu_vx_h, OP_UUU_H, H2, H2, asubu32)
297
RVVCALL(OPIVX2_RM, vasubu_vx_w, OP_UUU_W, H4, H4, asubu32)
298
RVVCALL(OPIVX2_RM, vasubu_vx_d, OP_UUU_D, H8, H8, asubu64)
299
-GEN_VEXT_VX_RM(vasubu_vx_b)
300
-GEN_VEXT_VX_RM(vasubu_vx_h)
301
-GEN_VEXT_VX_RM(vasubu_vx_w)
302
-GEN_VEXT_VX_RM(vasubu_vx_d)
303
+GEN_VEXT_VX_RM(vasubu_vx_b, 1)
304
+GEN_VEXT_VX_RM(vasubu_vx_h, 2)
305
+GEN_VEXT_VX_RM(vasubu_vx_w, 4)
306
+GEN_VEXT_VX_RM(vasubu_vx_d, 8)
307
308
/* Vector Single-Width Fractional Multiply with Rounding and Saturation */
309
static inline int8_t vsmul8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
310
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vsmul_vv_b, OP_SSS_B, H1, H1, H1, vsmul8)
311
RVVCALL(OPIVV2_RM, vsmul_vv_h, OP_SSS_H, H2, H2, H2, vsmul16)
312
RVVCALL(OPIVV2_RM, vsmul_vv_w, OP_SSS_W, H4, H4, H4, vsmul32)
313
RVVCALL(OPIVV2_RM, vsmul_vv_d, OP_SSS_D, H8, H8, H8, vsmul64)
314
-GEN_VEXT_VV_RM(vsmul_vv_b)
315
-GEN_VEXT_VV_RM(vsmul_vv_h)
316
-GEN_VEXT_VV_RM(vsmul_vv_w)
317
-GEN_VEXT_VV_RM(vsmul_vv_d)
318
+GEN_VEXT_VV_RM(vsmul_vv_b, 1)
319
+GEN_VEXT_VV_RM(vsmul_vv_h, 2)
320
+GEN_VEXT_VV_RM(vsmul_vv_w, 4)
321
+GEN_VEXT_VV_RM(vsmul_vv_d, 8)
322
323
RVVCALL(OPIVX2_RM, vsmul_vx_b, OP_SSS_B, H1, H1, vsmul8)
324
RVVCALL(OPIVX2_RM, vsmul_vx_h, OP_SSS_H, H2, H2, vsmul16)
325
RVVCALL(OPIVX2_RM, vsmul_vx_w, OP_SSS_W, H4, H4, vsmul32)
326
RVVCALL(OPIVX2_RM, vsmul_vx_d, OP_SSS_D, H8, H8, vsmul64)
327
-GEN_VEXT_VX_RM(vsmul_vx_b)
328
-GEN_VEXT_VX_RM(vsmul_vx_h)
329
-GEN_VEXT_VX_RM(vsmul_vx_w)
330
-GEN_VEXT_VX_RM(vsmul_vx_d)
331
+GEN_VEXT_VX_RM(vsmul_vx_b, 1)
332
+GEN_VEXT_VX_RM(vsmul_vx_h, 2)
333
+GEN_VEXT_VX_RM(vsmul_vx_w, 4)
334
+GEN_VEXT_VX_RM(vsmul_vx_d, 8)
335
336
/* Vector Single-Width Scaling Shift Instructions */
337
static inline uint8_t
338
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssrl_vv_b, OP_UUU_B, H1, H1, H1, vssrl8)
339
RVVCALL(OPIVV2_RM, vssrl_vv_h, OP_UUU_H, H2, H2, H2, vssrl16)
340
RVVCALL(OPIVV2_RM, vssrl_vv_w, OP_UUU_W, H4, H4, H4, vssrl32)
341
RVVCALL(OPIVV2_RM, vssrl_vv_d, OP_UUU_D, H8, H8, H8, vssrl64)
342
-GEN_VEXT_VV_RM(vssrl_vv_b)
343
-GEN_VEXT_VV_RM(vssrl_vv_h)
344
-GEN_VEXT_VV_RM(vssrl_vv_w)
345
-GEN_VEXT_VV_RM(vssrl_vv_d)
346
+GEN_VEXT_VV_RM(vssrl_vv_b, 1)
347
+GEN_VEXT_VV_RM(vssrl_vv_h, 2)
348
+GEN_VEXT_VV_RM(vssrl_vv_w, 4)
349
+GEN_VEXT_VV_RM(vssrl_vv_d, 8)
350
351
RVVCALL(OPIVX2_RM, vssrl_vx_b, OP_UUU_B, H1, H1, vssrl8)
352
RVVCALL(OPIVX2_RM, vssrl_vx_h, OP_UUU_H, H2, H2, vssrl16)
353
RVVCALL(OPIVX2_RM, vssrl_vx_w, OP_UUU_W, H4, H4, vssrl32)
354
RVVCALL(OPIVX2_RM, vssrl_vx_d, OP_UUU_D, H8, H8, vssrl64)
355
-GEN_VEXT_VX_RM(vssrl_vx_b)
356
-GEN_VEXT_VX_RM(vssrl_vx_h)
357
-GEN_VEXT_VX_RM(vssrl_vx_w)
358
-GEN_VEXT_VX_RM(vssrl_vx_d)
359
+GEN_VEXT_VX_RM(vssrl_vx_b, 1)
360
+GEN_VEXT_VX_RM(vssrl_vx_h, 2)
361
+GEN_VEXT_VX_RM(vssrl_vx_w, 4)
362
+GEN_VEXT_VX_RM(vssrl_vx_d, 8)
363
364
static inline int8_t
365
vssra8(CPURISCVState *env, int vxrm, int8_t a, int8_t b)
366
@@ -XXX,XX +XXX,XX @@ RVVCALL(OPIVV2_RM, vssra_vv_b, OP_SSS_B, H1, H1, H1, vssra8)
367
RVVCALL(OPIVV2_RM, vssra_vv_h, OP_SSS_H, H2, H2, H2, vssra16)
368
RVVCALL(OPIVV2_RM, vssra_vv_w, OP_SSS_W, H4, H4, H4, vssra32)
369
RVVCALL(OPIVV2_RM, vssra_vv_d, OP_SSS_D, H8, H8, H8, vssra64)
370
-GEN_VEXT_VV_RM(vssra_vv_b)
371
-GEN_VEXT_VV_RM(vssra_vv_h)
372
-GEN_VEXT_VV_RM(vssra_vv_w)
373
-GEN_VEXT_VV_RM(vssra_vv_d)
374
+GEN_VEXT_VV_RM(vssra_vv_b, 1)
375
+GEN_VEXT_VV_RM(vssra_vv_h, 2)
376
+GEN_VEXT_VV_RM(vssra_vv_w, 4)
377
+GEN_VEXT_VV_RM(vssra_vv_d, 8)
378
379
RVVCALL(OPIVX2_RM, vssra_vx_b, OP_SSS_B, H1, H1, vssra8)
380
RVVCALL(OPIVX2_RM, vssra_vx_h, OP_SSS_H, H2, H2, vssra16)
381
RVVCALL(OPIVX2_RM, vssra_vx_w, OP_SSS_W, H4, H4, vssra32)
382
RVVCALL(OPIVX2_RM, vssra_vx_d, OP_SSS_D, H8, H8, vssra64)
383
-GEN_VEXT_VX_RM(vssra_vx_b)
384
-GEN_VEXT_VX_RM(vssra_vx_h)
385
-GEN_VEXT_VX_RM(vssra_vx_w)
386
-GEN_VEXT_VX_RM(vssra_vx_d)
387
+GEN_VEXT_VX_RM(vssra_vx_b, 1)
388
+GEN_VEXT_VX_RM(vssra_vx_h, 2)
389
+GEN_VEXT_VX_RM(vssra_vx_w, 4)
390
+GEN_VEXT_VX_RM(vssra_vx_d, 8)
391
392
/* Vector Narrowing Fixed-Point Clip Instructions */
393
static inline int8_t
394
@@ -XXX,XX +XXX,XX @@ vnclip32(CPURISCVState *env, int vxrm, int64_t a, int32_t b)
395
RVVCALL(OPIVV2_RM, vnclip_wv_b, NOP_SSS_B, H1, H2, H1, vnclip8)
396
RVVCALL(OPIVV2_RM, vnclip_wv_h, NOP_SSS_H, H2, H4, H2, vnclip16)
397
RVVCALL(OPIVV2_RM, vnclip_wv_w, NOP_SSS_W, H4, H8, H4, vnclip32)
398
-GEN_VEXT_VV_RM(vnclip_wv_b)
399
-GEN_VEXT_VV_RM(vnclip_wv_h)
400
-GEN_VEXT_VV_RM(vnclip_wv_w)
401
+GEN_VEXT_VV_RM(vnclip_wv_b, 1)
402
+GEN_VEXT_VV_RM(vnclip_wv_h, 2)
403
+GEN_VEXT_VV_RM(vnclip_wv_w, 4)
404
405
RVVCALL(OPIVX2_RM, vnclip_wx_b, NOP_SSS_B, H1, H2, vnclip8)
406
RVVCALL(OPIVX2_RM, vnclip_wx_h, NOP_SSS_H, H2, H4, vnclip16)
407
RVVCALL(OPIVX2_RM, vnclip_wx_w, NOP_SSS_W, H4, H8, vnclip32)
408
-GEN_VEXT_VX_RM(vnclip_wx_b)
409
-GEN_VEXT_VX_RM(vnclip_wx_h)
410
-GEN_VEXT_VX_RM(vnclip_wx_w)
411
+GEN_VEXT_VX_RM(vnclip_wx_b, 1)
412
+GEN_VEXT_VX_RM(vnclip_wx_h, 2)
413
+GEN_VEXT_VX_RM(vnclip_wx_w, 4)
414
415
static inline uint8_t
416
vnclipu8(CPURISCVState *env, int vxrm, uint16_t a, uint8_t b)
417
@@ -XXX,XX +XXX,XX @@ vnclipu32(CPURISCVState *env, int vxrm, uint64_t a, uint32_t b)
418
RVVCALL(OPIVV2_RM, vnclipu_wv_b, NOP_UUU_B, H1, H2, H1, vnclipu8)
419
RVVCALL(OPIVV2_RM, vnclipu_wv_h, NOP_UUU_H, H2, H4, H2, vnclipu16)
420
RVVCALL(OPIVV2_RM, vnclipu_wv_w, NOP_UUU_W, H4, H8, H4, vnclipu32)
421
-GEN_VEXT_VV_RM(vnclipu_wv_b)
422
-GEN_VEXT_VV_RM(vnclipu_wv_h)
423
-GEN_VEXT_VV_RM(vnclipu_wv_w)
424
+GEN_VEXT_VV_RM(vnclipu_wv_b, 1)
425
+GEN_VEXT_VV_RM(vnclipu_wv_h, 2)
426
+GEN_VEXT_VV_RM(vnclipu_wv_w, 4)
427
428
RVVCALL(OPIVX2_RM, vnclipu_wx_b, NOP_UUU_B, H1, H2, vnclipu8)
429
RVVCALL(OPIVX2_RM, vnclipu_wx_h, NOP_UUU_H, H2, H4, vnclipu16)
430
RVVCALL(OPIVX2_RM, vnclipu_wx_w, NOP_UUU_W, H4, H8, vnclipu32)
431
-GEN_VEXT_VX_RM(vnclipu_wx_b)
432
-GEN_VEXT_VX_RM(vnclipu_wx_h)
433
-GEN_VEXT_VX_RM(vnclipu_wx_w)
434
+GEN_VEXT_VX_RM(vnclipu_wx_b, 1)
435
+GEN_VEXT_VX_RM(vnclipu_wx_h, 2)
436
+GEN_VEXT_VX_RM(vnclipu_wx_w, 4)
437
438
/*
439
*** Vector Float Point Arithmetic Instructions
36
--
440
--
37
2.30.1
441
2.36.1
38
39
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
Since HSS commit c20a89f8dcac, the Icicle Kit reference design has
3
Compares write mask registers, and so always operate under a tail-
4
been updated to use a register mapped at 0x4f000000 instead of a
4
agnostic policy.
5
GPIO to control whether eMMC or SD card is to be used. With this
6
support the same HSS image can be used for both eMMC and SD card
7
boot flow, while previously two different board configurations were
8
used. This is undocumented but one can take a look at the HSS code
9
HSS_MMCInit() in services/mmc/mmc_api.c.
10
5
11
With this commit, HSS image built from 2020.12 release boots again.
6
Signed-off-by: eop Chen <eop.chen@sifive.com>
12
7
Reviewed-by: Frank Chang <frank.chang@sifive.com>
13
Signed-off-by: Bin Meng <bin.meng@windriver.com>
8
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
15
Message-id: 20210322075248.136255-1-bmeng.cn@gmail.com
10
Message-Id: <165449614532.19704.7000832880482980398-12@git.sr.ht>
16
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
---
12
---
18
include/hw/riscv/microchip_pfsoc.h | 1 +
13
target/riscv/vector_helper.c | 440 +++++++++++++-----------
19
hw/riscv/microchip_pfsoc.c | 6 ++++++
14
target/riscv/insn_trans/trans_rvv.c.inc | 17 +
20
2 files changed, 7 insertions(+)
15
2 files changed, 261 insertions(+), 196 deletions(-)
21
16
22
diff --git a/include/hw/riscv/microchip_pfsoc.h b/include/hw/riscv/microchip_pfsoc.h
17
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
23
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
24
--- a/include/hw/riscv/microchip_pfsoc.h
19
--- a/target/riscv/vector_helper.c
25
+++ b/include/hw/riscv/microchip_pfsoc.h
20
+++ b/target/riscv/vector_helper.c
26
@@ -XXX,XX +XXX,XX @@ enum {
21
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, void *vs1, void *vs2, int i, \
27
MICROCHIP_PFSOC_ENVM_DATA,
22
*((TD *)vd + HD(i)) = OP(s2, s1, &env->fp_status); \
28
MICROCHIP_PFSOC_QSPI_XIP,
23
}
29
MICROCHIP_PFSOC_IOSCB,
24
30
+ MICROCHIP_PFSOC_EMMC_SD_MUX,
25
-#define GEN_VEXT_VV_ENV(NAME) \
31
MICROCHIP_PFSOC_DRAM_LO,
26
+#define GEN_VEXT_VV_ENV(NAME, ESZ) \
32
MICROCHIP_PFSOC_DRAM_LO_ALIAS,
27
void HELPER(NAME)(void *vd, void *v0, void *vs1, \
33
MICROCHIP_PFSOC_DRAM_HI,
28
void *vs2, CPURISCVState *env, \
34
diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c
29
uint32_t desc) \
30
{ \
31
uint32_t vm = vext_vm(desc); \
32
uint32_t vl = env->vl; \
33
+ uint32_t total_elems = \
34
+ vext_get_total_elems(env, desc, ESZ); \
35
+ uint32_t vta = vext_vta(desc); \
36
uint32_t i; \
37
\
38
for (i = env->vstart; i < vl; i++) { \
39
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
40
do_##NAME(vd, vs1, vs2, i, env); \
41
} \
42
env->vstart = 0; \
43
+ /* set tail elements to 1s */ \
44
+ vext_set_elems_1s(vd, vta, vl * ESZ, \
45
+ total_elems * ESZ); \
46
}
47
48
RVVCALL(OPFVV2, vfadd_vv_h, OP_UUU_H, H2, H2, H2, float16_add)
49
RVVCALL(OPFVV2, vfadd_vv_w, OP_UUU_W, H4, H4, H4, float32_add)
50
RVVCALL(OPFVV2, vfadd_vv_d, OP_UUU_D, H8, H8, H8, float64_add)
51
-GEN_VEXT_VV_ENV(vfadd_vv_h)
52
-GEN_VEXT_VV_ENV(vfadd_vv_w)
53
-GEN_VEXT_VV_ENV(vfadd_vv_d)
54
+GEN_VEXT_VV_ENV(vfadd_vv_h, 2)
55
+GEN_VEXT_VV_ENV(vfadd_vv_w, 4)
56
+GEN_VEXT_VV_ENV(vfadd_vv_d, 8)
57
58
#define OPFVF2(NAME, TD, T1, T2, TX1, TX2, HD, HS2, OP) \
59
static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
60
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
61
*((TD *)vd + HD(i)) = OP(s2, (TX1)(T1)s1, &env->fp_status);\
62
}
63
64
-#define GEN_VEXT_VF(NAME) \
65
+#define GEN_VEXT_VF(NAME, ESZ) \
66
void HELPER(NAME)(void *vd, void *v0, uint64_t s1, \
67
void *vs2, CPURISCVState *env, \
68
uint32_t desc) \
69
{ \
70
uint32_t vm = vext_vm(desc); \
71
uint32_t vl = env->vl; \
72
+ uint32_t total_elems = \
73
+ vext_get_total_elems(env, desc, ESZ); \
74
+ uint32_t vta = vext_vta(desc); \
75
uint32_t i; \
76
\
77
for (i = env->vstart; i < vl; i++) { \
78
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, uint64_t s1, \
79
do_##NAME(vd, s1, vs2, i, env); \
80
} \
81
env->vstart = 0; \
82
+ /* set tail elements to 1s */ \
83
+ vext_set_elems_1s(vd, vta, vl * ESZ, \
84
+ total_elems * ESZ); \
85
}
86
87
RVVCALL(OPFVF2, vfadd_vf_h, OP_UUU_H, H2, H2, float16_add)
88
RVVCALL(OPFVF2, vfadd_vf_w, OP_UUU_W, H4, H4, float32_add)
89
RVVCALL(OPFVF2, vfadd_vf_d, OP_UUU_D, H8, H8, float64_add)
90
-GEN_VEXT_VF(vfadd_vf_h)
91
-GEN_VEXT_VF(vfadd_vf_w)
92
-GEN_VEXT_VF(vfadd_vf_d)
93
+GEN_VEXT_VF(vfadd_vf_h, 2)
94
+GEN_VEXT_VF(vfadd_vf_w, 4)
95
+GEN_VEXT_VF(vfadd_vf_d, 8)
96
97
RVVCALL(OPFVV2, vfsub_vv_h, OP_UUU_H, H2, H2, H2, float16_sub)
98
RVVCALL(OPFVV2, vfsub_vv_w, OP_UUU_W, H4, H4, H4, float32_sub)
99
RVVCALL(OPFVV2, vfsub_vv_d, OP_UUU_D, H8, H8, H8, float64_sub)
100
-GEN_VEXT_VV_ENV(vfsub_vv_h)
101
-GEN_VEXT_VV_ENV(vfsub_vv_w)
102
-GEN_VEXT_VV_ENV(vfsub_vv_d)
103
+GEN_VEXT_VV_ENV(vfsub_vv_h, 2)
104
+GEN_VEXT_VV_ENV(vfsub_vv_w, 4)
105
+GEN_VEXT_VV_ENV(vfsub_vv_d, 8)
106
RVVCALL(OPFVF2, vfsub_vf_h, OP_UUU_H, H2, H2, float16_sub)
107
RVVCALL(OPFVF2, vfsub_vf_w, OP_UUU_W, H4, H4, float32_sub)
108
RVVCALL(OPFVF2, vfsub_vf_d, OP_UUU_D, H8, H8, float64_sub)
109
-GEN_VEXT_VF(vfsub_vf_h)
110
-GEN_VEXT_VF(vfsub_vf_w)
111
-GEN_VEXT_VF(vfsub_vf_d)
112
+GEN_VEXT_VF(vfsub_vf_h, 2)
113
+GEN_VEXT_VF(vfsub_vf_w, 4)
114
+GEN_VEXT_VF(vfsub_vf_d, 8)
115
116
static uint16_t float16_rsub(uint16_t a, uint16_t b, float_status *s)
117
{
118
@@ -XXX,XX +XXX,XX @@ static uint64_t float64_rsub(uint64_t a, uint64_t b, float_status *s)
119
RVVCALL(OPFVF2, vfrsub_vf_h, OP_UUU_H, H2, H2, float16_rsub)
120
RVVCALL(OPFVF2, vfrsub_vf_w, OP_UUU_W, H4, H4, float32_rsub)
121
RVVCALL(OPFVF2, vfrsub_vf_d, OP_UUU_D, H8, H8, float64_rsub)
122
-GEN_VEXT_VF(vfrsub_vf_h)
123
-GEN_VEXT_VF(vfrsub_vf_w)
124
-GEN_VEXT_VF(vfrsub_vf_d)
125
+GEN_VEXT_VF(vfrsub_vf_h, 2)
126
+GEN_VEXT_VF(vfrsub_vf_w, 4)
127
+GEN_VEXT_VF(vfrsub_vf_d, 8)
128
129
/* Vector Widening Floating-Point Add/Subtract Instructions */
130
static uint32_t vfwadd16(uint16_t a, uint16_t b, float_status *s)
131
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwadd32(uint32_t a, uint32_t b, float_status *s)
132
133
RVVCALL(OPFVV2, vfwadd_vv_h, WOP_UUU_H, H4, H2, H2, vfwadd16)
134
RVVCALL(OPFVV2, vfwadd_vv_w, WOP_UUU_W, H8, H4, H4, vfwadd32)
135
-GEN_VEXT_VV_ENV(vfwadd_vv_h)
136
-GEN_VEXT_VV_ENV(vfwadd_vv_w)
137
+GEN_VEXT_VV_ENV(vfwadd_vv_h, 4)
138
+GEN_VEXT_VV_ENV(vfwadd_vv_w, 8)
139
RVVCALL(OPFVF2, vfwadd_vf_h, WOP_UUU_H, H4, H2, vfwadd16)
140
RVVCALL(OPFVF2, vfwadd_vf_w, WOP_UUU_W, H8, H4, vfwadd32)
141
-GEN_VEXT_VF(vfwadd_vf_h)
142
-GEN_VEXT_VF(vfwadd_vf_w)
143
+GEN_VEXT_VF(vfwadd_vf_h, 4)
144
+GEN_VEXT_VF(vfwadd_vf_w, 8)
145
146
static uint32_t vfwsub16(uint16_t a, uint16_t b, float_status *s)
147
{
148
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwsub32(uint32_t a, uint32_t b, float_status *s)
149
150
RVVCALL(OPFVV2, vfwsub_vv_h, WOP_UUU_H, H4, H2, H2, vfwsub16)
151
RVVCALL(OPFVV2, vfwsub_vv_w, WOP_UUU_W, H8, H4, H4, vfwsub32)
152
-GEN_VEXT_VV_ENV(vfwsub_vv_h)
153
-GEN_VEXT_VV_ENV(vfwsub_vv_w)
154
+GEN_VEXT_VV_ENV(vfwsub_vv_h, 4)
155
+GEN_VEXT_VV_ENV(vfwsub_vv_w, 8)
156
RVVCALL(OPFVF2, vfwsub_vf_h, WOP_UUU_H, H4, H2, vfwsub16)
157
RVVCALL(OPFVF2, vfwsub_vf_w, WOP_UUU_W, H8, H4, vfwsub32)
158
-GEN_VEXT_VF(vfwsub_vf_h)
159
-GEN_VEXT_VF(vfwsub_vf_w)
160
+GEN_VEXT_VF(vfwsub_vf_h, 4)
161
+GEN_VEXT_VF(vfwsub_vf_w, 8)
162
163
static uint32_t vfwaddw16(uint32_t a, uint16_t b, float_status *s)
164
{
165
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwaddw32(uint64_t a, uint32_t b, float_status *s)
166
167
RVVCALL(OPFVV2, vfwadd_wv_h, WOP_WUUU_H, H4, H2, H2, vfwaddw16)
168
RVVCALL(OPFVV2, vfwadd_wv_w, WOP_WUUU_W, H8, H4, H4, vfwaddw32)
169
-GEN_VEXT_VV_ENV(vfwadd_wv_h)
170
-GEN_VEXT_VV_ENV(vfwadd_wv_w)
171
+GEN_VEXT_VV_ENV(vfwadd_wv_h, 4)
172
+GEN_VEXT_VV_ENV(vfwadd_wv_w, 8)
173
RVVCALL(OPFVF2, vfwadd_wf_h, WOP_WUUU_H, H4, H2, vfwaddw16)
174
RVVCALL(OPFVF2, vfwadd_wf_w, WOP_WUUU_W, H8, H4, vfwaddw32)
175
-GEN_VEXT_VF(vfwadd_wf_h)
176
-GEN_VEXT_VF(vfwadd_wf_w)
177
+GEN_VEXT_VF(vfwadd_wf_h, 4)
178
+GEN_VEXT_VF(vfwadd_wf_w, 8)
179
180
static uint32_t vfwsubw16(uint32_t a, uint16_t b, float_status *s)
181
{
182
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwsubw32(uint64_t a, uint32_t b, float_status *s)
183
184
RVVCALL(OPFVV2, vfwsub_wv_h, WOP_WUUU_H, H4, H2, H2, vfwsubw16)
185
RVVCALL(OPFVV2, vfwsub_wv_w, WOP_WUUU_W, H8, H4, H4, vfwsubw32)
186
-GEN_VEXT_VV_ENV(vfwsub_wv_h)
187
-GEN_VEXT_VV_ENV(vfwsub_wv_w)
188
+GEN_VEXT_VV_ENV(vfwsub_wv_h, 4)
189
+GEN_VEXT_VV_ENV(vfwsub_wv_w, 8)
190
RVVCALL(OPFVF2, vfwsub_wf_h, WOP_WUUU_H, H4, H2, vfwsubw16)
191
RVVCALL(OPFVF2, vfwsub_wf_w, WOP_WUUU_W, H8, H4, vfwsubw32)
192
-GEN_VEXT_VF(vfwsub_wf_h)
193
-GEN_VEXT_VF(vfwsub_wf_w)
194
+GEN_VEXT_VF(vfwsub_wf_h, 4)
195
+GEN_VEXT_VF(vfwsub_wf_w, 8)
196
197
/* Vector Single-Width Floating-Point Multiply/Divide Instructions */
198
RVVCALL(OPFVV2, vfmul_vv_h, OP_UUU_H, H2, H2, H2, float16_mul)
199
RVVCALL(OPFVV2, vfmul_vv_w, OP_UUU_W, H4, H4, H4, float32_mul)
200
RVVCALL(OPFVV2, vfmul_vv_d, OP_UUU_D, H8, H8, H8, float64_mul)
201
-GEN_VEXT_VV_ENV(vfmul_vv_h)
202
-GEN_VEXT_VV_ENV(vfmul_vv_w)
203
-GEN_VEXT_VV_ENV(vfmul_vv_d)
204
+GEN_VEXT_VV_ENV(vfmul_vv_h, 2)
205
+GEN_VEXT_VV_ENV(vfmul_vv_w, 4)
206
+GEN_VEXT_VV_ENV(vfmul_vv_d, 8)
207
RVVCALL(OPFVF2, vfmul_vf_h, OP_UUU_H, H2, H2, float16_mul)
208
RVVCALL(OPFVF2, vfmul_vf_w, OP_UUU_W, H4, H4, float32_mul)
209
RVVCALL(OPFVF2, vfmul_vf_d, OP_UUU_D, H8, H8, float64_mul)
210
-GEN_VEXT_VF(vfmul_vf_h)
211
-GEN_VEXT_VF(vfmul_vf_w)
212
-GEN_VEXT_VF(vfmul_vf_d)
213
+GEN_VEXT_VF(vfmul_vf_h, 2)
214
+GEN_VEXT_VF(vfmul_vf_w, 4)
215
+GEN_VEXT_VF(vfmul_vf_d, 8)
216
217
RVVCALL(OPFVV2, vfdiv_vv_h, OP_UUU_H, H2, H2, H2, float16_div)
218
RVVCALL(OPFVV2, vfdiv_vv_w, OP_UUU_W, H4, H4, H4, float32_div)
219
RVVCALL(OPFVV2, vfdiv_vv_d, OP_UUU_D, H8, H8, H8, float64_div)
220
-GEN_VEXT_VV_ENV(vfdiv_vv_h)
221
-GEN_VEXT_VV_ENV(vfdiv_vv_w)
222
-GEN_VEXT_VV_ENV(vfdiv_vv_d)
223
+GEN_VEXT_VV_ENV(vfdiv_vv_h, 2)
224
+GEN_VEXT_VV_ENV(vfdiv_vv_w, 4)
225
+GEN_VEXT_VV_ENV(vfdiv_vv_d, 8)
226
RVVCALL(OPFVF2, vfdiv_vf_h, OP_UUU_H, H2, H2, float16_div)
227
RVVCALL(OPFVF2, vfdiv_vf_w, OP_UUU_W, H4, H4, float32_div)
228
RVVCALL(OPFVF2, vfdiv_vf_d, OP_UUU_D, H8, H8, float64_div)
229
-GEN_VEXT_VF(vfdiv_vf_h)
230
-GEN_VEXT_VF(vfdiv_vf_w)
231
-GEN_VEXT_VF(vfdiv_vf_d)
232
+GEN_VEXT_VF(vfdiv_vf_h, 2)
233
+GEN_VEXT_VF(vfdiv_vf_w, 4)
234
+GEN_VEXT_VF(vfdiv_vf_d, 8)
235
236
static uint16_t float16_rdiv(uint16_t a, uint16_t b, float_status *s)
237
{
238
@@ -XXX,XX +XXX,XX @@ static uint64_t float64_rdiv(uint64_t a, uint64_t b, float_status *s)
239
RVVCALL(OPFVF2, vfrdiv_vf_h, OP_UUU_H, H2, H2, float16_rdiv)
240
RVVCALL(OPFVF2, vfrdiv_vf_w, OP_UUU_W, H4, H4, float32_rdiv)
241
RVVCALL(OPFVF2, vfrdiv_vf_d, OP_UUU_D, H8, H8, float64_rdiv)
242
-GEN_VEXT_VF(vfrdiv_vf_h)
243
-GEN_VEXT_VF(vfrdiv_vf_w)
244
-GEN_VEXT_VF(vfrdiv_vf_d)
245
+GEN_VEXT_VF(vfrdiv_vf_h, 2)
246
+GEN_VEXT_VF(vfrdiv_vf_w, 4)
247
+GEN_VEXT_VF(vfrdiv_vf_d, 8)
248
249
/* Vector Widening Floating-Point Multiply */
250
static uint32_t vfwmul16(uint16_t a, uint16_t b, float_status *s)
251
@@ -XXX,XX +XXX,XX @@ static uint64_t vfwmul32(uint32_t a, uint32_t b, float_status *s)
252
}
253
RVVCALL(OPFVV2, vfwmul_vv_h, WOP_UUU_H, H4, H2, H2, vfwmul16)
254
RVVCALL(OPFVV2, vfwmul_vv_w, WOP_UUU_W, H8, H4, H4, vfwmul32)
255
-GEN_VEXT_VV_ENV(vfwmul_vv_h)
256
-GEN_VEXT_VV_ENV(vfwmul_vv_w)
257
+GEN_VEXT_VV_ENV(vfwmul_vv_h, 4)
258
+GEN_VEXT_VV_ENV(vfwmul_vv_w, 8)
259
RVVCALL(OPFVF2, vfwmul_vf_h, WOP_UUU_H, H4, H2, vfwmul16)
260
RVVCALL(OPFVF2, vfwmul_vf_w, WOP_UUU_W, H8, H4, vfwmul32)
261
-GEN_VEXT_VF(vfwmul_vf_h)
262
-GEN_VEXT_VF(vfwmul_vf_w)
263
+GEN_VEXT_VF(vfwmul_vf_h, 4)
264
+GEN_VEXT_VF(vfwmul_vf_w, 8)
265
266
/* Vector Single-Width Floating-Point Fused Multiply-Add Instructions */
267
#define OPFVV3(NAME, TD, T1, T2, TX1, TX2, HD, HS1, HS2, OP) \
268
@@ -XXX,XX +XXX,XX @@ static uint64_t fmacc64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
269
RVVCALL(OPFVV3, vfmacc_vv_h, OP_UUU_H, H2, H2, H2, fmacc16)
270
RVVCALL(OPFVV3, vfmacc_vv_w, OP_UUU_W, H4, H4, H4, fmacc32)
271
RVVCALL(OPFVV3, vfmacc_vv_d, OP_UUU_D, H8, H8, H8, fmacc64)
272
-GEN_VEXT_VV_ENV(vfmacc_vv_h)
273
-GEN_VEXT_VV_ENV(vfmacc_vv_w)
274
-GEN_VEXT_VV_ENV(vfmacc_vv_d)
275
+GEN_VEXT_VV_ENV(vfmacc_vv_h, 2)
276
+GEN_VEXT_VV_ENV(vfmacc_vv_w, 4)
277
+GEN_VEXT_VV_ENV(vfmacc_vv_d, 8)
278
279
#define OPFVF3(NAME, TD, T1, T2, TX1, TX2, HD, HS2, OP) \
280
static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
281
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, uint64_t s1, void *vs2, int i, \
282
RVVCALL(OPFVF3, vfmacc_vf_h, OP_UUU_H, H2, H2, fmacc16)
283
RVVCALL(OPFVF3, vfmacc_vf_w, OP_UUU_W, H4, H4, fmacc32)
284
RVVCALL(OPFVF3, vfmacc_vf_d, OP_UUU_D, H8, H8, fmacc64)
285
-GEN_VEXT_VF(vfmacc_vf_h)
286
-GEN_VEXT_VF(vfmacc_vf_w)
287
-GEN_VEXT_VF(vfmacc_vf_d)
288
+GEN_VEXT_VF(vfmacc_vf_h, 2)
289
+GEN_VEXT_VF(vfmacc_vf_w, 4)
290
+GEN_VEXT_VF(vfmacc_vf_d, 8)
291
292
static uint16_t fnmacc16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
293
{
294
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmacc64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
295
RVVCALL(OPFVV3, vfnmacc_vv_h, OP_UUU_H, H2, H2, H2, fnmacc16)
296
RVVCALL(OPFVV3, vfnmacc_vv_w, OP_UUU_W, H4, H4, H4, fnmacc32)
297
RVVCALL(OPFVV3, vfnmacc_vv_d, OP_UUU_D, H8, H8, H8, fnmacc64)
298
-GEN_VEXT_VV_ENV(vfnmacc_vv_h)
299
-GEN_VEXT_VV_ENV(vfnmacc_vv_w)
300
-GEN_VEXT_VV_ENV(vfnmacc_vv_d)
301
+GEN_VEXT_VV_ENV(vfnmacc_vv_h, 2)
302
+GEN_VEXT_VV_ENV(vfnmacc_vv_w, 4)
303
+GEN_VEXT_VV_ENV(vfnmacc_vv_d, 8)
304
RVVCALL(OPFVF3, vfnmacc_vf_h, OP_UUU_H, H2, H2, fnmacc16)
305
RVVCALL(OPFVF3, vfnmacc_vf_w, OP_UUU_W, H4, H4, fnmacc32)
306
RVVCALL(OPFVF3, vfnmacc_vf_d, OP_UUU_D, H8, H8, fnmacc64)
307
-GEN_VEXT_VF(vfnmacc_vf_h)
308
-GEN_VEXT_VF(vfnmacc_vf_w)
309
-GEN_VEXT_VF(vfnmacc_vf_d)
310
+GEN_VEXT_VF(vfnmacc_vf_h, 2)
311
+GEN_VEXT_VF(vfnmacc_vf_w, 4)
312
+GEN_VEXT_VF(vfnmacc_vf_d, 8)
313
314
static uint16_t fmsac16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
315
{
316
@@ -XXX,XX +XXX,XX @@ static uint64_t fmsac64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
317
RVVCALL(OPFVV3, vfmsac_vv_h, OP_UUU_H, H2, H2, H2, fmsac16)
318
RVVCALL(OPFVV3, vfmsac_vv_w, OP_UUU_W, H4, H4, H4, fmsac32)
319
RVVCALL(OPFVV3, vfmsac_vv_d, OP_UUU_D, H8, H8, H8, fmsac64)
320
-GEN_VEXT_VV_ENV(vfmsac_vv_h)
321
-GEN_VEXT_VV_ENV(vfmsac_vv_w)
322
-GEN_VEXT_VV_ENV(vfmsac_vv_d)
323
+GEN_VEXT_VV_ENV(vfmsac_vv_h, 2)
324
+GEN_VEXT_VV_ENV(vfmsac_vv_w, 4)
325
+GEN_VEXT_VV_ENV(vfmsac_vv_d, 8)
326
RVVCALL(OPFVF3, vfmsac_vf_h, OP_UUU_H, H2, H2, fmsac16)
327
RVVCALL(OPFVF3, vfmsac_vf_w, OP_UUU_W, H4, H4, fmsac32)
328
RVVCALL(OPFVF3, vfmsac_vf_d, OP_UUU_D, H8, H8, fmsac64)
329
-GEN_VEXT_VF(vfmsac_vf_h)
330
-GEN_VEXT_VF(vfmsac_vf_w)
331
-GEN_VEXT_VF(vfmsac_vf_d)
332
+GEN_VEXT_VF(vfmsac_vf_h, 2)
333
+GEN_VEXT_VF(vfmsac_vf_w, 4)
334
+GEN_VEXT_VF(vfmsac_vf_d, 8)
335
336
static uint16_t fnmsac16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
337
{
338
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmsac64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
339
RVVCALL(OPFVV3, vfnmsac_vv_h, OP_UUU_H, H2, H2, H2, fnmsac16)
340
RVVCALL(OPFVV3, vfnmsac_vv_w, OP_UUU_W, H4, H4, H4, fnmsac32)
341
RVVCALL(OPFVV3, vfnmsac_vv_d, OP_UUU_D, H8, H8, H8, fnmsac64)
342
-GEN_VEXT_VV_ENV(vfnmsac_vv_h)
343
-GEN_VEXT_VV_ENV(vfnmsac_vv_w)
344
-GEN_VEXT_VV_ENV(vfnmsac_vv_d)
345
+GEN_VEXT_VV_ENV(vfnmsac_vv_h, 2)
346
+GEN_VEXT_VV_ENV(vfnmsac_vv_w, 4)
347
+GEN_VEXT_VV_ENV(vfnmsac_vv_d, 8)
348
RVVCALL(OPFVF3, vfnmsac_vf_h, OP_UUU_H, H2, H2, fnmsac16)
349
RVVCALL(OPFVF3, vfnmsac_vf_w, OP_UUU_W, H4, H4, fnmsac32)
350
RVVCALL(OPFVF3, vfnmsac_vf_d, OP_UUU_D, H8, H8, fnmsac64)
351
-GEN_VEXT_VF(vfnmsac_vf_h)
352
-GEN_VEXT_VF(vfnmsac_vf_w)
353
-GEN_VEXT_VF(vfnmsac_vf_d)
354
+GEN_VEXT_VF(vfnmsac_vf_h, 2)
355
+GEN_VEXT_VF(vfnmsac_vf_w, 4)
356
+GEN_VEXT_VF(vfnmsac_vf_d, 8)
357
358
static uint16_t fmadd16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
359
{
360
@@ -XXX,XX +XXX,XX @@ static uint64_t fmadd64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
361
RVVCALL(OPFVV3, vfmadd_vv_h, OP_UUU_H, H2, H2, H2, fmadd16)
362
RVVCALL(OPFVV3, vfmadd_vv_w, OP_UUU_W, H4, H4, H4, fmadd32)
363
RVVCALL(OPFVV3, vfmadd_vv_d, OP_UUU_D, H8, H8, H8, fmadd64)
364
-GEN_VEXT_VV_ENV(vfmadd_vv_h)
365
-GEN_VEXT_VV_ENV(vfmadd_vv_w)
366
-GEN_VEXT_VV_ENV(vfmadd_vv_d)
367
+GEN_VEXT_VV_ENV(vfmadd_vv_h, 2)
368
+GEN_VEXT_VV_ENV(vfmadd_vv_w, 4)
369
+GEN_VEXT_VV_ENV(vfmadd_vv_d, 8)
370
RVVCALL(OPFVF3, vfmadd_vf_h, OP_UUU_H, H2, H2, fmadd16)
371
RVVCALL(OPFVF3, vfmadd_vf_w, OP_UUU_W, H4, H4, fmadd32)
372
RVVCALL(OPFVF3, vfmadd_vf_d, OP_UUU_D, H8, H8, fmadd64)
373
-GEN_VEXT_VF(vfmadd_vf_h)
374
-GEN_VEXT_VF(vfmadd_vf_w)
375
-GEN_VEXT_VF(vfmadd_vf_d)
376
+GEN_VEXT_VF(vfmadd_vf_h, 2)
377
+GEN_VEXT_VF(vfmadd_vf_w, 4)
378
+GEN_VEXT_VF(vfmadd_vf_d, 8)
379
380
static uint16_t fnmadd16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
381
{
382
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmadd64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
383
RVVCALL(OPFVV3, vfnmadd_vv_h, OP_UUU_H, H2, H2, H2, fnmadd16)
384
RVVCALL(OPFVV3, vfnmadd_vv_w, OP_UUU_W, H4, H4, H4, fnmadd32)
385
RVVCALL(OPFVV3, vfnmadd_vv_d, OP_UUU_D, H8, H8, H8, fnmadd64)
386
-GEN_VEXT_VV_ENV(vfnmadd_vv_h)
387
-GEN_VEXT_VV_ENV(vfnmadd_vv_w)
388
-GEN_VEXT_VV_ENV(vfnmadd_vv_d)
389
+GEN_VEXT_VV_ENV(vfnmadd_vv_h, 2)
390
+GEN_VEXT_VV_ENV(vfnmadd_vv_w, 4)
391
+GEN_VEXT_VV_ENV(vfnmadd_vv_d, 8)
392
RVVCALL(OPFVF3, vfnmadd_vf_h, OP_UUU_H, H2, H2, fnmadd16)
393
RVVCALL(OPFVF3, vfnmadd_vf_w, OP_UUU_W, H4, H4, fnmadd32)
394
RVVCALL(OPFVF3, vfnmadd_vf_d, OP_UUU_D, H8, H8, fnmadd64)
395
-GEN_VEXT_VF(vfnmadd_vf_h)
396
-GEN_VEXT_VF(vfnmadd_vf_w)
397
-GEN_VEXT_VF(vfnmadd_vf_d)
398
+GEN_VEXT_VF(vfnmadd_vf_h, 2)
399
+GEN_VEXT_VF(vfnmadd_vf_w, 4)
400
+GEN_VEXT_VF(vfnmadd_vf_d, 8)
401
402
static uint16_t fmsub16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
403
{
404
@@ -XXX,XX +XXX,XX @@ static uint64_t fmsub64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
405
RVVCALL(OPFVV3, vfmsub_vv_h, OP_UUU_H, H2, H2, H2, fmsub16)
406
RVVCALL(OPFVV3, vfmsub_vv_w, OP_UUU_W, H4, H4, H4, fmsub32)
407
RVVCALL(OPFVV3, vfmsub_vv_d, OP_UUU_D, H8, H8, H8, fmsub64)
408
-GEN_VEXT_VV_ENV(vfmsub_vv_h)
409
-GEN_VEXT_VV_ENV(vfmsub_vv_w)
410
-GEN_VEXT_VV_ENV(vfmsub_vv_d)
411
+GEN_VEXT_VV_ENV(vfmsub_vv_h, 2)
412
+GEN_VEXT_VV_ENV(vfmsub_vv_w, 4)
413
+GEN_VEXT_VV_ENV(vfmsub_vv_d, 8)
414
RVVCALL(OPFVF3, vfmsub_vf_h, OP_UUU_H, H2, H2, fmsub16)
415
RVVCALL(OPFVF3, vfmsub_vf_w, OP_UUU_W, H4, H4, fmsub32)
416
RVVCALL(OPFVF3, vfmsub_vf_d, OP_UUU_D, H8, H8, fmsub64)
417
-GEN_VEXT_VF(vfmsub_vf_h)
418
-GEN_VEXT_VF(vfmsub_vf_w)
419
-GEN_VEXT_VF(vfmsub_vf_d)
420
+GEN_VEXT_VF(vfmsub_vf_h, 2)
421
+GEN_VEXT_VF(vfmsub_vf_w, 4)
422
+GEN_VEXT_VF(vfmsub_vf_d, 8)
423
424
static uint16_t fnmsub16(uint16_t a, uint16_t b, uint16_t d, float_status *s)
425
{
426
@@ -XXX,XX +XXX,XX @@ static uint64_t fnmsub64(uint64_t a, uint64_t b, uint64_t d, float_status *s)
427
RVVCALL(OPFVV3, vfnmsub_vv_h, OP_UUU_H, H2, H2, H2, fnmsub16)
428
RVVCALL(OPFVV3, vfnmsub_vv_w, OP_UUU_W, H4, H4, H4, fnmsub32)
429
RVVCALL(OPFVV3, vfnmsub_vv_d, OP_UUU_D, H8, H8, H8, fnmsub64)
430
-GEN_VEXT_VV_ENV(vfnmsub_vv_h)
431
-GEN_VEXT_VV_ENV(vfnmsub_vv_w)
432
-GEN_VEXT_VV_ENV(vfnmsub_vv_d)
433
+GEN_VEXT_VV_ENV(vfnmsub_vv_h, 2)
434
+GEN_VEXT_VV_ENV(vfnmsub_vv_w, 4)
435
+GEN_VEXT_VV_ENV(vfnmsub_vv_d, 8)
436
RVVCALL(OPFVF3, vfnmsub_vf_h, OP_UUU_H, H2, H2, fnmsub16)
437
RVVCALL(OPFVF3, vfnmsub_vf_w, OP_UUU_W, H4, H4, fnmsub32)
438
RVVCALL(OPFVF3, vfnmsub_vf_d, OP_UUU_D, H8, H8, fnmsub64)
439
-GEN_VEXT_VF(vfnmsub_vf_h)
440
-GEN_VEXT_VF(vfnmsub_vf_w)
441
-GEN_VEXT_VF(vfnmsub_vf_d)
442
+GEN_VEXT_VF(vfnmsub_vf_h, 2)
443
+GEN_VEXT_VF(vfnmsub_vf_w, 4)
444
+GEN_VEXT_VF(vfnmsub_vf_d, 8)
445
446
/* Vector Widening Floating-Point Fused Multiply-Add Instructions */
447
static uint32_t fwmacc16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
448
@@ -XXX,XX +XXX,XX @@ static uint64_t fwmacc32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
449
450
RVVCALL(OPFVV3, vfwmacc_vv_h, WOP_UUU_H, H4, H2, H2, fwmacc16)
451
RVVCALL(OPFVV3, vfwmacc_vv_w, WOP_UUU_W, H8, H4, H4, fwmacc32)
452
-GEN_VEXT_VV_ENV(vfwmacc_vv_h)
453
-GEN_VEXT_VV_ENV(vfwmacc_vv_w)
454
+GEN_VEXT_VV_ENV(vfwmacc_vv_h, 4)
455
+GEN_VEXT_VV_ENV(vfwmacc_vv_w, 8)
456
RVVCALL(OPFVF3, vfwmacc_vf_h, WOP_UUU_H, H4, H2, fwmacc16)
457
RVVCALL(OPFVF3, vfwmacc_vf_w, WOP_UUU_W, H8, H4, fwmacc32)
458
-GEN_VEXT_VF(vfwmacc_vf_h)
459
-GEN_VEXT_VF(vfwmacc_vf_w)
460
+GEN_VEXT_VF(vfwmacc_vf_h, 4)
461
+GEN_VEXT_VF(vfwmacc_vf_w, 8)
462
463
static uint32_t fwnmacc16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
464
{
465
@@ -XXX,XX +XXX,XX @@ static uint64_t fwnmacc32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
466
467
RVVCALL(OPFVV3, vfwnmacc_vv_h, WOP_UUU_H, H4, H2, H2, fwnmacc16)
468
RVVCALL(OPFVV3, vfwnmacc_vv_w, WOP_UUU_W, H8, H4, H4, fwnmacc32)
469
-GEN_VEXT_VV_ENV(vfwnmacc_vv_h)
470
-GEN_VEXT_VV_ENV(vfwnmacc_vv_w)
471
+GEN_VEXT_VV_ENV(vfwnmacc_vv_h, 4)
472
+GEN_VEXT_VV_ENV(vfwnmacc_vv_w, 8)
473
RVVCALL(OPFVF3, vfwnmacc_vf_h, WOP_UUU_H, H4, H2, fwnmacc16)
474
RVVCALL(OPFVF3, vfwnmacc_vf_w, WOP_UUU_W, H8, H4, fwnmacc32)
475
-GEN_VEXT_VF(vfwnmacc_vf_h)
476
-GEN_VEXT_VF(vfwnmacc_vf_w)
477
+GEN_VEXT_VF(vfwnmacc_vf_h, 4)
478
+GEN_VEXT_VF(vfwnmacc_vf_w, 8)
479
480
static uint32_t fwmsac16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
481
{
482
@@ -XXX,XX +XXX,XX @@ static uint64_t fwmsac32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
483
484
RVVCALL(OPFVV3, vfwmsac_vv_h, WOP_UUU_H, H4, H2, H2, fwmsac16)
485
RVVCALL(OPFVV3, vfwmsac_vv_w, WOP_UUU_W, H8, H4, H4, fwmsac32)
486
-GEN_VEXT_VV_ENV(vfwmsac_vv_h)
487
-GEN_VEXT_VV_ENV(vfwmsac_vv_w)
488
+GEN_VEXT_VV_ENV(vfwmsac_vv_h, 4)
489
+GEN_VEXT_VV_ENV(vfwmsac_vv_w, 8)
490
RVVCALL(OPFVF3, vfwmsac_vf_h, WOP_UUU_H, H4, H2, fwmsac16)
491
RVVCALL(OPFVF3, vfwmsac_vf_w, WOP_UUU_W, H8, H4, fwmsac32)
492
-GEN_VEXT_VF(vfwmsac_vf_h)
493
-GEN_VEXT_VF(vfwmsac_vf_w)
494
+GEN_VEXT_VF(vfwmsac_vf_h, 4)
495
+GEN_VEXT_VF(vfwmsac_vf_w, 8)
496
497
static uint32_t fwnmsac16(uint16_t a, uint16_t b, uint32_t d, float_status *s)
498
{
499
@@ -XXX,XX +XXX,XX @@ static uint64_t fwnmsac32(uint32_t a, uint32_t b, uint64_t d, float_status *s)
500
501
RVVCALL(OPFVV3, vfwnmsac_vv_h, WOP_UUU_H, H4, H2, H2, fwnmsac16)
502
RVVCALL(OPFVV3, vfwnmsac_vv_w, WOP_UUU_W, H8, H4, H4, fwnmsac32)
503
-GEN_VEXT_VV_ENV(vfwnmsac_vv_h)
504
-GEN_VEXT_VV_ENV(vfwnmsac_vv_w)
505
+GEN_VEXT_VV_ENV(vfwnmsac_vv_h, 4)
506
+GEN_VEXT_VV_ENV(vfwnmsac_vv_w, 8)
507
RVVCALL(OPFVF3, vfwnmsac_vf_h, WOP_UUU_H, H4, H2, fwnmsac16)
508
RVVCALL(OPFVF3, vfwnmsac_vf_w, WOP_UUU_W, H8, H4, fwnmsac32)
509
-GEN_VEXT_VF(vfwnmsac_vf_h)
510
-GEN_VEXT_VF(vfwnmsac_vf_w)
511
+GEN_VEXT_VF(vfwnmsac_vf_h, 4)
512
+GEN_VEXT_VF(vfwnmsac_vf_w, 8)
513
514
/* Vector Floating-Point Square-Root Instruction */
515
/* (TD, T2, TX2) */
516
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, void *vs2, int i, \
517
*((TD *)vd + HD(i)) = OP(s2, &env->fp_status); \
518
}
519
520
-#define GEN_VEXT_V_ENV(NAME) \
521
+#define GEN_VEXT_V_ENV(NAME, ESZ) \
522
void HELPER(NAME)(void *vd, void *v0, void *vs2, \
523
CPURISCVState *env, uint32_t desc) \
524
{ \
525
uint32_t vm = vext_vm(desc); \
526
uint32_t vl = env->vl; \
527
+ uint32_t total_elems = \
528
+ vext_get_total_elems(env, desc, ESZ); \
529
+ uint32_t vta = vext_vta(desc); \
530
uint32_t i; \
531
\
532
if (vl == 0) { \
533
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, \
534
do_##NAME(vd, vs2, i, env); \
535
} \
536
env->vstart = 0; \
537
+ vext_set_elems_1s(vd, vta, vl * ESZ, \
538
+ total_elems * ESZ); \
539
}
540
541
RVVCALL(OPFVV1, vfsqrt_v_h, OP_UU_H, H2, H2, float16_sqrt)
542
RVVCALL(OPFVV1, vfsqrt_v_w, OP_UU_W, H4, H4, float32_sqrt)
543
RVVCALL(OPFVV1, vfsqrt_v_d, OP_UU_D, H8, H8, float64_sqrt)
544
-GEN_VEXT_V_ENV(vfsqrt_v_h)
545
-GEN_VEXT_V_ENV(vfsqrt_v_w)
546
-GEN_VEXT_V_ENV(vfsqrt_v_d)
547
+GEN_VEXT_V_ENV(vfsqrt_v_h, 2)
548
+GEN_VEXT_V_ENV(vfsqrt_v_w, 4)
549
+GEN_VEXT_V_ENV(vfsqrt_v_d, 8)
550
551
/*
552
* Vector Floating-Point Reciprocal Square-Root Estimate Instruction
553
@@ -XXX,XX +XXX,XX @@ static float64 frsqrt7_d(float64 f, float_status *s)
554
RVVCALL(OPFVV1, vfrsqrt7_v_h, OP_UU_H, H2, H2, frsqrt7_h)
555
RVVCALL(OPFVV1, vfrsqrt7_v_w, OP_UU_W, H4, H4, frsqrt7_s)
556
RVVCALL(OPFVV1, vfrsqrt7_v_d, OP_UU_D, H8, H8, frsqrt7_d)
557
-GEN_VEXT_V_ENV(vfrsqrt7_v_h)
558
-GEN_VEXT_V_ENV(vfrsqrt7_v_w)
559
-GEN_VEXT_V_ENV(vfrsqrt7_v_d)
560
+GEN_VEXT_V_ENV(vfrsqrt7_v_h, 2)
561
+GEN_VEXT_V_ENV(vfrsqrt7_v_w, 4)
562
+GEN_VEXT_V_ENV(vfrsqrt7_v_d, 8)
563
564
/*
565
* Vector Floating-Point Reciprocal Estimate Instruction
566
@@ -XXX,XX +XXX,XX @@ static float64 frec7_d(float64 f, float_status *s)
567
RVVCALL(OPFVV1, vfrec7_v_h, OP_UU_H, H2, H2, frec7_h)
568
RVVCALL(OPFVV1, vfrec7_v_w, OP_UU_W, H4, H4, frec7_s)
569
RVVCALL(OPFVV1, vfrec7_v_d, OP_UU_D, H8, H8, frec7_d)
570
-GEN_VEXT_V_ENV(vfrec7_v_h)
571
-GEN_VEXT_V_ENV(vfrec7_v_w)
572
-GEN_VEXT_V_ENV(vfrec7_v_d)
573
+GEN_VEXT_V_ENV(vfrec7_v_h, 2)
574
+GEN_VEXT_V_ENV(vfrec7_v_w, 4)
575
+GEN_VEXT_V_ENV(vfrec7_v_d, 8)
576
577
/* Vector Floating-Point MIN/MAX Instructions */
578
RVVCALL(OPFVV2, vfmin_vv_h, OP_UUU_H, H2, H2, H2, float16_minimum_number)
579
RVVCALL(OPFVV2, vfmin_vv_w, OP_UUU_W, H4, H4, H4, float32_minimum_number)
580
RVVCALL(OPFVV2, vfmin_vv_d, OP_UUU_D, H8, H8, H8, float64_minimum_number)
581
-GEN_VEXT_VV_ENV(vfmin_vv_h)
582
-GEN_VEXT_VV_ENV(vfmin_vv_w)
583
-GEN_VEXT_VV_ENV(vfmin_vv_d)
584
+GEN_VEXT_VV_ENV(vfmin_vv_h, 2)
585
+GEN_VEXT_VV_ENV(vfmin_vv_w, 4)
586
+GEN_VEXT_VV_ENV(vfmin_vv_d, 8)
587
RVVCALL(OPFVF2, vfmin_vf_h, OP_UUU_H, H2, H2, float16_minimum_number)
588
RVVCALL(OPFVF2, vfmin_vf_w, OP_UUU_W, H4, H4, float32_minimum_number)
589
RVVCALL(OPFVF2, vfmin_vf_d, OP_UUU_D, H8, H8, float64_minimum_number)
590
-GEN_VEXT_VF(vfmin_vf_h)
591
-GEN_VEXT_VF(vfmin_vf_w)
592
-GEN_VEXT_VF(vfmin_vf_d)
593
+GEN_VEXT_VF(vfmin_vf_h, 2)
594
+GEN_VEXT_VF(vfmin_vf_w, 4)
595
+GEN_VEXT_VF(vfmin_vf_d, 8)
596
597
RVVCALL(OPFVV2, vfmax_vv_h, OP_UUU_H, H2, H2, H2, float16_maximum_number)
598
RVVCALL(OPFVV2, vfmax_vv_w, OP_UUU_W, H4, H4, H4, float32_maximum_number)
599
RVVCALL(OPFVV2, vfmax_vv_d, OP_UUU_D, H8, H8, H8, float64_maximum_number)
600
-GEN_VEXT_VV_ENV(vfmax_vv_h)
601
-GEN_VEXT_VV_ENV(vfmax_vv_w)
602
-GEN_VEXT_VV_ENV(vfmax_vv_d)
603
+GEN_VEXT_VV_ENV(vfmax_vv_h, 2)
604
+GEN_VEXT_VV_ENV(vfmax_vv_w, 4)
605
+GEN_VEXT_VV_ENV(vfmax_vv_d, 8)
606
RVVCALL(OPFVF2, vfmax_vf_h, OP_UUU_H, H2, H2, float16_maximum_number)
607
RVVCALL(OPFVF2, vfmax_vf_w, OP_UUU_W, H4, H4, float32_maximum_number)
608
RVVCALL(OPFVF2, vfmax_vf_d, OP_UUU_D, H8, H8, float64_maximum_number)
609
-GEN_VEXT_VF(vfmax_vf_h)
610
-GEN_VEXT_VF(vfmax_vf_w)
611
-GEN_VEXT_VF(vfmax_vf_d)
612
+GEN_VEXT_VF(vfmax_vf_h, 2)
613
+GEN_VEXT_VF(vfmax_vf_w, 4)
614
+GEN_VEXT_VF(vfmax_vf_d, 8)
615
616
/* Vector Floating-Point Sign-Injection Instructions */
617
static uint16_t fsgnj16(uint16_t a, uint16_t b, float_status *s)
618
@@ -XXX,XX +XXX,XX @@ static uint64_t fsgnj64(uint64_t a, uint64_t b, float_status *s)
619
RVVCALL(OPFVV2, vfsgnj_vv_h, OP_UUU_H, H2, H2, H2, fsgnj16)
620
RVVCALL(OPFVV2, vfsgnj_vv_w, OP_UUU_W, H4, H4, H4, fsgnj32)
621
RVVCALL(OPFVV2, vfsgnj_vv_d, OP_UUU_D, H8, H8, H8, fsgnj64)
622
-GEN_VEXT_VV_ENV(vfsgnj_vv_h)
623
-GEN_VEXT_VV_ENV(vfsgnj_vv_w)
624
-GEN_VEXT_VV_ENV(vfsgnj_vv_d)
625
+GEN_VEXT_VV_ENV(vfsgnj_vv_h, 2)
626
+GEN_VEXT_VV_ENV(vfsgnj_vv_w, 4)
627
+GEN_VEXT_VV_ENV(vfsgnj_vv_d, 8)
628
RVVCALL(OPFVF2, vfsgnj_vf_h, OP_UUU_H, H2, H2, fsgnj16)
629
RVVCALL(OPFVF2, vfsgnj_vf_w, OP_UUU_W, H4, H4, fsgnj32)
630
RVVCALL(OPFVF2, vfsgnj_vf_d, OP_UUU_D, H8, H8, fsgnj64)
631
-GEN_VEXT_VF(vfsgnj_vf_h)
632
-GEN_VEXT_VF(vfsgnj_vf_w)
633
-GEN_VEXT_VF(vfsgnj_vf_d)
634
+GEN_VEXT_VF(vfsgnj_vf_h, 2)
635
+GEN_VEXT_VF(vfsgnj_vf_w, 4)
636
+GEN_VEXT_VF(vfsgnj_vf_d, 8)
637
638
static uint16_t fsgnjn16(uint16_t a, uint16_t b, float_status *s)
639
{
640
@@ -XXX,XX +XXX,XX @@ static uint64_t fsgnjn64(uint64_t a, uint64_t b, float_status *s)
641
RVVCALL(OPFVV2, vfsgnjn_vv_h, OP_UUU_H, H2, H2, H2, fsgnjn16)
642
RVVCALL(OPFVV2, vfsgnjn_vv_w, OP_UUU_W, H4, H4, H4, fsgnjn32)
643
RVVCALL(OPFVV2, vfsgnjn_vv_d, OP_UUU_D, H8, H8, H8, fsgnjn64)
644
-GEN_VEXT_VV_ENV(vfsgnjn_vv_h)
645
-GEN_VEXT_VV_ENV(vfsgnjn_vv_w)
646
-GEN_VEXT_VV_ENV(vfsgnjn_vv_d)
647
+GEN_VEXT_VV_ENV(vfsgnjn_vv_h, 2)
648
+GEN_VEXT_VV_ENV(vfsgnjn_vv_w, 4)
649
+GEN_VEXT_VV_ENV(vfsgnjn_vv_d, 8)
650
RVVCALL(OPFVF2, vfsgnjn_vf_h, OP_UUU_H, H2, H2, fsgnjn16)
651
RVVCALL(OPFVF2, vfsgnjn_vf_w, OP_UUU_W, H4, H4, fsgnjn32)
652
RVVCALL(OPFVF2, vfsgnjn_vf_d, OP_UUU_D, H8, H8, fsgnjn64)
653
-GEN_VEXT_VF(vfsgnjn_vf_h)
654
-GEN_VEXT_VF(vfsgnjn_vf_w)
655
-GEN_VEXT_VF(vfsgnjn_vf_d)
656
+GEN_VEXT_VF(vfsgnjn_vf_h, 2)
657
+GEN_VEXT_VF(vfsgnjn_vf_w, 4)
658
+GEN_VEXT_VF(vfsgnjn_vf_d, 8)
659
660
static uint16_t fsgnjx16(uint16_t a, uint16_t b, float_status *s)
661
{
662
@@ -XXX,XX +XXX,XX @@ static uint64_t fsgnjx64(uint64_t a, uint64_t b, float_status *s)
663
RVVCALL(OPFVV2, vfsgnjx_vv_h, OP_UUU_H, H2, H2, H2, fsgnjx16)
664
RVVCALL(OPFVV2, vfsgnjx_vv_w, OP_UUU_W, H4, H4, H4, fsgnjx32)
665
RVVCALL(OPFVV2, vfsgnjx_vv_d, OP_UUU_D, H8, H8, H8, fsgnjx64)
666
-GEN_VEXT_VV_ENV(vfsgnjx_vv_h)
667
-GEN_VEXT_VV_ENV(vfsgnjx_vv_w)
668
-GEN_VEXT_VV_ENV(vfsgnjx_vv_d)
669
+GEN_VEXT_VV_ENV(vfsgnjx_vv_h, 2)
670
+GEN_VEXT_VV_ENV(vfsgnjx_vv_w, 4)
671
+GEN_VEXT_VV_ENV(vfsgnjx_vv_d, 8)
672
RVVCALL(OPFVF2, vfsgnjx_vf_h, OP_UUU_H, H2, H2, fsgnjx16)
673
RVVCALL(OPFVF2, vfsgnjx_vf_w, OP_UUU_W, H4, H4, fsgnjx32)
674
RVVCALL(OPFVF2, vfsgnjx_vf_d, OP_UUU_D, H8, H8, fsgnjx64)
675
-GEN_VEXT_VF(vfsgnjx_vf_h)
676
-GEN_VEXT_VF(vfsgnjx_vf_w)
677
-GEN_VEXT_VF(vfsgnjx_vf_d)
678
+GEN_VEXT_VF(vfsgnjx_vf_h, 2)
679
+GEN_VEXT_VF(vfsgnjx_vf_w, 4)
680
+GEN_VEXT_VF(vfsgnjx_vf_d, 8)
681
682
/* Vector Floating-Point Compare Instructions */
683
#define GEN_VEXT_CMP_VV_ENV(NAME, ETYPE, H, DO_OP) \
684
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
685
{ \
686
uint32_t vm = vext_vm(desc); \
687
uint32_t vl = env->vl; \
688
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen; \
689
+ uint32_t vta_all_1s = vext_vta_all_1s(desc); \
690
uint32_t i; \
691
\
692
for (i = env->vstart; i < vl; i++) { \
693
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
694
DO_OP(s2, s1, &env->fp_status)); \
695
} \
696
env->vstart = 0; \
697
+ /* mask destination register are always tail-agnostic */ \
698
+ /* set tail elements to 1s */ \
699
+ if (vta_all_1s) { \
700
+ for (; i < total_elems; i++) { \
701
+ vext_set_elem_mask(vd, i, 1); \
702
+ } \
703
+ } \
704
}
705
706
GEN_VEXT_CMP_VV_ENV(vmfeq_vv_h, uint16_t, H2, float16_eq_quiet)
707
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, uint64_t s1, void *vs2, \
708
{ \
709
uint32_t vm = vext_vm(desc); \
710
uint32_t vl = env->vl; \
711
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen; \
712
+ uint32_t vta_all_1s = vext_vta_all_1s(desc); \
713
uint32_t i; \
714
\
715
for (i = env->vstart; i < vl; i++) { \
716
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, uint64_t s1, void *vs2, \
717
DO_OP(s2, (ETYPE)s1, &env->fp_status)); \
718
} \
719
env->vstart = 0; \
720
+ /* mask destination register are always tail-agnostic */ \
721
+ /* set tail elements to 1s */ \
722
+ if (vta_all_1s) { \
723
+ for (; i < total_elems; i++) { \
724
+ vext_set_elem_mask(vd, i, 1); \
725
+ } \
726
+ } \
727
}
728
729
GEN_VEXT_CMP_VF(vmfeq_vf_h, uint16_t, H2, float16_eq_quiet)
730
@@ -XXX,XX +XXX,XX @@ static void do_##NAME(void *vd, void *vs2, int i) \
731
*((TD *)vd + HD(i)) = OP(s2); \
732
}
733
734
-#define GEN_VEXT_V(NAME) \
735
+#define GEN_VEXT_V(NAME, ESZ) \
736
void HELPER(NAME)(void *vd, void *v0, void *vs2, \
737
CPURISCVState *env, uint32_t desc) \
738
{ \
739
uint32_t vm = vext_vm(desc); \
740
uint32_t vl = env->vl; \
741
+ uint32_t total_elems = \
742
+ vext_get_total_elems(env, desc, ESZ); \
743
+ uint32_t vta = vext_vta(desc); \
744
uint32_t i; \
745
\
746
for (i = env->vstart; i < vl; i++) { \
747
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, \
748
do_##NAME(vd, vs2, i); \
749
} \
750
env->vstart = 0; \
751
+ /* set tail elements to 1s */ \
752
+ vext_set_elems_1s(vd, vta, vl * ESZ, \
753
+ total_elems * ESZ); \
754
}
755
756
target_ulong fclass_h(uint64_t frs1)
757
@@ -XXX,XX +XXX,XX @@ target_ulong fclass_d(uint64_t frs1)
758
RVVCALL(OPIVV1, vfclass_v_h, OP_UU_H, H2, H2, fclass_h)
759
RVVCALL(OPIVV1, vfclass_v_w, OP_UU_W, H4, H4, fclass_s)
760
RVVCALL(OPIVV1, vfclass_v_d, OP_UU_D, H8, H8, fclass_d)
761
-GEN_VEXT_V(vfclass_v_h)
762
-GEN_VEXT_V(vfclass_v_w)
763
-GEN_VEXT_V(vfclass_v_d)
764
+GEN_VEXT_V(vfclass_v_h, 2)
765
+GEN_VEXT_V(vfclass_v_w, 4)
766
+GEN_VEXT_V(vfclass_v_d, 8)
767
768
/* Vector Floating-Point Merge Instruction */
769
+
770
#define GEN_VFMERGE_VF(NAME, ETYPE, H) \
771
void HELPER(NAME)(void *vd, void *v0, uint64_t s1, void *vs2, \
772
CPURISCVState *env, uint32_t desc) \
773
{ \
774
uint32_t vm = vext_vm(desc); \
775
uint32_t vl = env->vl; \
776
+ uint32_t esz = sizeof(ETYPE); \
777
+ uint32_t total_elems = \
778
+ vext_get_total_elems(env, desc, esz); \
779
+ uint32_t vta = vext_vta(desc); \
780
uint32_t i; \
781
\
782
for (i = env->vstart; i < vl; i++) { \
783
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, uint64_t s1, void *vs2, \
784
= (!vm && !vext_elem_mask(v0, i) ? s2 : s1); \
785
} \
786
env->vstart = 0; \
787
+ /* set tail elements to 1s */ \
788
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
789
}
790
791
GEN_VFMERGE_VF(vfmerge_vfm_h, int16_t, H2)
792
@@ -XXX,XX +XXX,XX @@ GEN_VFMERGE_VF(vfmerge_vfm_d, int64_t, H8)
793
RVVCALL(OPFVV1, vfcvt_xu_f_v_h, OP_UU_H, H2, H2, float16_to_uint16)
794
RVVCALL(OPFVV1, vfcvt_xu_f_v_w, OP_UU_W, H4, H4, float32_to_uint32)
795
RVVCALL(OPFVV1, vfcvt_xu_f_v_d, OP_UU_D, H8, H8, float64_to_uint64)
796
-GEN_VEXT_V_ENV(vfcvt_xu_f_v_h)
797
-GEN_VEXT_V_ENV(vfcvt_xu_f_v_w)
798
-GEN_VEXT_V_ENV(vfcvt_xu_f_v_d)
799
+GEN_VEXT_V_ENV(vfcvt_xu_f_v_h, 2)
800
+GEN_VEXT_V_ENV(vfcvt_xu_f_v_w, 4)
801
+GEN_VEXT_V_ENV(vfcvt_xu_f_v_d, 8)
802
803
/* vfcvt.x.f.v vd, vs2, vm # Convert float to signed integer. */
804
RVVCALL(OPFVV1, vfcvt_x_f_v_h, OP_UU_H, H2, H2, float16_to_int16)
805
RVVCALL(OPFVV1, vfcvt_x_f_v_w, OP_UU_W, H4, H4, float32_to_int32)
806
RVVCALL(OPFVV1, vfcvt_x_f_v_d, OP_UU_D, H8, H8, float64_to_int64)
807
-GEN_VEXT_V_ENV(vfcvt_x_f_v_h)
808
-GEN_VEXT_V_ENV(vfcvt_x_f_v_w)
809
-GEN_VEXT_V_ENV(vfcvt_x_f_v_d)
810
+GEN_VEXT_V_ENV(vfcvt_x_f_v_h, 2)
811
+GEN_VEXT_V_ENV(vfcvt_x_f_v_w, 4)
812
+GEN_VEXT_V_ENV(vfcvt_x_f_v_d, 8)
813
814
/* vfcvt.f.xu.v vd, vs2, vm # Convert unsigned integer to float. */
815
RVVCALL(OPFVV1, vfcvt_f_xu_v_h, OP_UU_H, H2, H2, uint16_to_float16)
816
RVVCALL(OPFVV1, vfcvt_f_xu_v_w, OP_UU_W, H4, H4, uint32_to_float32)
817
RVVCALL(OPFVV1, vfcvt_f_xu_v_d, OP_UU_D, H8, H8, uint64_to_float64)
818
-GEN_VEXT_V_ENV(vfcvt_f_xu_v_h)
819
-GEN_VEXT_V_ENV(vfcvt_f_xu_v_w)
820
-GEN_VEXT_V_ENV(vfcvt_f_xu_v_d)
821
+GEN_VEXT_V_ENV(vfcvt_f_xu_v_h, 2)
822
+GEN_VEXT_V_ENV(vfcvt_f_xu_v_w, 4)
823
+GEN_VEXT_V_ENV(vfcvt_f_xu_v_d, 8)
824
825
/* vfcvt.f.x.v vd, vs2, vm # Convert integer to float. */
826
RVVCALL(OPFVV1, vfcvt_f_x_v_h, OP_UU_H, H2, H2, int16_to_float16)
827
RVVCALL(OPFVV1, vfcvt_f_x_v_w, OP_UU_W, H4, H4, int32_to_float32)
828
RVVCALL(OPFVV1, vfcvt_f_x_v_d, OP_UU_D, H8, H8, int64_to_float64)
829
-GEN_VEXT_V_ENV(vfcvt_f_x_v_h)
830
-GEN_VEXT_V_ENV(vfcvt_f_x_v_w)
831
-GEN_VEXT_V_ENV(vfcvt_f_x_v_d)
832
+GEN_VEXT_V_ENV(vfcvt_f_x_v_h, 2)
833
+GEN_VEXT_V_ENV(vfcvt_f_x_v_w, 4)
834
+GEN_VEXT_V_ENV(vfcvt_f_x_v_d, 8)
835
836
/* Widening Floating-Point/Integer Type-Convert Instructions */
837
/* (TD, T2, TX2) */
838
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_V_ENV(vfcvt_f_x_v_d)
839
/* vfwcvt.xu.f.v vd, vs2, vm # Convert float to double-width unsigned integer.*/
840
RVVCALL(OPFVV1, vfwcvt_xu_f_v_h, WOP_UU_H, H4, H2, float16_to_uint32)
841
RVVCALL(OPFVV1, vfwcvt_xu_f_v_w, WOP_UU_W, H8, H4, float32_to_uint64)
842
-GEN_VEXT_V_ENV(vfwcvt_xu_f_v_h)
843
-GEN_VEXT_V_ENV(vfwcvt_xu_f_v_w)
844
+GEN_VEXT_V_ENV(vfwcvt_xu_f_v_h, 4)
845
+GEN_VEXT_V_ENV(vfwcvt_xu_f_v_w, 8)
846
847
/* vfwcvt.x.f.v vd, vs2, vm # Convert float to double-width signed integer. */
848
RVVCALL(OPFVV1, vfwcvt_x_f_v_h, WOP_UU_H, H4, H2, float16_to_int32)
849
RVVCALL(OPFVV1, vfwcvt_x_f_v_w, WOP_UU_W, H8, H4, float32_to_int64)
850
-GEN_VEXT_V_ENV(vfwcvt_x_f_v_h)
851
-GEN_VEXT_V_ENV(vfwcvt_x_f_v_w)
852
+GEN_VEXT_V_ENV(vfwcvt_x_f_v_h, 4)
853
+GEN_VEXT_V_ENV(vfwcvt_x_f_v_w, 8)
854
855
/* vfwcvt.f.xu.v vd, vs2, vm # Convert unsigned integer to double-width float */
856
RVVCALL(OPFVV1, vfwcvt_f_xu_v_b, WOP_UU_B, H2, H1, uint8_to_float16)
857
RVVCALL(OPFVV1, vfwcvt_f_xu_v_h, WOP_UU_H, H4, H2, uint16_to_float32)
858
RVVCALL(OPFVV1, vfwcvt_f_xu_v_w, WOP_UU_W, H8, H4, uint32_to_float64)
859
-GEN_VEXT_V_ENV(vfwcvt_f_xu_v_b)
860
-GEN_VEXT_V_ENV(vfwcvt_f_xu_v_h)
861
-GEN_VEXT_V_ENV(vfwcvt_f_xu_v_w)
862
+GEN_VEXT_V_ENV(vfwcvt_f_xu_v_b, 2)
863
+GEN_VEXT_V_ENV(vfwcvt_f_xu_v_h, 4)
864
+GEN_VEXT_V_ENV(vfwcvt_f_xu_v_w, 8)
865
866
/* vfwcvt.f.x.v vd, vs2, vm # Convert integer to double-width float. */
867
RVVCALL(OPFVV1, vfwcvt_f_x_v_b, WOP_UU_B, H2, H1, int8_to_float16)
868
RVVCALL(OPFVV1, vfwcvt_f_x_v_h, WOP_UU_H, H4, H2, int16_to_float32)
869
RVVCALL(OPFVV1, vfwcvt_f_x_v_w, WOP_UU_W, H8, H4, int32_to_float64)
870
-GEN_VEXT_V_ENV(vfwcvt_f_x_v_b)
871
-GEN_VEXT_V_ENV(vfwcvt_f_x_v_h)
872
-GEN_VEXT_V_ENV(vfwcvt_f_x_v_w)
873
+GEN_VEXT_V_ENV(vfwcvt_f_x_v_b, 2)
874
+GEN_VEXT_V_ENV(vfwcvt_f_x_v_h, 4)
875
+GEN_VEXT_V_ENV(vfwcvt_f_x_v_w, 8)
876
877
/*
878
* vfwcvt.f.f.v vd, vs2, vm
879
@@ -XXX,XX +XXX,XX @@ static uint32_t vfwcvtffv16(uint16_t a, float_status *s)
880
881
RVVCALL(OPFVV1, vfwcvt_f_f_v_h, WOP_UU_H, H4, H2, vfwcvtffv16)
882
RVVCALL(OPFVV1, vfwcvt_f_f_v_w, WOP_UU_W, H8, H4, float32_to_float64)
883
-GEN_VEXT_V_ENV(vfwcvt_f_f_v_h)
884
-GEN_VEXT_V_ENV(vfwcvt_f_f_v_w)
885
+GEN_VEXT_V_ENV(vfwcvt_f_f_v_h, 4)
886
+GEN_VEXT_V_ENV(vfwcvt_f_f_v_w, 8)
887
888
/* Narrowing Floating-Point/Integer Type-Convert Instructions */
889
/* (TD, T2, TX2) */
890
@@ -XXX,XX +XXX,XX @@ GEN_VEXT_V_ENV(vfwcvt_f_f_v_w)
891
RVVCALL(OPFVV1, vfncvt_xu_f_w_b, NOP_UU_B, H1, H2, float16_to_uint8)
892
RVVCALL(OPFVV1, vfncvt_xu_f_w_h, NOP_UU_H, H2, H4, float32_to_uint16)
893
RVVCALL(OPFVV1, vfncvt_xu_f_w_w, NOP_UU_W, H4, H8, float64_to_uint32)
894
-GEN_VEXT_V_ENV(vfncvt_xu_f_w_b)
895
-GEN_VEXT_V_ENV(vfncvt_xu_f_w_h)
896
-GEN_VEXT_V_ENV(vfncvt_xu_f_w_w)
897
+GEN_VEXT_V_ENV(vfncvt_xu_f_w_b, 1)
898
+GEN_VEXT_V_ENV(vfncvt_xu_f_w_h, 2)
899
+GEN_VEXT_V_ENV(vfncvt_xu_f_w_w, 4)
900
901
/* vfncvt.x.f.v vd, vs2, vm # Convert double-width float to signed integer. */
902
RVVCALL(OPFVV1, vfncvt_x_f_w_b, NOP_UU_B, H1, H2, float16_to_int8)
903
RVVCALL(OPFVV1, vfncvt_x_f_w_h, NOP_UU_H, H2, H4, float32_to_int16)
904
RVVCALL(OPFVV1, vfncvt_x_f_w_w, NOP_UU_W, H4, H8, float64_to_int32)
905
-GEN_VEXT_V_ENV(vfncvt_x_f_w_b)
906
-GEN_VEXT_V_ENV(vfncvt_x_f_w_h)
907
-GEN_VEXT_V_ENV(vfncvt_x_f_w_w)
908
+GEN_VEXT_V_ENV(vfncvt_x_f_w_b, 1)
909
+GEN_VEXT_V_ENV(vfncvt_x_f_w_h, 2)
910
+GEN_VEXT_V_ENV(vfncvt_x_f_w_w, 4)
911
912
/* vfncvt.f.xu.v vd, vs2, vm # Convert double-width unsigned integer to float */
913
RVVCALL(OPFVV1, vfncvt_f_xu_w_h, NOP_UU_H, H2, H4, uint32_to_float16)
914
RVVCALL(OPFVV1, vfncvt_f_xu_w_w, NOP_UU_W, H4, H8, uint64_to_float32)
915
-GEN_VEXT_V_ENV(vfncvt_f_xu_w_h)
916
-GEN_VEXT_V_ENV(vfncvt_f_xu_w_w)
917
+GEN_VEXT_V_ENV(vfncvt_f_xu_w_h, 2)
918
+GEN_VEXT_V_ENV(vfncvt_f_xu_w_w, 4)
919
920
/* vfncvt.f.x.v vd, vs2, vm # Convert double-width integer to float. */
921
RVVCALL(OPFVV1, vfncvt_f_x_w_h, NOP_UU_H, H2, H4, int32_to_float16)
922
RVVCALL(OPFVV1, vfncvt_f_x_w_w, NOP_UU_W, H4, H8, int64_to_float32)
923
-GEN_VEXT_V_ENV(vfncvt_f_x_w_h)
924
-GEN_VEXT_V_ENV(vfncvt_f_x_w_w)
925
+GEN_VEXT_V_ENV(vfncvt_f_x_w_h, 2)
926
+GEN_VEXT_V_ENV(vfncvt_f_x_w_w, 4)
927
928
/* vfncvt.f.f.v vd, vs2, vm # Convert double float to single-width float. */
929
static uint16_t vfncvtffv16(uint32_t a, float_status *s)
930
@@ -XXX,XX +XXX,XX @@ static uint16_t vfncvtffv16(uint32_t a, float_status *s)
931
932
RVVCALL(OPFVV1, vfncvt_f_f_w_h, NOP_UU_H, H2, H4, vfncvtffv16)
933
RVVCALL(OPFVV1, vfncvt_f_f_w_w, NOP_UU_W, H4, H8, float64_to_float32)
934
-GEN_VEXT_V_ENV(vfncvt_f_f_w_h)
935
-GEN_VEXT_V_ENV(vfncvt_f_f_w_w)
936
+GEN_VEXT_V_ENV(vfncvt_f_f_w_h, 2)
937
+GEN_VEXT_V_ENV(vfncvt_f_f_w_w, 4)
938
939
/*
940
*** Vector Reduction Operations
941
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
35
index XXXXXXX..XXXXXXX 100644
942
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/riscv/microchip_pfsoc.c
943
--- a/target/riscv/insn_trans/trans_rvv.c.inc
37
+++ b/hw/riscv/microchip_pfsoc.c
944
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
38
@@ -XXX,XX +XXX,XX @@ static const MemMapEntry microchip_pfsoc_memmap[] = {
945
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
39
[MICROCHIP_PFSOC_ENVM_DATA] = { 0x20220000, 0x20000 },
946
\
40
[MICROCHIP_PFSOC_QSPI_XIP] = { 0x21000000, 0x1000000 },
947
data = FIELD_DP32(data, VDATA, VM, a->vm); \
41
[MICROCHIP_PFSOC_IOSCB] = { 0x30000000, 0x10000000 },
948
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
42
+ [MICROCHIP_PFSOC_EMMC_SD_MUX] = { 0x4f000000, 0x4 },
949
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
43
[MICROCHIP_PFSOC_DRAM_LO] = { 0x80000000, 0x40000000 },
950
+ data = \
44
[MICROCHIP_PFSOC_DRAM_LO_ALIAS] = { 0xc0000000, 0x40000000 },
951
+ FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s);\
45
[MICROCHIP_PFSOC_DRAM_HI] = { 0x1000000000, 0x0 },
952
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
46
@@ -XXX,XX +XXX,XX @@ static void microchip_pfsoc_soc_realize(DeviceState *dev, Error **errp)
953
vreg_ofs(s, a->rs1), \
47
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ioscb), 0,
954
vreg_ofs(s, a->rs2), cpu_env, \
48
memmap[MICROCHIP_PFSOC_IOSCB].base);
955
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
49
956
gen_set_rm(s, RISCV_FRM_DYN); \
50
+ /* eMMC/SD mux */
957
data = FIELD_DP32(data, VDATA, VM, a->vm); \
51
+ create_unimplemented_device("microchip.pfsoc.emmc_sd_mux",
958
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
52
+ memmap[MICROCHIP_PFSOC_EMMC_SD_MUX].base,
959
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
53
+ memmap[MICROCHIP_PFSOC_EMMC_SD_MUX].size);
960
+ data = FIELD_DP32(data, VDATA, VTA_ALL_1S, \
54
+
961
+ s->cfg_vta_all_1s); \
55
/* QSPI Flash */
962
return opfvf_trans(a->rd, a->rs1, a->rs2, data, \
56
memory_region_init_rom(qspi_xip_mem, OBJECT(dev),
963
fns[s->sew - 1], s); \
57
"microchip.pfsoc.qspi_xip",
964
} \
965
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
966
\
967
data = FIELD_DP32(data, VDATA, VM, a->vm); \
968
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
969
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
970
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
971
vreg_ofs(s, a->rs1), \
972
vreg_ofs(s, a->rs2), cpu_env, \
973
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
974
gen_set_rm(s, RISCV_FRM_DYN); \
975
data = FIELD_DP32(data, VDATA, VM, a->vm); \
976
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
977
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
978
return opfvf_trans(a->rd, a->rs1, a->rs2, data, \
979
fns[s->sew - 1], s); \
980
} \
981
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
982
\
983
data = FIELD_DP32(data, VDATA, VM, a->vm); \
984
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
985
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
986
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
987
vreg_ofs(s, a->rs1), \
988
vreg_ofs(s, a->rs2), cpu_env, \
989
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmrr *a) \
990
gen_set_rm(s, RISCV_FRM_DYN); \
991
data = FIELD_DP32(data, VDATA, VM, a->vm); \
992
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
993
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
994
return opfvf_trans(a->rd, a->rs1, a->rs2, data, \
995
fns[s->sew - 1], s); \
996
} \
997
@@ -XXX,XX +XXX,XX @@ static bool do_opfv(DisasContext *s, arg_rmr *a,
998
999
data = FIELD_DP32(data, VDATA, VM, a->vm);
1000
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
1001
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
1002
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0),
1003
vreg_ofs(s, a->rs2), cpu_env,
1004
s->cfg_ptr->vlen / 8,
1005
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
1006
\
1007
data = FIELD_DP32(data, VDATA, VM, a->vm); \
1008
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
1009
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
1010
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
1011
vreg_ofs(s, a->rs2), cpu_env, \
1012
s->cfg_ptr->vlen / 8, \
1013
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
1014
tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
1015
\
1016
data = FIELD_DP32(data, VDATA, VM, a->vm); \
1017
+ data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
1018
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
1019
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
1020
vreg_ofs(s, a->rs2), cpu_env, \
1021
s->cfg_ptr->vlen / 8, \
1022
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
1023
\
1024
data = FIELD_DP32(data, VDATA, VM, a->vm); \
1025
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
1026
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
1027
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
1028
vreg_ofs(s, a->rs2), cpu_env, \
1029
s->cfg_ptr->vlen / 8, \
1030
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
1031
tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
1032
\
1033
data = FIELD_DP32(data, VDATA, VM, a->vm); \
1034
+ data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
1035
+ data = FIELD_DP32(data, VDATA, VTA, s->vta); \
1036
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
1037
vreg_ofs(s, a->rs2), cpu_env, \
1038
s->cfg_ptr->vlen / 8, \
58
--
1039
--
59
2.30.1
1040
2.36.1
60
61
diff view generated by jsdifflib
1
From: Asherah Connor <ashe@kivikakk.ee>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
Allow ramfb on virt. This lets `-device ramfb' work.
3
Signed-off-by: eop Chen <eop.chen@sifive.com>
4
4
Reviewed-by: Frank Chang <frank.chang@sifive.com>
5
Signed-off-by: Asherah Connor <ashe@kivikakk.ee>
5
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
6
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-Id: <165449614532.19704.7000832880482980398-13@git.sr.ht>
8
Message-id: 20210318235041.17175-3-ashe@kivikakk.ee
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
9
---
11
hw/riscv/virt.c | 3 +++
10
target/riscv/vector_helper.c | 20 ++++++++++++++++++++
12
1 file changed, 3 insertions(+)
11
1 file changed, 20 insertions(+)
13
12
14
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
13
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/riscv/virt.c
15
--- a/target/riscv/vector_helper.c
17
+++ b/hw/riscv/virt.c
16
+++ b/target/riscv/vector_helper.c
18
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
19
#include "sysemu/sysemu.h"
18
{ \
20
#include "hw/pci/pci.h"
19
uint32_t vm = vext_vm(desc); \
21
#include "hw/pci-host/gpex.h"
20
uint32_t vl = env->vl; \
22
+#include "hw/display/ramfb.h"
21
+ uint32_t esz = sizeof(TD); \
23
22
+ uint32_t vlenb = simd_maxsz(desc); \
24
static const MemMapEntry virt_memmap[] = {
23
+ uint32_t vta = vext_vta(desc); \
25
[VIRT_DEBUG] = { 0x0, 0x100 },
24
uint32_t i; \
26
@@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
25
TD s1 = *((TD *)vs1 + HD(0)); \
27
mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
26
\
28
mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id;
27
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
29
mc->numa_mem_supported = true;
28
} \
30
+
29
*((TD *)vd + HD(0)) = s1; \
31
+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
30
env->vstart = 0; \
31
+ /* set tail elements to 1s */ \
32
+ vext_set_elems_1s(vd, vta, esz, vlenb); \
32
}
33
}
33
34
34
static const TypeInfo virt_machine_typeinfo = {
35
/* vd[0] = sum(vs1[0], vs2[*]) */
36
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
37
{ \
38
uint32_t vm = vext_vm(desc); \
39
uint32_t vl = env->vl; \
40
+ uint32_t esz = sizeof(TD); \
41
+ uint32_t vlenb = simd_maxsz(desc); \
42
+ uint32_t vta = vext_vta(desc); \
43
uint32_t i; \
44
TD s1 = *((TD *)vs1 + HD(0)); \
45
\
46
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
47
} \
48
*((TD *)vd + HD(0)) = s1; \
49
env->vstart = 0; \
50
+ /* set tail elements to 1s */ \
51
+ vext_set_elems_1s(vd, vta, esz, vlenb); \
52
}
53
54
/* Unordered sum */
55
@@ -XXX,XX +XXX,XX @@ void HELPER(vfwredsum_vs_h)(void *vd, void *v0, void *vs1,
56
{
57
uint32_t vm = vext_vm(desc);
58
uint32_t vl = env->vl;
59
+ uint32_t esz = sizeof(uint32_t);
60
+ uint32_t vlenb = simd_maxsz(desc);
61
+ uint32_t vta = vext_vta(desc);
62
uint32_t i;
63
uint32_t s1 = *((uint32_t *)vs1 + H4(0));
64
65
@@ -XXX,XX +XXX,XX @@ void HELPER(vfwredsum_vs_h)(void *vd, void *v0, void *vs1,
66
}
67
*((uint32_t *)vd + H4(0)) = s1;
68
env->vstart = 0;
69
+ /* set tail elements to 1s */
70
+ vext_set_elems_1s(vd, vta, esz, vlenb);
71
}
72
73
void HELPER(vfwredsum_vs_w)(void *vd, void *v0, void *vs1,
74
@@ -XXX,XX +XXX,XX @@ void HELPER(vfwredsum_vs_w)(void *vd, void *v0, void *vs1,
75
{
76
uint32_t vm = vext_vm(desc);
77
uint32_t vl = env->vl;
78
+ uint32_t esz = sizeof(uint64_t);
79
+ uint32_t vlenb = simd_maxsz(desc);
80
+ uint32_t vta = vext_vta(desc);
81
uint32_t i;
82
uint64_t s1 = *((uint64_t *)vs1);
83
84
@@ -XXX,XX +XXX,XX @@ void HELPER(vfwredsum_vs_w)(void *vd, void *v0, void *vs1,
85
}
86
*((uint64_t *)vd) = s1;
87
env->vstart = 0;
88
+ /* set tail elements to 1s */
89
+ vext_set_elems_1s(vd, vta, esz, vlenb);
90
}
91
92
/*
35
--
93
--
36
2.30.1
94
2.36.1
37
38
diff view generated by jsdifflib
1
From: Jim Shu <cwshu@andestech.com>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
Like MMU translation, add qemu log of PMP permission checking for
3
The tail elements in the destination mask register are updated under
4
debugging.
4
a tail-agnostic policy.
5
5
6
Signed-off-by: Jim Shu <cwshu@andestech.com>
6
Signed-off-by: eop Chen <eop.chen@sifive.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Frank Chang <frank.chang@sifive.com>
8
Message-id: 1613916082-19528-3-git-send-email-cwshu@andestech.com
8
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-Id: <165449614532.19704.7000832880482980398-14@git.sr.ht>
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
12
---
11
target/riscv/cpu_helper.c | 12 ++++++++++++
13
target/riscv/vector_helper.c | 30 +++++++++++++++++++++++++
12
1 file changed, 12 insertions(+)
14
target/riscv/insn_trans/trans_rvv.c.inc | 6 +++++
15
2 files changed, 36 insertions(+)
13
16
14
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
17
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/target/riscv/cpu_helper.c
19
--- a/target/riscv/vector_helper.c
17
+++ b/target/riscv/cpu_helper.c
20
+++ b/target/riscv/vector_helper.c
18
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
21
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
19
if (ret == TRANSLATE_SUCCESS) {
22
uint32_t desc) \
20
ret = get_physical_address_pmp(env, &prot_pmp, &tlb_size, pa,
23
{ \
21
size, access_type, mode);
24
uint32_t vl = env->vl; \
22
+
25
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen; \
23
+ qemu_log_mask(CPU_LOG_MMU,
26
+ uint32_t vta_all_1s = vext_vta_all_1s(desc); \
24
+ "%s PMP address=" TARGET_FMT_plx " ret %d prot"
27
uint32_t i; \
25
+ " %d tlb_size " TARGET_FMT_lu "\n",
28
int a, b; \
26
+ __func__, pa, ret, prot_pmp, tlb_size);
29
\
27
+
30
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, \
28
prot &= prot_pmp;
31
vext_set_elem_mask(vd, i, OP(b, a)); \
29
}
32
} \
30
33
env->vstart = 0; \
31
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
34
+ /* mask destination register are always tail- \
32
if (ret == TRANSLATE_SUCCESS) {
35
+ * agnostic \
33
ret = get_physical_address_pmp(env, &prot_pmp, &tlb_size, pa,
36
+ */ \
34
size, access_type, mode);
37
+ /* set tail elements to 1s */ \
35
+
38
+ if (vta_all_1s) { \
36
+ qemu_log_mask(CPU_LOG_MMU,
39
+ for (; i < total_elems; i++) { \
37
+ "%s PMP address=" TARGET_FMT_plx " ret %d prot"
40
+ vext_set_elem_mask(vd, i, 1); \
38
+ " %d tlb_size " TARGET_FMT_lu "\n",
41
+ } \
39
+ __func__, pa, ret, prot_pmp, tlb_size);
42
+ } \
40
+
43
}
41
prot &= prot_pmp;
44
45
#define DO_NAND(N, M) (!(N & M))
46
@@ -XXX,XX +XXX,XX @@ static void vmsetm(void *vd, void *v0, void *vs2, CPURISCVState *env,
47
{
48
uint32_t vm = vext_vm(desc);
49
uint32_t vl = env->vl;
50
+ uint32_t total_elems = env_archcpu(env)->cfg.vlen;
51
+ uint32_t vta_all_1s = vext_vta_all_1s(desc);
52
int i;
53
bool first_mask_bit = false;
54
55
@@ -XXX,XX +XXX,XX @@ static void vmsetm(void *vd, void *v0, void *vs2, CPURISCVState *env,
42
}
56
}
43
}
57
}
58
env->vstart = 0;
59
+ /* mask destination register are always tail-agnostic */
60
+ /* set tail elements to 1s */
61
+ if (vta_all_1s) {
62
+ for (; i < total_elems; i++) {
63
+ vext_set_elem_mask(vd, i, 1);
64
+ }
65
+ }
66
}
67
68
void HELPER(vmsbf_m)(void *vd, void *v0, void *vs2, CPURISCVState *env,
69
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, CPURISCVState *env, \
70
{ \
71
uint32_t vm = vext_vm(desc); \
72
uint32_t vl = env->vl; \
73
+ uint32_t esz = sizeof(ETYPE); \
74
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
75
+ uint32_t vta = vext_vta(desc); \
76
uint32_t sum = 0; \
77
int i; \
78
\
79
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, CPURISCVState *env, \
80
} \
81
} \
82
env->vstart = 0; \
83
+ /* set tail elements to 1s */ \
84
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
85
}
86
87
GEN_VEXT_VIOTA_M(viota_m_b, uint8_t, H1)
88
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, CPURISCVState *env, uint32_t desc) \
89
{ \
90
uint32_t vm = vext_vm(desc); \
91
uint32_t vl = env->vl; \
92
+ uint32_t esz = sizeof(ETYPE); \
93
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
94
+ uint32_t vta = vext_vta(desc); \
95
int i; \
96
\
97
for (i = env->vstart; i < vl; i++) { \
98
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, CPURISCVState *env, uint32_t desc) \
99
*((ETYPE *)vd + H(i)) = i; \
100
} \
101
env->vstart = 0; \
102
+ /* set tail elements to 1s */ \
103
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
104
}
105
106
GEN_VEXT_VID_V(vid_v_b, uint8_t, H1)
107
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
108
index XXXXXXX..XXXXXXX 100644
109
--- a/target/riscv/insn_trans/trans_rvv.c.inc
110
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
111
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_r *a) \
112
tcg_gen_brcond_tl(TCG_COND_GEU, cpu_vstart, cpu_vl, over); \
113
\
114
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
115
+ data = \
116
+ FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s);\
117
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0), \
118
vreg_ofs(s, a->rs1), \
119
vreg_ofs(s, a->rs2), cpu_env, \
120
@@ -XXX,XX +XXX,XX @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
121
\
122
data = FIELD_DP32(data, VDATA, VM, a->vm); \
123
data = FIELD_DP32(data, VDATA, LMUL, s->lmul); \
124
+ data = \
125
+ FIELD_DP32(data, VDATA, VTA_ALL_1S, s->cfg_vta_all_1s);\
126
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), \
127
vreg_ofs(s, 0), vreg_ofs(s, a->rs2), \
128
cpu_env, s->cfg_ptr->vlen / 8, \
129
@@ -XXX,XX +XXX,XX @@ static bool trans_viota_m(DisasContext *s, arg_viota_m *a)
130
131
data = FIELD_DP32(data, VDATA, VM, a->vm);
132
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
133
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
134
static gen_helper_gvec_3_ptr * const fns[4] = {
135
gen_helper_viota_m_b, gen_helper_viota_m_h,
136
gen_helper_viota_m_w, gen_helper_viota_m_d,
137
@@ -XXX,XX +XXX,XX @@ static bool trans_vid_v(DisasContext *s, arg_vid_v *a)
138
139
data = FIELD_DP32(data, VDATA, VM, a->vm);
140
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
141
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
142
static gen_helper_gvec_2_ptr * const fns[4] = {
143
gen_helper_vid_v_b, gen_helper_vid_v_h,
144
gen_helper_vid_v_w, gen_helper_vid_v_d,
44
--
145
--
45
2.30.1
146
2.36.1
46
47
diff view generated by jsdifflib
1
From: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
1
From: eopXD <yueh.ting.chen@gmail.com>
2
2
3
According to the specification the "field SPVP of hstatus controls the
3
Signed-off-by: eop Chen <eop.chen@sifive.com>
4
privilege level of the access" for the hypervisor virtual-machine load
4
Reviewed-by: Frank Chang <frank.chang@sifive.com>
5
and store instructions HLV, HLVX and HSV.
5
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
6
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
7
Message-Id: <165449614532.19704.7000832880482980398-15@git.sr.ht>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20210311103005.1400718-1-georg.kotheimer@kernkonzept.com
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
9
---
12
target/riscv/cpu_helper.c | 25 ++++++++++++++-----------
10
target/riscv/vector_helper.c | 40 +++++++++++++++++++++++++
13
1 file changed, 14 insertions(+), 11 deletions(-)
11
target/riscv/insn_trans/trans_rvv.c.inc | 7 +++--
12
2 files changed, 45 insertions(+), 2 deletions(-)
14
13
15
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
14
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/target/riscv/cpu_helper.c
16
--- a/target/riscv/vector_helper.c
18
+++ b/target/riscv/cpu_helper.c
17
+++ b/target/riscv/vector_helper.c
19
@@ -XXX,XX +XXX,XX @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
18
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
20
use_background = true;
19
{ \
20
uint32_t vm = vext_vm(desc); \
21
uint32_t vl = env->vl; \
22
+ uint32_t esz = sizeof(ETYPE); \
23
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
24
+ uint32_t vta = vext_vta(desc); \
25
target_ulong offset = s1, i_min, i; \
26
\
27
i_min = MAX(env->vstart, offset); \
28
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
29
} \
30
*((ETYPE *)vd + H(i)) = *((ETYPE *)vs2 + H(i - offset)); \
31
} \
32
+ /* set tail elements to 1s */ \
33
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
34
}
35
36
/* vslideup.vx vd, vs2, rs1, vm # vd[i+rs1] = vs2[i] */
37
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
38
uint32_t vlmax = vext_max_elems(desc, ctzl(sizeof(ETYPE))); \
39
uint32_t vm = vext_vm(desc); \
40
uint32_t vl = env->vl; \
41
+ uint32_t esz = sizeof(ETYPE); \
42
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
43
+ uint32_t vta = vext_vta(desc); \
44
target_ulong i_max, i; \
45
\
46
i_max = MAX(MIN(s1 < vlmax ? vlmax - s1 : 0, vl), env->vstart); \
47
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
48
} \
49
\
50
env->vstart = 0; \
51
+ /* set tail elements to 1s */ \
52
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
53
}
54
55
/* vslidedown.vx vd, vs2, rs1, vm # vd[i] = vs2[i+rs1] */
56
@@ -XXX,XX +XXX,XX @@ static void vslide1up_##BITWIDTH(void *vd, void *v0, target_ulong s1, \
57
typedef uint##BITWIDTH##_t ETYPE; \
58
uint32_t vm = vext_vm(desc); \
59
uint32_t vl = env->vl; \
60
+ uint32_t esz = sizeof(ETYPE); \
61
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
62
+ uint32_t vta = vext_vta(desc); \
63
uint32_t i; \
64
\
65
for (i = env->vstart; i < vl; i++) { \
66
@@ -XXX,XX +XXX,XX @@ static void vslide1up_##BITWIDTH(void *vd, void *v0, target_ulong s1, \
67
} \
68
} \
69
env->vstart = 0; \
70
+ /* set tail elements to 1s */ \
71
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
72
}
73
74
GEN_VEXT_VSLIE1UP(8, H1)
75
@@ -XXX,XX +XXX,XX @@ static void vslide1down_##BITWIDTH(void *vd, void *v0, target_ulong s1, \
76
typedef uint##BITWIDTH##_t ETYPE; \
77
uint32_t vm = vext_vm(desc); \
78
uint32_t vl = env->vl; \
79
+ uint32_t esz = sizeof(ETYPE); \
80
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
81
+ uint32_t vta = vext_vta(desc); \
82
uint32_t i; \
83
\
84
for (i = env->vstart; i < vl; i++) { \
85
@@ -XXX,XX +XXX,XX @@ static void vslide1down_##BITWIDTH(void *vd, void *v0, target_ulong s1, \
86
} \
87
} \
88
env->vstart = 0; \
89
+ /* set tail elements to 1s */ \
90
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
91
}
92
93
GEN_VEXT_VSLIDE1DOWN(8, H1)
94
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
95
uint32_t vlmax = vext_max_elems(desc, ctzl(sizeof(TS2))); \
96
uint32_t vm = vext_vm(desc); \
97
uint32_t vl = env->vl; \
98
+ uint32_t esz = sizeof(TS2); \
99
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
100
+ uint32_t vta = vext_vta(desc); \
101
uint64_t index; \
102
uint32_t i; \
103
\
104
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
105
} \
106
} \
107
env->vstart = 0; \
108
+ /* set tail elements to 1s */ \
109
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
110
}
111
112
/* vd[i] = (vs1[i] >= VLMAX) ? 0 : vs2[vs1[i]]; */
113
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
114
uint32_t vlmax = vext_max_elems(desc, ctzl(sizeof(ETYPE))); \
115
uint32_t vm = vext_vm(desc); \
116
uint32_t vl = env->vl; \
117
+ uint32_t esz = sizeof(ETYPE); \
118
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
119
+ uint32_t vta = vext_vta(desc); \
120
uint64_t index = s1; \
121
uint32_t i; \
122
\
123
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, target_ulong s1, void *vs2, \
124
} \
125
} \
126
env->vstart = 0; \
127
+ /* set tail elements to 1s */ \
128
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
129
}
130
131
/* vd[i] = (x[rs1] >= VLMAX) ? 0 : vs2[rs1] */
132
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
133
CPURISCVState *env, uint32_t desc) \
134
{ \
135
uint32_t vl = env->vl; \
136
+ uint32_t esz = sizeof(ETYPE); \
137
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
138
+ uint32_t vta = vext_vta(desc); \
139
uint32_t num = 0, i; \
140
\
141
for (i = env->vstart; i < vl; i++) { \
142
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, void *vs2, \
143
num++; \
144
} \
145
env->vstart = 0; \
146
+ /* set tail elements to 1s */ \
147
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
148
}
149
150
/* Compress into vd elements of vs2 where vs1 is enabled */
151
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, \
152
{ \
153
uint32_t vl = env->vl; \
154
uint32_t vm = vext_vm(desc); \
155
+ uint32_t esz = sizeof(ETYPE); \
156
+ uint32_t total_elems = vext_get_total_elems(env, desc, esz); \
157
+ uint32_t vta = vext_vta(desc); \
158
uint32_t i; \
159
\
160
for (i = env->vstart; i < vl; i++) { \
161
@@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *v0, void *vs2, \
162
*((ETYPE *)vd + HD(i)) = *((DTYPE *)vs2 + HS1(i)); \
163
} \
164
env->vstart = 0; \
165
+ /* set tail elements to 1s */ \
166
+ vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz); \
167
}
168
169
GEN_VEXT_INT_EXT(vzext_vf2_h, uint16_t, uint8_t, H2, H1)
170
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
171
index XXXXXXX..XXXXXXX 100644
172
--- a/target/riscv/insn_trans/trans_rvv.c.inc
173
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
174
@@ -XXX,XX +XXX,XX @@ static bool trans_vrgather_vx(DisasContext *s, arg_rmrr *a)
175
return false;
21
}
176
}
22
177
23
- if (mode == PRV_M && access_type != MMU_INST_FETCH) {
178
- if (a->vm && s->vl_eq_vlmax) {
24
+ /* MPRV does not affect the virtual-machine load/store
179
+ if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
25
+ instructions, HLV, HLVX, and HSV. */
180
int scale = s->lmul - (s->sew + 3);
26
+ if (riscv_cpu_two_stage_lookup(mmu_idx)) {
181
int vlmax = s->cfg_ptr->vlen >> -scale;
27
+ mode = get_field(env->hstatus, HSTATUS_SPVP);
182
TCGv_i64 dest = tcg_temp_new_i64();
28
+ } else if (mode == PRV_M && access_type != MMU_INST_FETCH) {
183
@@ -XXX,XX +XXX,XX @@ static bool trans_vrgather_vi(DisasContext *s, arg_rmrr *a)
29
if (get_field(env->mstatus, MSTATUS_MPRV)) {
184
return false;
30
mode = get_field(env->mstatus, MSTATUS_MPP);
31
}
32
@@ -XXX,XX +XXX,XX @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
33
qemu_log_mask(CPU_LOG_MMU, "%s ad %" VADDR_PRIx " rw %d mmu_idx %d\n",
34
__func__, address, access_type, mmu_idx);
35
36
- if (mode == PRV_M && access_type != MMU_INST_FETCH) {
37
- if (get_field(env->mstatus, MSTATUS_MPRV)) {
38
- mode = get_field(env->mstatus, MSTATUS_MPP);
39
+ /* MPRV does not affect the virtual-machine load/store
40
+ instructions, HLV, HLVX, and HSV. */
41
+ if (riscv_cpu_two_stage_lookup(mmu_idx)) {
42
+ mode = get_field(env->hstatus, HSTATUS_SPVP);
43
+ } else if (mode == PRV_M && access_type != MMU_INST_FETCH &&
44
+ get_field(env->mstatus, MSTATUS_MPRV)) {
45
+ mode = get_field(env->mstatus, MSTATUS_MPP);
46
+ if (riscv_has_ext(env, RVH) && get_field(env->mstatus, MSTATUS_MPV)) {
47
+ two_stage_lookup = true;
48
}
49
}
185
}
50
186
51
- if (riscv_has_ext(env, RVH) && env->priv == PRV_M &&
187
- if (a->vm && s->vl_eq_vlmax) {
52
- access_type != MMU_INST_FETCH &&
188
+ if (a->vm && s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
53
- get_field(env->mstatus, MSTATUS_MPRV) &&
189
int scale = s->lmul - (s->sew + 3);
54
- get_field(env->mstatus, MSTATUS_MPV)) {
190
int vlmax = s->cfg_ptr->vlen >> -scale;
55
- two_stage_lookup = true;
191
if (a->rs1 >= vlmax) {
56
- }
192
@@ -XXX,XX +XXX,XX @@ static bool trans_vcompress_vm(DisasContext *s, arg_r *a)
57
-
193
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_vl, 0, over);
58
if (riscv_cpu_virt_enabled(env) ||
194
59
((riscv_cpu_two_stage_lookup(mmu_idx) || two_stage_lookup) &&
195
data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
60
access_type != MMU_INST_FETCH)) {
196
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
197
tcg_gen_gvec_4_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0),
198
vreg_ofs(s, a->rs1), vreg_ofs(s, a->rs2),
199
cpu_env, s->cfg_ptr->vlen / 8,
200
@@ -XXX,XX +XXX,XX @@ static bool int_ext_op(DisasContext *s, arg_rmr *a, uint8_t seq)
201
}
202
203
data = FIELD_DP32(data, VDATA, VM, a->vm);
204
+ data = FIELD_DP32(data, VDATA, LMUL, s->lmul);
205
+ data = FIELD_DP32(data, VDATA, VTA, s->vta);
206
207
tcg_gen_gvec_3_ptr(vreg_ofs(s, a->rd), vreg_ofs(s, 0),
208
vreg_ofs(s, a->rs2), cpu_env,
61
--
209
--
62
2.30.1
210
2.36.1
63
64
diff view generated by jsdifflib
1
From: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
1
From: eopXD <eop.chen@sifive.com>
2
2
3
The current condition for the use of background registers only
3
According to v-spec, tail agnostic behavior can be either kept as
4
considers the hypervisor load and store instructions,
4
undisturbed or set elements' bits to all 1s. To distinguish the
5
but not accesses from M mode via MSTATUS_MPRV+MPV.
5
difference of tail policies, QEMU should be able to simulate the tail
6
agnostic behavior as "set tail elements' bits to all 1s".
6
7
7
Signed-off-by: Georg Kotheimer <georg.kotheimer@kernkonzept.com>
8
There are multiple possibility for agnostic elements according to
9
v-spec. The main intent of this patch-set tries to add option that
10
can distinguish between tail policies. Setting agnostic elements to
11
all 1s allows QEMU to express this.
12
13
This commit adds option 'rvv_ta_all_1s' is added to enable the
14
behavior, it is default as disabled.
15
16
Signed-off-by: eop Chen <eop.chen@sifive.com>
17
Reviewed-by: Frank Chang <frank.chang@sifive.com>
18
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
19
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 20210311103036.1401073-1-georg.kotheimer@kernkonzept.com
20
Message-Id: <165449614532.19704.7000832880482980398-16@git.sr.ht>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
21
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
22
---
12
target/riscv/cpu_helper.c | 2 +-
23
target/riscv/cpu.c | 2 ++
13
1 file changed, 1 insertion(+), 1 deletion(-)
24
1 file changed, 2 insertions(+)
14
25
15
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
26
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
16
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
17
--- a/target/riscv/cpu_helper.c
28
--- a/target/riscv/cpu.c
18
+++ b/target/riscv/cpu_helper.c
29
+++ b/target/riscv/cpu.c
19
@@ -XXX,XX +XXX,XX @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
30
@@ -XXX,XX +XXX,XX @@ static Property riscv_cpu_properties[] = {
20
* was called. Background registers will be used if the guest has
31
DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC),
21
* forced a two stage translation to be on (in HS or M mode).
32
22
*/
33
DEFINE_PROP_BOOL("short-isa-string", RISCVCPU, cfg.short_isa_string, false),
23
- if (!riscv_cpu_virt_enabled(env) && riscv_cpu_two_stage_lookup(mmu_idx)) {
34
+
24
+ if (!riscv_cpu_virt_enabled(env) && two_stage) {
35
+ DEFINE_PROP_BOOL("rvv_ta_all_1s", RISCVCPU, cfg.rvv_ta_all_1s, false),
25
use_background = true;
36
DEFINE_PROP_END_OF_LIST(),
26
}
37
};
27
38
28
--
39
--
29
2.30.1
40
2.36.1
30
31
diff view generated by jsdifflib
1
From: Frank Chang <frank.chang@sifive.com>
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
vs() should return -RISCV_EXCP_ILLEGAL_INST instead of -1 if rvv feature
3
There are currently two types of RISC-V CPUs:
4
is not enabled.
4
- Generic CPUs (base or any) that allow complete custimisation
5
- "Named" CPUs that match existing hardware
5
6
6
If -1 is returned, exception will be raised and cs->exception_index will
7
Users can use the base CPUs to custimise the extensions that they want, for
7
be set to the negative return value. The exception will then be treated
8
example -cpu rv64,v=true.
8
as an instruction access fault instead of illegal instruction fault.
9
9
10
Signed-off-by: Frank Chang <frank.chang@sifive.com>
10
We originally exposed these as part of the named CPUs as well, but that was
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
by accident.
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
13
Message-id: 20210223065935.20208-1-frank.chang@sifive.com
13
Exposing the CPU properties to named CPUs means that we accidently
14
enable extensions that don't exist on the CPUs by default. For example
15
the SiFive E CPU currently support the zba extension, which is a bug.
16
17
This patch instead only exposes the CPU extensions to the generic CPUs.
18
19
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
20
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
21
Message-Id: <20220608061437.314434-1-alistair.francis@opensource.wdc.com>
14
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
22
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
---
23
---
16
target/riscv/csr.c | 2 +-
24
target/riscv/cpu.c | 57 +++++++++++++++++++++++++++++++++++++---------
17
1 file changed, 1 insertion(+), 1 deletion(-)
25
1 file changed, 46 insertions(+), 11 deletions(-)
18
26
19
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
27
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
20
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
21
--- a/target/riscv/csr.c
29
--- a/target/riscv/cpu.c
22
+++ b/target/riscv/csr.c
30
+++ b/target/riscv/cpu.c
23
@@ -XXX,XX +XXX,XX @@ static int vs(CPURISCVState *env, int csrno)
31
@@ -XXX,XX +XXX,XX @@ static const char * const riscv_intr_names[] = {
24
if (env->misa & RVV) {
32
"reserved"
25
return 0;
33
};
26
}
34
27
- return -1;
35
+static void register_cpu_props(DeviceState *dev);
28
+ return -RISCV_EXCP_ILLEGAL_INST;
36
+
37
const char *riscv_cpu_get_trap_name(target_ulong cause, bool async)
38
{
39
if (async) {
40
@@ -XXX,XX +XXX,XX @@ static void riscv_any_cpu_init(Object *obj)
41
set_misa(env, MXL_RV64, RVI | RVM | RVA | RVF | RVD | RVC | RVU);
42
#endif
43
set_priv_version(env, PRIV_VERSION_1_12_0);
44
+ register_cpu_props(DEVICE(obj));
29
}
45
}
30
46
31
static int ctr(CPURISCVState *env, int csrno)
47
#if defined(TARGET_RISCV64)
48
@@ -XXX,XX +XXX,XX @@ static void rv64_base_cpu_init(Object *obj)
49
CPURISCVState *env = &RISCV_CPU(obj)->env;
50
/* We set this in the realise function */
51
set_misa(env, MXL_RV64, 0);
52
+ register_cpu_props(DEVICE(obj));
53
}
54
55
static void rv64_sifive_u_cpu_init(Object *obj)
56
@@ -XXX,XX +XXX,XX @@ static void rv64_sifive_u_cpu_init(Object *obj)
57
static void rv64_sifive_e_cpu_init(Object *obj)
58
{
59
CPURISCVState *env = &RISCV_CPU(obj)->env;
60
+ RISCVCPU *cpu = RISCV_CPU(obj);
61
+
62
set_misa(env, MXL_RV64, RVI | RVM | RVA | RVC | RVU);
63
set_priv_version(env, PRIV_VERSION_1_10_0);
64
- qdev_prop_set_bit(DEVICE(obj), "mmu", false);
65
+ cpu->cfg.mmu = false;
66
}
67
68
static void rv128_base_cpu_init(Object *obj)
69
@@ -XXX,XX +XXX,XX @@ static void rv128_base_cpu_init(Object *obj)
70
CPURISCVState *env = &RISCV_CPU(obj)->env;
71
/* We set this in the realise function */
72
set_misa(env, MXL_RV128, 0);
73
+ register_cpu_props(DEVICE(obj));
74
}
75
#else
76
static void rv32_base_cpu_init(Object *obj)
77
@@ -XXX,XX +XXX,XX @@ static void rv32_base_cpu_init(Object *obj)
78
CPURISCVState *env = &RISCV_CPU(obj)->env;
79
/* We set this in the realise function */
80
set_misa(env, MXL_RV32, 0);
81
+ register_cpu_props(DEVICE(obj));
82
}
83
84
static void rv32_sifive_u_cpu_init(Object *obj)
85
@@ -XXX,XX +XXX,XX @@ static void rv32_sifive_u_cpu_init(Object *obj)
86
static void rv32_sifive_e_cpu_init(Object *obj)
87
{
88
CPURISCVState *env = &RISCV_CPU(obj)->env;
89
+ RISCVCPU *cpu = RISCV_CPU(obj);
90
+
91
set_misa(env, MXL_RV32, RVI | RVM | RVA | RVC | RVU);
92
set_priv_version(env, PRIV_VERSION_1_10_0);
93
- qdev_prop_set_bit(DEVICE(obj), "mmu", false);
94
+ cpu->cfg.mmu = false;
95
}
96
97
static void rv32_ibex_cpu_init(Object *obj)
98
{
99
CPURISCVState *env = &RISCV_CPU(obj)->env;
100
+ RISCVCPU *cpu = RISCV_CPU(obj);
101
+
102
set_misa(env, MXL_RV32, RVI | RVM | RVC | RVU);
103
set_priv_version(env, PRIV_VERSION_1_10_0);
104
- qdev_prop_set_bit(DEVICE(obj), "mmu", false);
105
- qdev_prop_set_bit(DEVICE(obj), "x-epmp", true);
106
+ cpu->cfg.mmu = false;
107
+ cpu->cfg.epmp = true;
108
}
109
110
static void rv32_imafcu_nommu_cpu_init(Object *obj)
111
{
112
CPURISCVState *env = &RISCV_CPU(obj)->env;
113
+ RISCVCPU *cpu = RISCV_CPU(obj);
114
+
115
set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVC | RVU);
116
set_priv_version(env, PRIV_VERSION_1_10_0);
117
set_resetvec(env, DEFAULT_RSTVEC);
118
- qdev_prop_set_bit(DEVICE(obj), "mmu", false);
119
+ cpu->cfg.mmu = false;
120
}
121
#endif
122
123
@@ -XXX,XX +XXX,XX @@ static void riscv_host_cpu_init(Object *obj)
124
#elif defined(TARGET_RISCV64)
125
set_misa(env, MXL_RV64, 0);
126
#endif
127
+ register_cpu_props(DEVICE(obj));
128
}
129
#endif
130
131
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_init(Object *obj)
132
{
133
RISCVCPU *cpu = RISCV_CPU(obj);
134
135
+ cpu->cfg.ext_counters = true;
136
+ cpu->cfg.ext_ifencei = true;
137
+ cpu->cfg.ext_icsr = true;
138
+ cpu->cfg.mmu = true;
139
+ cpu->cfg.pmp = true;
140
+
141
cpu_set_cpustate_pointers(cpu);
142
143
#ifndef CONFIG_USER_ONLY
144
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_init(Object *obj)
145
#endif /* CONFIG_USER_ONLY */
146
}
147
148
-static Property riscv_cpu_properties[] = {
149
+static Property riscv_cpu_extensions[] = {
150
/* Defaults for standard extensions */
151
DEFINE_PROP_BOOL("i", RISCVCPU, cfg.ext_i, true),
152
DEFINE_PROP_BOOL("e", RISCVCPU, cfg.ext_e, false),
153
@@ -XXX,XX +XXX,XX @@ static Property riscv_cpu_properties[] = {
154
DEFINE_PROP_BOOL("Zve64f", RISCVCPU, cfg.ext_zve64f, false),
155
DEFINE_PROP_BOOL("mmu", RISCVCPU, cfg.mmu, true),
156
DEFINE_PROP_BOOL("pmp", RISCVCPU, cfg.pmp, true),
157
- DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true),
158
159
DEFINE_PROP_STRING("priv_spec", RISCVCPU, cfg.priv_spec),
160
DEFINE_PROP_STRING("vext_spec", RISCVCPU, cfg.vext_spec),
161
DEFINE_PROP_UINT16("vlen", RISCVCPU, cfg.vlen, 128),
162
DEFINE_PROP_UINT16("elen", RISCVCPU, cfg.elen, 64),
163
164
- DEFINE_PROP_UINT32("mvendorid", RISCVCPU, cfg.mvendorid, 0),
165
- DEFINE_PROP_UINT64("marchid", RISCVCPU, cfg.marchid, RISCV_CPU_MARCHID),
166
- DEFINE_PROP_UINT64("mimpid", RISCVCPU, cfg.mimpid, RISCV_CPU_MIMPID),
167
-
168
DEFINE_PROP_BOOL("svinval", RISCVCPU, cfg.ext_svinval, false),
169
DEFINE_PROP_BOOL("svnapot", RISCVCPU, cfg.ext_svnapot, false),
170
DEFINE_PROP_BOOL("svpbmt", RISCVCPU, cfg.ext_svpbmt, false),
171
@@ -XXX,XX +XXX,XX @@ static Property riscv_cpu_properties[] = {
172
DEFINE_PROP_BOOL("x-epmp", RISCVCPU, cfg.epmp, false),
173
DEFINE_PROP_BOOL("x-aia", RISCVCPU, cfg.aia, false),
174
175
+ DEFINE_PROP_END_OF_LIST(),
176
+};
177
+
178
+static void register_cpu_props(DeviceState *dev)
179
+{
180
+ Property *prop;
181
+
182
+ for (prop = riscv_cpu_extensions; prop && prop->name; prop++) {
183
+ qdev_property_add_static(dev, prop);
184
+ }
185
+}
186
+
187
+static Property riscv_cpu_properties[] = {
188
+ DEFINE_PROP_BOOL("debug", RISCVCPU, cfg.debug, true),
189
+
190
+ DEFINE_PROP_UINT32("mvendorid", RISCVCPU, cfg.mvendorid, 0),
191
+ DEFINE_PROP_UINT64("marchid", RISCVCPU, cfg.marchid, RISCV_CPU_MARCHID),
192
+ DEFINE_PROP_UINT64("mimpid", RISCVCPU, cfg.mimpid, RISCV_CPU_MIMPID),
193
+
194
DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC),
195
196
DEFINE_PROP_BOOL("short-isa-string", RISCVCPU, cfg.short_isa_string, false),
32
--
197
--
33
2.30.1
198
2.36.1
34
35
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
Per SST25VF016B datasheet [1], SST flash requires a dummy byte after
3
When running a 32-bit guest, with a e64 vmv.v.x and vl_eq_vlmax set to
4
the address bytes. Note only SPI mode is supported by SST flashes.
4
true the `tcg_debug_assert(vece <= MO_32)` will be triggered inside
5
tcg_gen_gvec_dup_i32().
5
6
6
[1] http://ww1.microchip.com/downloads/en/devicedoc/s71271_04.pdf
7
This patch checks that condition and instead uses tcg_gen_gvec_dup_i64()
8
is required.
7
9
8
Signed-off-by: Bin Meng <bin.meng@windriver.com>
10
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1028
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
11
Suggested-by: Robert Bu <robert.bu@gmail.com>
10
Message-id: 20210306060152.7250-1-bmeng.cn@gmail.com
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-Id: <20220608234701.369536-1-alistair.francis@opensource.wdc.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
15
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
16
---
13
hw/block/m25p80.c | 3 +++
17
target/riscv/insn_trans/trans_rvv.c.inc | 12 ++++++++++--
14
1 file changed, 3 insertions(+)
18
1 file changed, 10 insertions(+), 2 deletions(-)
15
19
16
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
20
diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc
17
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/block/m25p80.c
22
--- a/target/riscv/insn_trans/trans_rvv.c.inc
19
+++ b/hw/block/m25p80.c
23
+++ b/target/riscv/insn_trans/trans_rvv.c.inc
20
@@ -XXX,XX +XXX,XX @@ static void decode_fast_read_cmd(Flash *s)
24
@@ -XXX,XX +XXX,XX @@ static bool trans_vmv_v_x(DisasContext *s, arg_vmv_v_x *a)
21
s->needed_bytes = get_addr_length(s);
25
s1 = get_gpr(s, a->rs1, EXT_SIGN);
22
switch (get_man(s)) {
26
23
/* Dummy cycles - modeled with bytes writes instead of bits */
27
if (s->vl_eq_vlmax && !(s->vta && s->lmul < 0)) {
24
+ case MAN_SST:
28
- tcg_gen_gvec_dup_tl(s->sew, vreg_ofs(s, a->rd),
25
+ s->needed_bytes += 1;
29
- MAXSZ(s), MAXSZ(s), s1);
26
+ break;
30
+ if (get_xl(s) == MXL_RV32 && s->sew == MO_64) {
27
case MAN_WINBOND:
31
+ TCGv_i64 s1_i64 = tcg_temp_new_i64();
28
s->needed_bytes += 8;
32
+ tcg_gen_ext_tl_i64(s1_i64, s1);
29
break;
33
+ tcg_gen_gvec_dup_i64(s->sew, vreg_ofs(s, a->rd),
34
+ MAXSZ(s), MAXSZ(s), s1_i64);
35
+ tcg_temp_free_i64(s1_i64);
36
+ } else {
37
+ tcg_gen_gvec_dup_tl(s->sew, vreg_ofs(s, a->rd),
38
+ MAXSZ(s), MAXSZ(s), s1);
39
+ }
40
} else {
41
TCGv_i32 desc;
42
TCGv_i64 s1_i64 = tcg_temp_new_i64();
30
--
43
--
31
2.30.1
44
2.36.1
32
33
diff view generated by jsdifflib