Re: [Qemu-devel] [RFC 01/23] scripts: Add decodetree.py

2018-01-13 Thread Bastian Koppelmann
Hi Richard, +# Field examples: +# +# %disp 0:s16 -- sextract(i, 0, 16) +# %imm9 16:6 10:3 -- extract(i, 16, 6) << 3 | extract(i, 10, 3) startindex:endindex for unnamed_field is more intuitive. As any ISA manual would specify those. +# +# It is recommended, but not required,

Re: [Qemu-devel] [PATCH 15/24] tricore: cpu: add TARGET_DEFAULT_CPU_TYPE macro

2018-01-17 Thread Bastian Koppelmann
nstead of cpu_model. > > Signed-off-by: Igor Mammedov > --- > CC: Bastian Koppelmann > --- > target/tricore/cpu.h | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Bastian Koppelmann Cheers, Bastian

[Qemu-devel] [Bug 1794939] Re: QEMU does not build with vte v2.91

2018-11-07 Thread Bastian Koppelmann
Hi Berg, thanks for the tip, a fix has also been commited already :) Cheers, Bastian ** Changed in: qemu Status: New => Fix Committed -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1794939 T

[Qemu-devel] [PATCH 1/2] target/riscv: Fix FCLASS_D being treated as RV64 only

2018-11-08 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann --- target/riscv/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 18d7b6d147..5359088e24 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1237,13

[Qemu-devel] [PATCH 0/2] target/riscv: Bugfixes found in decodetree conversion

2018-11-08 Thread Bastian Koppelmann
Hi, while going through the reviews of the riscv-decodetree patches, two bugs came up that I fix here. There is one more problem [1] mentioned by Richard but I don't have the time to investigate it further. [1] https://patchwork.kernel.org/patch/10650293/ Bastian Koppelmann (2): target/

[Qemu-devel] [PATCH 2/2] target/riscv: Fix sfence.vm/a both available in any priv version

2018-11-08 Thread Bastian Koppelmann
sfence.vm has been replaced in priv v1.10 spec by sfence.vma. Reported-by: Richard Henderson Signed-off-by: Bastian Koppelmann --- target/riscv/translate.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv

Re: [Qemu-devel] [PATCH 0/2] target/riscv: Bugfixes found in decodetree conversion

2018-11-08 Thread Bastian Koppelmann
On 11/8/18 4:53 PM, Richard Henderson wrote: On 11/8/18 1:06 PM, Bastian Koppelmann wrote: while going through the reviews of the riscv-decodetree patches, two bugs came up that I fix here. There is one more problem [1] mentioned by Richard but I don't have the time to investigate it fu

[Qemu-devel] [PATCH 03/28] target/riscv: Convert RVXI load/store insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 15 ++ target/riscv/insn_trans/trans_rvi.inc.c | 71 + target/riscv/translate.c| 7 --- 3 files changed, 86 insertions(+), 7 deletions(-) diff

[Qemu-devel] [PATCH 06/28] target/riscv: Convert RVXI csr insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 8 +++ target/riscv/insn_trans/trans_rvi.inc.c | 79 + target/riscv/translate.c| 43 +- 3 files changed, 88 insertions(+), 42 deletions

[Qemu-devel] [PATCH 08/28] target/riscv: Convert RV32A insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 17 +++ target/riscv/insn_trans/trans_rva.inc.c | 175 target/riscv/translate.c| 1 + 3 files changed, 193 insertions(+) create mode 100644

[Qemu-devel] [PATCH 00/28] target/riscv: Convert to decodetree

2018-10-12 Thread Bastian Koppelmann
l tree can be found here: https://github.com/bkoppelmann/qemu/tree/riscv-dt Cheers, Bastian Bastian Koppelmann (28): targer/riscv: Activate decodetree and implemnt LUI & AUIPC target/riscv: Convert RVXI branch insns to decodetree target/riscv: Convert RVXI load/store insns to decodetree

[Qemu-devel] [PATCH 05/28] target/riscv: Convert RVXI fence insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 8 target/riscv/insn_trans/trans_rvi.inc.c | 20 target/riscv/translate.c| 14 -- 3 files changed, 28 insertions(+), 14 deletions

[Qemu-devel] [PATCH 18/28] target/riscv: Remove gen_jalr()

2018-10-12 Thread Bastian Koppelmann
trans_jalr() is the only caller, so move the code into trans_jalr(). Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 27 +- target/riscv/translate.c| 38 - 2 files changed, 26

[Qemu-devel] [PATCH 04/28] target/riscv: Convert RVXI arithmetic insns to decodetree

2018-10-12 Thread Bastian Koppelmann
we cannot remove the call to gen_arith() in decode_RV32_64G() since it is used to translate multiply instructions. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 36 target/riscv/insn_trans/trans_rvi.inc.c | 221

[Qemu-devel] [PATCH 02/28] target/riscv: Convert RVXI branch insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 19 + target/riscv/insn_trans/trans_rvi.inc.c | 52 + target/riscv/translate.c| 19 + 3 files changed, 72 insertions(+), 18 deletions

[Qemu-devel] [PATCH 14/28] target/riscv: Convert RV priv insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode| 13 ++ .../riscv/insn_trans/trans_privileged.inc.c | 111 ++ target/riscv/translate.c | 49 +--- 3 files changed, 125 insertions(+), 48

[Qemu-devel] [PATCH 19/28] target/riscv: Replace gen_branch() with trans_branch()

2018-10-12 Thread Bastian Koppelmann
The latter utilizes argument-sets of decodetree such that no manual decoding is necessary as in gen_branch(). Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 56 + target/riscv/translate.c| 47

[Qemu-devel] [PATCH 01/28] targer/riscv: Activate decodetree and implemnt LUI & AUIPC

2018-10-12 Thread Bastian Koppelmann
for now only LUI & AUIPC are decoded and translated. If decodetree fails, we falls back to the old decoder. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/Makefile.objs | 10 +++ target/riscv/insn32.decode

[Qemu-devel] [PATCH 07/28] target/riscv: Convert RVXM insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 17 + target/riscv/insn_trans/trans_rvm.inc.c | 87 + target/riscv/translate.c| 10 +-- 3 files changed, 105 insertions(+), 9 deletions

[Qemu-devel] [PATCH 13/28] target/riscv: Convert RV64D insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 8 + target/riscv/insn_trans/trans_rvd.inc.c | 94 + target/riscv/translate.c| 484 +--- 3 files changed, 103 insertions(+), 483 deletions

[Qemu-devel] [PATCH 24/28] target/riscv: Remove shift and slt insn manual decoding

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 79 + target/riscv/translate.c| 59 ++ 2 files changed, 86 insertions(+), 52 deletions(-) diff --git a/target/riscv/insn_trans

[Qemu-devel] [PATCH 11/28] target/riscv: Convert RV64F insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 6 +++ target/riscv/insn_trans/trans_rvf.inc.c | 70 + 2 files changed, 76 insertions(+) diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode index

[Qemu-devel] [PATCH 12/28] target/riscv: Convert RV32D insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 28 +++ target/riscv/insn_trans/trans_rvd.inc.c | 313 target/riscv/translate.c| 1 + 3 files changed, 342 insertions(+) create mode 100644

[Qemu-devel] [PATCH 10/28] target/riscv: Convert RV32F insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 35 +++ target/riscv/insn_trans/trans_rvf.inc.c | 326 target/riscv/translate.c| 1 + 3 files changed, 362 insertions(+) create mode 100644

[Qemu-devel] [PATCH 17/28] target/riscv: Convert quadrant 2 of RVXC insns to decodetree

2018-10-12 Thread Bastian Koppelmann
This also removes all functions that now became obsolete. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn16.decode | 34 +- target/riscv/insn_trans/trans_rvc.inc.c | 107 + target/riscv/translate.c| 151

[Qemu-devel] [PATCH 20/28] target/riscv: Replace gen_load() with trans_load()

2018-10-12 Thread Bastian Koppelmann
With decodetree we don't need to convert RISC-V opcodes into to MemOps as gen_load() did. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 44 + target/riscv/translate.c| 20 --- 2

[Qemu-devel] [PATCH 09/28] target/riscv: Convert RV64A insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 13 +++ target/riscv/insn_trans/trans_rva.inc.c | 99 + target/riscv/translate.c| 140 3 files changed, 112 insertions(+), 140

[Qemu-devel] [PATCH 22/28] target/riscv: Move gen_arith_imm() decoding into trans_* functions

2018-10-12 Thread Bastian Koppelmann
gen_arith_imm() does a lot of decoding manually, which was hard to read in case of the shift instructions and is not necessary anymore with decodetree. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 3 +- target/riscv/insn_trans

[Qemu-devel] [PATCH 15/28] target/riscv: Convert quadrant 0 of RVXC insns to decodetree

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/Makefile.objs | 9 ++- target/riscv/insn16.decode | 55 +++ target/riscv/insn_trans/trans_rvc.inc.c | 89 + target/riscv/translate.c| 88

[Qemu-devel] [PATCH 26/28] target/riscv: Remove gen_system()

2018-10-12 Thread Bastian Koppelmann
with all 16 bit insns moved to decodetree no path is falling back to gen_system(), so we can remove it. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/translate.c | 32 1 file changed, 32 deletions(-) diff --git a/target/riscv

[Qemu-devel] [PATCH 21/28] target/riscv: Replace gen_store() with trans_store()

2018-10-12 Thread Bastian Koppelmann
With decodetree we don't need to convert RISC-V opcodes into to MemOps as gen_store() did. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 31 -- target/riscv/translate.c

[Qemu-devel] [PATCH 27/28] target/riscv: Remove decode_RV32_64G()

2018-10-12 Thread Bastian Koppelmann
decodetree handles all instructions now so the fallback is not necessary anymore. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/translate.c | 23 --- 1 file changed, 23 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv

[Qemu-devel] [PATCH 23/28] target/riscv: make ADD/SUB/OR/XOR/AND insn use arg lists

2018-10-12 Thread Bastian Koppelmann
manual decoding in gen_arith() is not necessary with decodetree. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 3 ++- target/riscv/insn_trans/trans_rvi.inc.c | 21 ++-- target/riscv/translate.c| 33

[Qemu-devel] [PATCH 25/28] target/riscv: Remove manual decoding of RV32/64M insn

2018-10-12 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvm.inc.c | 55 ++--- target/riscv/translate.c| 266 +++- 2 files changed, 151 insertions(+), 170 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvm.inc.c

[Qemu-devel] [PATCH 28/28] target/riscv: Replace gen_exception_illegal with return false

2018-10-12 Thread Bastian Koppelmann
return false in trans_* instructions is no longer used as a fallback to the old decoder. We can therefore now use 'return false' to indicate an illegal instruction. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- .../riscv/insn_trans/trans_privileged.inc.c | 6 ++--

Re: [Qemu-devel] [PATCH 04/28] target/riscv: Convert RVXI arithmetic insns to decodetree

2018-10-19 Thread Bastian Koppelmann
Hi Richard, On 10/12/18 8:46 PM, Richard Henderson wrote: On 10/12/18 10:30 AM, Bastian Koppelmann wrote: +static bool trans_andi(DisasContext *ctx, arg_andi *a, uint32_t insn) +{ +gen_arith_imm(ctx, OPC_RISC_ANDI, a->rd, a->rs1, a->imm); +return true; +} +static bool t

Re: [Qemu-devel] [PATCH 15/28] target/riscv: Convert quadrant 0 of RVXC insns to decodetree

2018-10-19 Thread Bastian Koppelmann
On 10/13/18 8:18 PM, Richard Henderson wrote: On 10/12/18 10:30 AM, Bastian Koppelmann wrote: +# Argument sets: +&cl rs1 rd +&cl_dw uimm rs1 rd +&ciw nzuimm rd +&cs rs1 rs2 +&cs_dw uimm rs1 rs2 I guess this is good enou

Re: [Qemu-devel] [PATCH 16/28] target/riscv: Convert quadrant 1 of RVXC insns to decodetree

2018-10-19 Thread Bastian Koppelmann
On 10/13/18 8:53 PM, Richard Henderson wrote: Choose return false or raise exception. Except... I wonder if we might write this as int shamt = a->shamt; if (shamt == 0) { shamt = 64; } Good catch. I'll add a comment, that a shamt of 0 is intended for RV128. Cheers,

Re: [Qemu-devel] [PATCH 17/28] target/riscv: Convert quadrant 2 of RVXC insns to decodetree

2018-10-19 Thread Bastian Koppelmann
On 10/13/18 9:34 PM, Richard Henderson wrote: On 10/12/18 10:30 AM, Bastian Koppelmann wrote: +@c_flwsp_ldsp ... . . . .. &c_flwsp_ldsp uimm_flwsp=%uimm_6bit_lw \ +uimm_ldsp=%uimm_6bit_ld %rd +@c_fswsp_sdsp ... . . . .. &c_fswsp_sdsp uimm_fswsp=%uimm

Re: [Qemu-devel] [PATCH 16/28] target/riscv: Convert quadrant 1 of RVXC insns to decodetree

2018-10-19 Thread Bastian Koppelmann
On 10/13/18 8:53 PM, Richard Henderson wrote: On 10/12/18 10:30 AM, Bastian Koppelmann wrote: +static bool trans_c_addi(DisasContext *ctx, arg_c_addi *a, uint16_t insn) +{ +if (a->imm == 0) { +return true; +} return false, I think. Those are HINTS, which means

[Qemu-devel] [PATCH v2 10/29] target/riscv: Convert RV64A insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - use simplfied gen_amo() with function pointers target/riscv/insn32.decode | 13 +++ target/riscv/insn_trans/trans_rva.inc.c | 99 + target/ri

[Qemu-devel] [PATCH v2 03/29] target/riscv: Convert RVXI branch insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - use ctx->env instead of current_cpu->env_ptr target/riscv/insn32.decode | 19 ++ target/riscv/insn_trans/trans_rvi.inc.c | 49 + target/riscv/tr

[Qemu-devel] [PATCH v2 02/29] targer/riscv: Activate decodetree and implemnt LUI & AUIPC

2018-10-20 Thread Bastian Koppelmann
for now only LUI & AUIPC are decoded and translated. If decodetree fails, we fall back to the old decoder. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - ex_shift_amount returns uint32_t target/riscv/Makefi

[Qemu-devel] [PATCH v2 12/29] target/riscv: Convert RV64F insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - RISCV32 now returns false instead of raising an exception target/riscv/insn32.decode | 6 +++ target/riscv/insn_trans/trans_rvf.inc.c | 68 +

[Qemu-devel] [PATCH v2 00/29] target/riscv: Convert to decodetree

2018-10-20 Thread Bastian Koppelmann
- trans_shift -> gen_shift - Add missing TARGET_RISCV64 conditions - trans_arith_w -> gen_arith_w - Add missing gen_exception_illegal - dropped 0028 Bastian Koppelmann (29): target/riscv: Move CPURISCVState pointer to DisasContext targer/riscv: Activate dec

[Qemu-devel] [PATCH v2 08/29] target/riscv: Convert RVXM insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - fixed spacing target/riscv/insn32.decode | 17 + target/riscv/insn_trans/trans_rvm.inc.c | 98 + target/riscv/translate.c|

[Qemu-devel] [PATCH v2 15/29] target/riscv: Convert RV priv insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode| 15 +++ .../riscv/insn_trans/trans_privileged.inc.c | 111 ++ target/riscv/translate.c | 49 +--- 3 files

[Qemu-devel] [PATCH v2 04/29] target/riscv: Convert RVXI load/store insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - fixed spacing target/riscv/insn32.decode | 15 + target/riscv/insn_trans/trans_rvi.inc.c | 78 + target/riscv/translate.c|

[Qemu-devel] [PATCH v2 01/29] target/riscv: Move CPURISCVState pointer to DisasContext

2018-10-20 Thread Bastian Koppelmann
CPURISCVState is rarely used, so there is no need to pass it to every translate function. This paves the way for decodetree which only passes DisasContext to translate functions. Signed-off-by: Bastian Koppelmann --- target/riscv/translate.c | 15 --- 1 file changed, 8 insertions

[Qemu-devel] [PATCH v2 09/29] target/riscv: Convert RV32A insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - simplified gen_amo() with function pointers - rs2 @atom_ld is now decimal target/riscv/insn32.decode | 17 +++ target/riscv/insn_trans/trans_rva.inc.c | 145 target/ri

[Qemu-devel] [PATCH v2 07/29] target/riscv: Convert RVXI csr insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 9 +++ target/riscv/insn_trans/trans_rvi.inc.c | 79 + target/riscv/translate.c| 43 +- 3 files changed

[Qemu-devel] [PATCH v2 13/29] target/riscv: Convert RV32D insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - Add REQUIRE_FPU to arithm helpers target/riscv/insn32.decode | 28 +++ target/riscv/insn_trans/trans_rvd.inc.c | 319 target/riscv/translate.c| 1 + 3 fi

[Qemu-devel] [PATCH v2 05/29] target/riscv: Convert RVXI arithmetic insns to decodetree

2018-10-20 Thread Bastian Koppelmann
we cannot remove the call to gen_arith() in decode_RV32_64G() since it is used to translate multiply instructions. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - RISCV32 now returns false instead of raising an exception - shift translators now also

[Qemu-devel] [PATCH v2 06/29] target/riscv: Convert RVXI fence insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - simplified fence/fence_i as suggested by Richard target/riscv/insn32.decode | 6 ++ target/riscv/insn_trans/trans_rvi.inc.c | 20 target/riscv/translate.c|

[Qemu-devel] [PATCH v2 28/29] target/riscv: Remove decode_RV32_64G()

2018-10-20 Thread Bastian Koppelmann
decodetree handles all instructions now so the fallback is not necessary anymore. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - Add missing gen_exception_illegal target/riscv/translate.c | 24 +--- 1 file changed, 1 insertion(+),

[Qemu-devel] [PATCH v2 20/29] target/riscv: Remove manual decoding from gen_branch()

2018-10-20 Thread Bastian Koppelmann
We now utilizes argument-sets of decodetree such that no manual decoding is necessary. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - trans_branch -> gen_branch target/riscv/insn_trans/trans_rvi.inc.

[Qemu-devel] [PATCH v2 14/29] target/riscv: Convert RV64D insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn32.decode | 8 + target/riscv/insn_trans/trans_rvd.inc.c | 94 + target/riscv/translate.c| 484 +--- 3 files changed, 103

[Qemu-devel] [PATCH v2 11/29] target/riscv: Convert RV32F insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - REQUIRE_FPU uses do {} while (0) - Add REQUIRE_FPU to arithm helpers target/riscv/insn32.decode | 35 +++ target/riscv/insn_trans/trans_rvf.inc.c |

[Qemu-devel] [PATCH v2 26/29] target/riscv: Remove manual decoding of RV32/64M insn

2018-10-20 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - Add missing TARGET_RISCV64 conditions - trans_arith_w -> gen_arith_w target/riscv/insn_trans/trans_rvm.inc.c | 75 --- target/riscv/translate.c| 268 +++- 2

[Qemu-devel] [PATCH v2 21/29] target/riscv: Remove manual decoding from gen_load()

2018-10-20 Thread Bastian Koppelmann
With decodetree we don't need to convert RISC-V opcodes into to MemOps as the old gen_load() did. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - trans_load -> gen_load - removed negative memop check target/riscv

[Qemu-devel] [PATCH v2 22/29] target/riscv: Remove manual decoding from gen_store()

2018-10-20 Thread Bastian Koppelmann
With decodetree we don't need to convert RISC-V opcodes into to MemOps as the old gen_store() did. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - trans_store -> gen_store - removed negative memop check target/riscv

[Qemu-devel] [PATCH v2 16/29] target/riscv: Convert quadrant 0 of RVXC insns to decodetree

2018-10-20 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - Stack allocate arg_c_* structs - ex_rvc_register returns int - special case of trans_c_addi4spn() returns false target/riscv/Makefile.objs | 9 ++- target/riscv/insn16.decode |

[Qemu-devel] [PATCH v2 24/29] target/riscv: make ADD/SUB/OR/XOR/AND insn use arg lists

2018-10-20 Thread Bastian Koppelmann
manual decoding in gen_arith() is not necessary with decodetree. For now the function is called trans_arith as the original gen_arith still exisits. The former will be renamed to gen_arith as soon as the old gen_arith can be removed. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt

[Qemu-devel] [PATCH v2 19/29] target/riscv: Remove gen_jalr()

2018-10-20 Thread Bastian Koppelmann
trans_jalr() is the only caller, so move the code into trans_jalr(). Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 28 +- target/riscv/translate.c| 38

[Qemu-devel] [PATCH v2 18/29] target/riscv: Convert quadrant 2 of RVXC insns to decodetree

2018-10-20 Thread Bastian Koppelmann
This also removes all functions that now became obsolete. Signed-off-by: Bastian Koppelmann --- target/riscv/insn16.decode | 34 +- target/riscv/insn_trans/trans_rvc.inc.c | 103 target/riscv/translate.c| 151 +--- 3 files

[Qemu-devel] [PATCH v2 25/29] target/riscv: Remove shift and slt insn manual decoding

2018-10-20 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - trans_shift -> gen_shift target/riscv/insn_trans/trans_rvi.inc.c | 79 + target/riscv/translate.c| 59 ++ 2

[Qemu-devel] [PATCH v2 27/29] target/riscv: Remove gen_system()

2018-10-20 Thread Bastian Koppelmann
with all 16 bit insns moved to decodetree no path is falling back to gen_system(), so we can remove it. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/translate.c | 32 1 file changed, 32 deletions

[Qemu-devel] [PATCH v2 29/29] target/riscv: Rename trans_arith to gen_arith

2018-10-20 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann --- target/riscv/insn_trans/trans_rvi.inc.c | 14 +++--- target/riscv/insn_trans/trans_rvm.inc.c | 14 +++--- target/riscv/translate.c| 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/target/riscv

[Qemu-devel] [PATCH v2 23/29] target/riscv: Move gen_arith_imm() decoding into trans_* functions

2018-10-20 Thread Bastian Koppelmann
gen_arith_imm() does a lot of decoding manually, which was hard to read in case of the shift instructions and is not necessary anymore with decodetree. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v1 -> v2: - trans_arith_imm -> gen_arith_imm - Add m

Re: [Qemu-devel] [PATCH 1/7] decodetree: Add !extern flag to argument sets

2018-10-23 Thread Bastian Koppelmann
+++--- 1 file changed, 23 insertions(+), 11 deletions(-) Reviewed-by: Bastian Koppelmann Cheers, Bastian

Re: [Qemu-devel] [PATCH 2/7] decodetree: Remove "insn" argument from trans_* expanders

2018-10-23 Thread Bastian Koppelmann
On 10/23/18 2:04 PM, Richard Henderson wrote: ??? Needs simultaneous corresponding changes to all translators using decodetree. --- scripts/decodetree.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) Was the only intend of the insn argument to be used for manual decoding in a

Re: [Qemu-devel] [PATCH 2/7] decodetree: Remove "insn" argument from trans_* expanders

2018-10-23 Thread Bastian Koppelmann
On 10/23/18 3:08 PM, Richard Henderson wrote: On 10/23/18 2:04 PM, Bastian Koppelmann wrote: On 10/23/18 2:04 PM, Richard Henderson wrote: ??? Needs simultaneous corresponding changes to all translators using decodetree. ---   scripts/decodetree.py | 5 ++---   1 file changed, 2 insertions

Re: [Qemu-devel] [PATCH 3/7] target/riscv: Update for decodetree insn argument change

2018-10-23 Thread Bastian Koppelmann
+-- 7 files changed, 234 insertions(+), 241 deletions(-) Reviewed-by: Bastian Koppelmann Cheers, Bastian

Re: [Qemu-devel] [PATCH 4/7] target/riscv: Rename some argument sets in insn32.decode

2018-10-23 Thread Bastian Koppelmann
target/riscv/insn32.decode | 12 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) Reviewed-by: Bastian Koppelmann Cheers, Bastian

Re: [Qemu-devel] [PATCH 5/7] target/riscv: Convert @cs_2 insns to share translation functions

2018-10-23 Thread Bastian Koppelmann
+++- 3 files changed, 26 insertions(+), 47 deletions(-) Pretty cool :) Reviewed-by: Bastian Koppelmann Cheers, Bastian

Re: [Qemu-devel] [PATCH v2 23/29] target/riscv: Move gen_arith_imm() decoding into trans_* functions

2018-10-24 Thread Bastian Koppelmann
On 10/20/18 9:14 AM, Bastian Koppelmann wrote: @@ -338,27 +375,63 @@ static bool trans_and(DisasContext *ctx, arg_and *a, uint32_t insn) static bool trans_addiw(DisasContext *ctx, arg_addiw *a, uint32_t insn) { -gen_arith_imm(ctx, OPC_RISC_ADDIW, a->rd, a->rs1,

Re: [Qemu-devel] [PATCH 7/7] target/riscv: Splice decodetree inputs for riscv32 vs riscv64

2018-10-24 Thread Bastian Koppelmann
On 10/23/18 2:04 PM, Richard Henderson wrote: This primarily solves the case for RVC that several insns are completely different, decode and all, between the two. But it also means that we need less ifdefing for RV{I,M,A,F,D}. --- target/riscv/insn_trans/trans_rva.inc.c | 46 +---

Re: [Qemu-devel] [PATCH v2 02/29] targer/riscv: Activate decodetree and implemnt LUI & AUIPC

2018-10-26 Thread Bastian Koppelmann
On 10/25/18 6:58 PM, Palmer Dabbelt wrote: Reviewed-by: Palmer Dabbelt How do you want to go about merging these?  It looks like it should be possible to merge the patch set piecemeal, which I'd actually be happy doing as it'll be easier to get these out for testing that way.  That way we

Re: [Qemu-devel] [PATCH v2 00/29] target/riscv: Convert to decodetree

2018-10-26 Thread Bastian Koppelmann
On 10/25/18 12:21 AM, Palmer Dabbelt wrote: On Sat, 20 Oct 2018 00:14:22 PDT (-0700), kbast...@mail.uni-paderborn.de wrote: Hi, this patchset converts the RISC-V decoder to decodetree in three major steps: 1) Convert 32-bit instructions to decodetree [Patch 1-14]:     Many of the gen_* fun

Re: [Qemu-devel] [PATCH v2 02/29] targer/riscv: Activate decodetree and implemnt LUI & AUIPC

2018-10-26 Thread Bastian Koppelmann
On 10/26/18 3:58 PM, Richard Henderson wrote: On 10/26/18 11:49 AM, Bastian Koppelmann wrote: I think you can pick up everything up to the RVC conversion which still needs the work suggested by Richard. Thanks, for picking it up :) Even then I thought we were talking about splitting the RV64

Re: [Qemu-devel] [PATCH v2 13/29] target/riscv: Convert RV32D insns to decodetree

2018-10-31 Thread Bastian Koppelmann
On 10/20/18 9:14 AM, Bastian Koppelmann wrote: [...] +static bool trans_fclass_d(DisasContext *ctx, arg_fclass_d *a, uint32_t insn) +{ +#if defined(TARGET_RISCV64) +REQUIRE_FPU; + +TCGv t0 = tcg_temp_new(); +gen_helper_fclass_d(t0, cpu_fpr[a->rs1]); +gen_set_gpr(a->

Re: [Qemu-devel] [PATCH v2 13/29] target/riscv: Convert RV32D insns to decodetree

2018-10-31 Thread Bastian Koppelmann
On 10/31/18 11:44 AM, Bastian Koppelmann wrote: On 10/20/18 9:14 AM, Bastian Koppelmann wrote: [...] +static bool trans_fclass_d(DisasContext *ctx, arg_fclass_d *a, uint32_t insn) +{ +#if defined(TARGET_RISCV64) +    REQUIRE_FPU; + +    TCGv t0 = tcg_temp_new(); +    gen_helper_fclass_d(t0

[Qemu-devel] [PATCH v3 09/35] target/riscv: Convert RVXM insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - moved 64-bit only insn to insn64.decode - dropped insn argument of trans_foo functions target/riscv/insn32.decode | 10 +++ target/riscv/insn64.dec

[Qemu-devel] [PATCH v3 04/35] target/riscv: Convert RV32I load/store insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - split into two patches for RV32 and RV64 - dropped insn argument of trans_foo functions target/riscv/insn32.decode | 10 target/riscv/insn_trans/trans_rvi.inc.c |

[Qemu-devel] [PATCH v3 07/35] target/riscv: Convert RVXI fence insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - removed %pred/%succ - dropped insn argument of trans_foo functions target/riscv/insn32.decode | 2 ++ target/riscv/insn_trans/trans_rvi.inc.c |

[Qemu-devel] [PATCH v3 12/35] target/riscv: Convert RV32F insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - dropped insn argument of trans_foo functions target/riscv/insn32.decode | 35 +++ target/riscv/insn_trans/trans_rvf.inc.c | 334 target/ri

[Qemu-devel] [PATCH v3 05/35] target/riscv: Convert RV64I load/store insns to decodetree

2018-10-31 Thread Bastian Koppelmann
this splits the 64-bit only instructions into its own decode file such that we generate the decoder for these instructions only for the RISC-V 64 bit target. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/Makefile.objs | 8 +--- target/riscv

[Qemu-devel] [PATCH v3 06/35] target/riscv: Convert RVXI arithmetic insns to decodetree

2018-10-31 Thread Bastian Koppelmann
we cannot remove the call to gen_arith() in decode_RV32_64G() since it is used to translate multiply instructions. Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - moved 64-bit only insn to insn64.decode - dropped insn argument of trans_foo functions tar

[Qemu-devel] [PATCH v3 10/35] target/riscv: Convert RV32A insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - dropped insn argument of trans_foo functions target/riscv/insn32.decode | 17 +++ target/riscv/insn_trans/trans_rva.inc.c | 145 target/ri

[Qemu-devel] [PATCH v3 35/35] target/riscv: Remaining rvc insn reuse 32 bit translators

2018-10-31 Thread Bastian Koppelmann
only a translate functions of rvc need to handle special cases. For the other rvc instruction we can remove the extra layer of indirection. Signed-off-by: Bastian Koppelmann --- target/riscv/insn16.decode | 37 +-- target/riscv/insn_trans/trans_rvc.inc.c | 48

[Qemu-devel] [PATCH v3 08/35] target/riscv: Convert RVXI csr insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - dropped insn argument of trans_foo functions target/riscv/insn32.decode | 8 +++ target/riscv/insn_trans/trans_rvi.inc.c | 79 + target/ri

[Qemu-devel] [PATCH v3 03/35] target/riscv: Convert RVXI branch insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Palmer Dabbelt Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - dropped insn argument of trans_foo functions - removal of AUIPC moved to 0002 - &branch -> &b target/riscv/insn32.decode

[Qemu-devel] [PATCH v3 11/35] target/riscv: Convert RV64A insns to decodetree

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - moved 64-bit only insn to insn64.decode - dropped insn argument of trans_foo functions target/riscv/insn64.decode | 13 +++ target/riscv/insn_trans/trans_rva.in

[Qemu-devel] [PATCH v3 01/35] target/riscv: Move CPURISCVState pointer to DisasContext

2018-10-31 Thread Bastian Koppelmann
CPURISCVState is rarely used, so there is no need to pass it to every translate function. This paves the way for decodetree which only passes DisasContext to translate functions. Reviewed-by: Palmer Dabbelt Signed-off-by: Bastian Koppelmann --- target/riscv/translate.c | 15 --- 1

[Qemu-devel] [PATCH v3 26/35] target/riscv: Remove shift and slt insn manual decoding

2018-10-31 Thread Bastian Koppelmann
Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 78 + target/riscv/translate.c| 59 ++- 2 files changed, 85 insertions(+), 52 deletions(-) diff

[Qemu-devel] [PATCH v3 34/35] target/riscv: Splice remaining compressed insn pairs for riscv32 vs riscv64

2018-10-31 Thread Bastian Koppelmann
it splices flwsp_ldsp, fswsp_sdsp, and jal_addiw and makes each of them reuse the code generator used for the non compressed insns. Signed-off-by: Bastian Koppelmann --- target/riscv/insn16-32.decode | 7 + target/riscv/insn16-64.decode | 5 target/riscv/insn16

[Qemu-devel] [PATCH v3 25/35] target/riscv: make ADD/SUB/OR/XOR/AND insn use arg lists

2018-10-31 Thread Bastian Koppelmann
manual decoding in gen_arith() is not necessary with decodetree. For now the function is called trans_arith as the original gen_arith still exists. The former will be renamed to gen_arith as soon as the old gen_arith can be removed. Reviewed-by: Richard Henderson Signed-off-by: Bastian

[Qemu-devel] [PATCH v3 02/35] target/riscv: Activate decodetree and implemnt LUI & AUIPC

2018-10-31 Thread Bastian Koppelmann
for now only LUI & AUIPC are decoded and translated. If decodetree fails, we fall back to the old decoder. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- v2 -> v3: - ex_shift_amount returns int - dropped insn argument of tr

[Qemu-devel] [PATCH v3 21/35] target/riscv: Remove manual decoding from gen_branch()

2018-10-31 Thread Bastian Koppelmann
We now utilizes argument-sets of decodetree such that no manual decoding is necessary. Reviewed-by: Richard Henderson Signed-off-by: Bastian Koppelmann Signed-off-by: Peer Adelt --- target/riscv/insn_trans/trans_rvi.inc.c | 46 +--- target/riscv/translate.c

[Qemu-devel] [PATCH v3 31/35] target/riscv: Convert @cs_2 insns to share translation functions

2018-10-31 Thread Bastian Koppelmann
These all expand simply to R format instructions. Signed-off-by: Bastian Koppelmann --- target/riscv/Makefile.objs | 10 +++--- target/riscv/insn16-64.decode | 24 ++ target/riscv/insn16.decode | 15 + target/riscv/insn_trans

<    5   6   7   8   9   10   11   12   13   14   >