target/openrisc: Remove all uses of target_[u]long types
cover target/openrisc: Remove all uses of target_[u]long types
Remove all the target_[u]long uses in OpenRISC frontend.
Philippe Mathieu-Daudé (7):
target/openrisc: Replace VMSTATE_UINTTL() -> VMSTATE_UINT32() target/openrisc: Do not use target_ulong for @mr in MTSPR helper target/openrisc: Remove unused cpu_openrisc_map_address_*() handlers target/openrisc: Remove target_ulong use in raise_mmu_exception() target/openrisc: Use vaddr type for $pc jumps target/openrisc: Inline tcg_gen_trunc_i64_tl() target/openrisc: Replace target_ulong -> uint32_t
target/openrisc/cpu.h | 31 +-- target/openrisc/helper.h | 8 +- target/openrisc/fpu_helper.c | 8 +- target/openrisc/machine.c | 20 +- target/openrisc/mmu.c | 7 +- target/openrisc/sys_helper.c | 7 +- target/openrisc/translate.c | 396 +++++++++++++++++------------------ 7 files changed, 233 insertions(+), 244 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/7 target/openrisc: Replace VMSTATE_UINTTL() -> VMSTATE_UINT32()
Both OpenRISCTLBEntry fields are of uint32_t type. Use the appropriate VMSTATE_UINT32() macro.
There is no functional change (the migration stream is not modified), because the OpenRISC targets are only built as 32-bit:
$ git grep TARGET_LONG_BITS configs/targets/or1k-* configs/targets/or1k-linux-user.mak:5:TARGET_LONG_BITS=32 configs/targets/or1k-softmmu.mak:5:TARGET_LONG_BITS=32
--- target/openrisc/machine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/openrisc/machine.c +2 -2
@@ -26,8 +26,8 @@ static const VMStateDescription vmstate_tlb_entry = { .version_id = 1, .minimum_version_id = 1, .fields = (const VMStateField []) { -VMSTATE_UINTTL (mr, OpenRISCTLBEntry), -VMSTATE_UINTTL (tr, OpenRISCTLBEntry), +VMSTATE_UINT32 (mr, OpenRISCTLBEntry), +VMSTATE_UINT32 (tr, OpenRISCTLBEntry),VMSTATE_END_OF_LIST () } };
Signature · 1 line
2.51.0
PATCH 2/7 target/openrisc: Do not use target_ulong for @mr in MTSPR helper
In reply to Philippe Mathieu-DaudéOpenRISCTLBEntry::@mr field is a uint32_t type since its introduction in commit 726fe045720 ("target-or32: Add MMU support").
--- target/openrisc/sys_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/openrisc/sys_helper.c +1 -1
@@ -45,7 +45,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)OpenRISCCPU *cpu =env_archcpu (env);#ifndef CONFIG_USER_ONLY CPUState *cs =env_cpu (env); -target_ulong mr; +uint32_t mr;int idx;#endif
Signature · 1 line
2.51.0
Re: [PATCH 2/7] target/openrisc: Do not use target_ulong for @mr in MTSPR helper
Quoted 24 lines · Philippe Mathieu-Daudé
OpenRISCTLBEntry::@mr field is a
uint32_ttype since its introduction in commit726fe045720("target-or32: Add MMU support").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/openrisc/sys_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/openrisc/sys_helper.c +1
-1@@ -45,7 +45,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)OpenRISCCPU *cpu =env_archcpu (env);#ifndef CONFIG_USER_ONLY CPUState *cs =env_cpu (env); -target_ulong mr; +uint32_t mr;int idx;#endif Signature · 1 line
2.51.0
PATCH 3/7 target/openrisc: Remove unused cpu_openrisc_map_address_*() handlers
In reply to Philippe Mathieu-DaudéCommit 23d45ebdb19 ("target/openrisc: Remove indirect function calls for mmu") removed the last uses of both cpu_openrisc_map_address_code() and cpu_openrisc_map_address_data() helpers.
--- target/openrisc/cpu.h | 9 --------- 1 file changed, 9 deletions(-)
target/openrisc/cpu.h +0 -9
@@ -220,15 +220,6 @@ typedef struct OpenRISCTLBEntry {typedef struct CPUOpenRISCTLBContext {OpenRISCTLBEntry itlb[TLB_SIZE ];OpenRISCTLBEntry dtlb[TLB_SIZE ]; - -int (*cpu_openrisc_map_address_code)(OpenRISCCPU *cpu, -hwaddr *physical, -int *prot, -target_ulong address,int rw); -int (*cpu_openrisc_map_address_data)(OpenRISCCPU *cpu, -hwaddr *physical, -int *prot, -target_ulong address,int rw); }CPUOpenRISCTLBContext ;#endif
Signature · 1 line
2.51.0
Re: [PATCH 3/7] target/openrisc: Remove unused cpu_openrisc_map_address_*() handlers
Quoted 9 lines · Philippe Mathieu-Daudé
Commit
23d45ebdb19("target/openrisc: Remove indirect function calls for mmu") removed the last uses of bothcpu_openrisc_map_address_code()andcpu_openrisc_map_address_data()helpers.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/openrisc/cpu.h | 9 --------- 1 file changed, 9 deletions(-)
Nice
PATCH 4/7 target/openrisc: Remove target_ulong use in raise_mmu_exception()
In reply to Philippe Mathieu-DaudéTCGCPUOps::tlb_fill() handler provides a vaddr type (since commit 7510454e3e7 "cpu: Turn cpu_handle_mmu_fault() into a CPUClass hook").
--- target/openrisc/mmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
target/openrisc/mmu.c +3 -4
@@ -28,15 +28,14 @@#include "qemu/host-utils.h" #include "hw/loader.h" -static inline void get_phys_nommu (hwaddr *phys_addr,int *prot, -target_ulong address) +static inline void get_phys_nommu (hwaddr *phys_addr,int *prot,vaddr address) { *phys_addr = address; *prot =PAGE_READ |PAGE_WRITE |PAGE_EXEC ; }static int get_phys_mmu (OpenRISCCPU *cpu,hwaddr *phys_addr,int *prot, -target_ulong addr,int need,bool super) +vaddr addr,int need,bool super) {int idx = (addr >>TARGET_PAGE_BITS ) &TLB_MASK ;uint32_t imr = cpu->env.tlb.itlb[idx].mr;
@@ -95,7 +94,7 @@ static int get_phys_mmu(OpenRISCCPU *cpu, hwaddr *phys_addr, int *prot, } } -static void raise_mmu_exception (OpenRISCCPU *cpu,target_ulong address, +static void raise_mmu_exception (OpenRISCCPU *cpu,vaddr address,int exception) {CPUState *cs =CPU (cpu);
Signature · 1 line
2.51.0
Re: [PATCH 4/7] target/openrisc: Remove target_ulong use in raise_mmu_exception()
Quoted 7 lines · Philippe Mathieu-Daudé
TCGCPUOps::tlb_fill()handler provides a vaddr type (since commit7510454e3e7"cpu: Turncpu_handle_mmu_fault()into a CPUClass hook").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/openrisc/mmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
PATCH 5/7 target/openrisc: Use vaddr type for $pc jumps
In reply to Philippe Mathieu-Daudétranslator_use_goto_tb() expects a vaddr type since commit b1c09220b4c ("accel/tcg: Replace target_ulong with vaddr in translator_*()").
--- target/openrisc/translate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
target/openrisc/translate.c +6 -6
@@ -51,7 +51,7 @@ typedef struct DisasContext {uint32_t avr;/* If not -1, jmp_pc contains this value and so is a direct jump. */ -target_ulong jmp_pc_imm; +vaddr jmp_pc_imm;/* The temporary corresponding to register 0 for this compilation. */ TCGv R0 ;
@@ -580,7 +580,7 @@ static bool trans_l_muldu(DisasContext *dc, arg_ab *a)static bool trans_l_j (DisasContext *dc,arg_l_j *a) { -target_ulong tmp_pc = dc->base.pc_next + a->n *4 ; +vaddr tmp_pc = dc->base.pc_next + a->n *4 ;tcg_gen_movi_tl (jmp_pc, tmp_pc); dc->jmp_pc_imm = tmp_pc;
@@ -590,8 +590,8 @@ static bool trans_l_j(DisasContext *dc, arg_l_j *a)static bool trans_l_jal (DisasContext *dc,arg_l_jal *a) { -target_ulong tmp_pc = dc->base.pc_next + a->n *4 ; -target_ulong ret_pc = dc->base.pc_next +8 ; +vaddr tmp_pc = dc->base.pc_next + a->n *4 ; +vaddr ret_pc = dc->base.pc_next +8 ;tcg_gen_movi_tl (cpu_regs[9 ], ret_pc);/* Optimize jal being used to load the PC for PIC. */
@@ -605,7 +605,7 @@ static bool trans_l_jal(DisasContext *dc, arg_l_jal *a)static void do_bf (DisasContext *dc,arg_l_bf *a,TCGCond cond) { -target_ulong tmp_pc = dc->base.pc_next + a->n *4 ; +vaddr tmp_pc = dc->base.pc_next + a->n *4 ;TCGv t_next =tcg_constant_tl (dc->base.pc_next +8 );TCGv t_true =tcg_constant_tl (tmp_pc);
@@ -1586,7 +1586,7 @@ static void openrisc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)static void openrisc_tr_tb_stop (DisasContextBase *dcbase,CPUState *cs) {DisasContext *dc =container_of (dcbase, DisasContext, base); -target_ulong jmp_dest; +vaddr jmp_dest;/* If we have already exited the TB, nothing following has effect. */ if (dc->base.is_jmp ==DISAS_NORETURN ) {
Signature · 1 line
2.51.0
Re: [PATCH 5/7] target/openrisc: Use vaddr type for $pc jumps
Quoted 8 lines · Philippe Mathieu-Daudé
translator_use_goto_tb()expects a vaddr type since commitb1c09220b4c("accel/tcg: Replacetarget_ulongwith vaddr in translator_*()").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/openrisc/translate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
PATCH 6/7 target/openrisc: Inline tcg_gen_trunc_i64_tl()
In reply to Philippe Mathieu-DaudéThe OpenRISC targets are only built as 32-bit, so tcg_gen_trunc_i64_tl expands to tcg_gen_extrl_i64_i32(). Use the latter to simplify the next commit mechanical change.
---
Squash in following?
--- target/openrisc/translate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
target/openrisc/translate.c +5 -5
@@ -307,7 +307,7 @@ static void gen_muld(DisasContext *dc, TCGv srca, TCGv srcb)tcg_gen_muls2_i64 (cpu_mac, high, t1, t2);tcg_gen_sari_i64 (t1, cpu_mac,63 );tcg_gen_negsetcond_i64 (TCG_COND_NE , t1, t1, high); -tcg_gen_trunc_i64_tl (cpu_sr_ov, t1); +tcg_gen_extrl_i64_i32 (cpu_sr_ov, t1);gen_ove_ov (dc); }
@@ -328,7 +328,7 @@ static void gen_muldu(DisasContext *dc, TCGv srca, TCGv srcb)tcg_gen_mulu2_i64 (cpu_mac, high, t1, t2);tcg_gen_setcondi_i64 (TCG_COND_NE , high, high,0 ); -tcg_gen_trunc_i64_tl (cpu_sr_cy, high); +tcg_gen_extrl_i64_i32 (cpu_sr_cy, high);gen_ove_cy (dc); }
@@ -370,7 +370,7 @@ static void gen_macu(DisasContext *dc, TCGv srca, TCGv srcb)/* Note that overflow is only computed during addition stage. */ tcg_gen_add_i64 (cpu_mac, cpu_mac, t1);tcg_gen_setcond_i64 (TCG_COND_LTU , t1, cpu_mac, t1); -tcg_gen_trunc_i64_tl (cpu_sr_cy, t1); +tcg_gen_extrl_i64_i32 (cpu_sr_cy, t1);gen_ove_cy (dc); }
@@ -411,7 +411,7 @@ static void gen_msbu(DisasContext *dc, TCGv srca, TCGv srcb)/* Note that overflow is only computed during subtraction stage. */ tcg_gen_setcond_i64 (TCG_COND_LTU , t2, cpu_mac, t1);tcg_gen_sub_i64 (cpu_mac, cpu_mac, t1); -tcg_gen_trunc_i64_tl (cpu_sr_cy, t2); +tcg_gen_extrl_i64_i32 (cpu_sr_cy, t2);gen_ove_cy (dc); }
@@ -929,7 +929,7 @@ static bool trans_l_movhi(DisasContext *dc, arg_l_movhi *a)static bool trans_l_macrc (DisasContext *dc,arg_l_macrc *a) {check_r0_write (dc, a->d); -tcg_gen_trunc_i64_tl (cpu_R (dc, a->d), cpu_mac); +tcg_gen_extrl_i64_i32 (cpu_R (dc, a->d), cpu_mac);tcg_gen_movi_i64 (cpu_mac,0 );return true; }
Signature · 1 line
2.51.0
Re: [PATCH 6/7] target/openrisc: Inline tcg_gen_trunc_i64_tl()
Quoted 10 lines · Philippe Mathieu-Daudé
The OpenRISC targets are only built as 32-bit, so
tcg_gen_trunc_i64_tlexpands totcg_gen_extrl_i64_i32(). Use the latter to simplify the next commit mechanical change.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Squash in following?--- target/openrisc/translate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
RFC PATCH 7/7 target/openrisc: Replace target_ulong -> uint32_t
In reply to Philippe Mathieu-DaudéThe OpenRISC targets are only built as 32-bit, therefore target_ulong always expands to uint32_t. Replace and adapt the API uses mechanically:
target_ulong -> uint32_t
target_long -> int32_t
tl -> i32
TCGv -> TCGv_i32
tcg_global_mem_new -> tcg_global_mem_new_i32
---
RFC: not sure how to split to ease review :|
--- target/openrisc/cpu.h | 22 +-- target/openrisc/helper.h | 8 +- target/openrisc/fpu_helper.c | 8 +- target/openrisc/machine.c | 16 +- target/openrisc/sys_helper.c | 5 +- target/openrisc/translate.c | 374 +++++++++++++++++------------------ 6 files changed, 216 insertions(+), 217 deletions(-)
target/openrisc/cpu.h +11 -11
@@ -224,20 +224,20 @@ typedef struct CPUOpenRISCTLBContext {#endif typedef struct CPUArchState { - target_ulong shadow_gpr[16][32]; /* Shadow registers */ + uint32_t shadow_gpr[16][32]; /* Shadow registers */ - target_ulong pc; /* Program counter */ - target_ulong ppc; /* Prev PC */ - target_ulong jmp_pc; /* Jump PC */ + uint32_t pc; /* Program counter */ + uint32_t ppc; /* Prev PC */ + uint32_t jmp_pc; /* Jump PC */ uint64_t mac; /* Multiply registers MACHI:MACLO */ - target_ulong epcr; /* Exception PC register */ - target_ulong eear; /* Exception EA register */ + uint32_t epcr; /* Exception PC register */ + uint32_t eear; /* Exception EA register */ - target_ulong sr_f; /* the SR_F bit, values 0, 1. */ - target_ulong sr_cy; /* the SR_CY bit, values 0, 1. */ - target_long sr_ov; /* the SR_OV bit (in the sign bit only) */ + uint32_t sr_f; /* the SR_F bit, values 0, 1. */ + uint32_t sr_cy; /* the SR_CY bit, values 0, 1. */ + int32_t sr_ov; /* the SR_OV bit (in the sign bit only) */ uint32_t sr; /* Supervisor register, without SR_{F,CY,OV} */ uint32_t esr; /* Exception supervisor register */ uint32_t evbar; /* Exception vector base address register */
@@ -245,8 +245,8 @@ typedef struct CPUArchState {uint32_t fpcsr;/* Float register */ float_status fp_status; -target_ulong lock_addr; -target_ulong lock_value; +uint32_t lock_addr; +uint32_t lock_value;uint32_t dflag;/* In delay slot (boolean) */
target/openrisc/helper.h +4 -4
@@ -47,8 +47,8 @@ FOP_CALC(rem)#undef FOP_CALC#define FOP_CMP (op) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_RWG, tl, env, i32, i32) \ -DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_RWG, tl, env, i64, i64) +DEF_HELPER_FLAGS_3(float_ ## op ## _s, TCG_CALL_NO_RWG, i32, env, i32, i32) \ +DEF_HELPER_FLAGS_3(float_ ## op ## _d, TCG_CALL_NO_RWG, i32, env, i64, i64) FOP_CMP(eq) FOP_CMP(lt) FOP_CMP(le)
@@ -62,5 +62,5 @@ FOP_CMP(ult)DEF_HELPER_FLAGS_1 (rfe,0 , void, env) /* sys */ -DEF_HELPER_FLAGS_3(mtspr, 0, void, env, tl, tl) -DEF_HELPER_FLAGS_3 (mfspr,TCG_CALL_NO_WG , tl, env, tl, tl) +DEF_HELPER_FLAGS_3(mtspr, 0, void, env, i32, i32) +DEF_HELPER_FLAGS_3 (mfspr,TCG_CALL_NO_WG , i32, env, i32, i32)
target/openrisc/fpu_helper.c +4 -4
@@ -146,10 +146,10 @@ uint32_t helper_float_madd_s(CPUOpenRISCState *env, uint32_t a,#define FLOAT_CMP (name, impl) \ -target_ulong helper_float_ ## name ## _d(CPUOpenRISCState *env, \ +uint32_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ uint64_t fdt0, uint64_t fdt1) \ { return float64_ ## impl(fdt0, fdt1, &env->fp_status); } \ -target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \ +uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ uint32_t fdt0, uint32_t fdt1) \ { return float32_ ## impl(fdt0, fdt1, &env->fp_status); }
@@ -160,13 +160,13 @@ FLOAT_CMP(un, unordered_quiet)#undef FLOAT_CMP#define FLOAT_UCMP (name, expr) \ -target_ulong helper_float_ ## name ## _d(CPUOpenRISCState *env, \ +uint32_t helper_float_ ## name ## _d(CPUOpenRISCState *env, \ uint64_t fdt0, uint64_t fdt1) \ { \ FloatRelation r = float64_compare_quiet(fdt0, fdt1, &env->fp_status); \ return expr; \ } \ -target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \ +uint32_t helper_float_ ## name ## _s(CPUOpenRISCState *env, \ uint32_t fdt0, uint32_t fdt1) \ { \ FloatRelation r = float32_compare_quiet(fdt0, fdt1, &env->fp_status); \
target/openrisc/machine.c +8 -8
@@ -72,14 +72,14 @@ static const VMStateDescription vmstate_env = { .version_id = 6, .minimum_version_id = 6, .fields = (const VMStateField []) { -VMSTATE_UINTTL_2DARRAY (shadow_gpr, CPUOpenRISCState,16 ,32 ), -VMSTATE_UINTTL (pc, CPUOpenRISCState), -VMSTATE_UINTTL (ppc, CPUOpenRISCState), -VMSTATE_UINTTL (jmp_pc, CPUOpenRISCState), -VMSTATE_UINTTL (lock_addr, CPUOpenRISCState), -VMSTATE_UINTTL (lock_value, CPUOpenRISCState), -VMSTATE_UINTTL (epcr, CPUOpenRISCState), -VMSTATE_UINTTL (eear, CPUOpenRISCState), +VMSTATE_UINT32_2DARRAY (shadow_gpr, CPUOpenRISCState,16 ,32 ), +VMSTATE_UINT32 (pc, CPUOpenRISCState), +VMSTATE_UINT32 (ppc, CPUOpenRISCState), +VMSTATE_UINT32 (jmp_pc, CPUOpenRISCState), +VMSTATE_UINT32 (lock_addr, CPUOpenRISCState), +VMSTATE_UINT32 (lock_value, CPUOpenRISCState), +VMSTATE_UINT32 (epcr, CPUOpenRISCState), +VMSTATE_UINT32 (eear, CPUOpenRISCState),/* Save the architecture value of the SR, not the internally expanded version. Since this architecture value does not
target/openrisc/sys_helper.c +2 -3
@@ -40,7 +40,7 @@ static inline bool is_user(CPUOpenRISCState *env)#endif } -void HELPER (mtspr )(CPUOpenRISCState *env,target_ulong spr,target_ulong rb) +void HELPER (mtspr )(CPUOpenRISCState *env,uint32_t spr,uint32_t rb) {OpenRISCCPU *cpu =env_archcpu (env);#ifndef CONFIG_USER_ONLY
@@ -213,8 +213,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)#endif } -target_ulong HELPER (mfspr )(CPUOpenRISCState *env,target_ulong rd, -target_ulong spr) +uint32_t HELPER (mfspr )(CPUOpenRISCState *env,uint32_t rd,uint32_t spr) {OpenRISCCPU *cpu =env_archcpu (env);#ifndef CONFIG_USER_ONLY
target/openrisc/translate.c +187 -187
987 lines not on this page · raw message
Signature · 1 line
2.51.0
Re: [RFC PATCH 7/7] target/openrisc: Replace target_ulong -> uint32_t
Quoted 9 lines · Philippe Mathieu-Daudé
The OpenRISC targets are only built as 32-bit, therefore
target_ulongalways expands touint32_t. Replace and adapt the API uses mechanically:target_ulong -> uint32_t target_long -> int32_t tl -> i32 TCGv -> TCGv_i32 tcg_global_mem_new -> tcg_global_mem_new_i32
I forgot:
VMSTATE_UINTTL -> VMSTATE_UINT32
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
RFC: not sure how to split to ease review :|
~200 lines, not that bad.
Quoted 8 lines
--- target/openrisc/cpu.h | 22 +-- target/openrisc/helper.h | 8 +- target/openrisc/fpu_helper.c | 8 +- target/openrisc/machine.c | 16 +- target/openrisc/sys_helper.c | 5 +- target/openrisc/translate.c | 374 +++++++++++++++++------------------ 6 files changed, 216 insertions(+), 217 deletions(-)
Re: [RFC PATCH 7/7] target/openrisc: Replace target_ulong -> uint32_t
In reply to Philippe Mathieu-DaudéQuoted 21 lines · Philippe Mathieu-Daudé
The OpenRISC targets are only built as 32-bit, therefore
target_ulongalways expands touint32_t. Replace and adapt the API uses mechanically:
target_ulong->uint32_t
target_long->int32_t
tl -> i32
TCGv ->TCGv_i32
tcg_global_mem_new->tcg_global_mem_new_i32Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
RFC: not sure how to split to ease review :|--- target/openrisc/cpu.h | 22 +-- target/openrisc/helper.h | 8 +- target/openrisc/fpu_helper.c | 8 +- target/openrisc/machine.c | 16 +- target/openrisc/sys_helper.c | 5 +- target/openrisc/translate.c | 374 +++++++++++++++++------------------ 6 files changed, 216 insertions(+), 217 deletions(-)
[...]
target/openrisc/translate.c static void gen_ove_cyov(DisasContext *dc) · line 206
Quoted 7 lines
target/openrisc/translate.c +3
-3-static void gen_add (DisasContext *dc,TCGv dest,TCGv srca,TCGv srcb) +static void gen_add (DisasContext *dc,TCGv_i32 dest,TCGv_i32 srca,TCGv_i32 srcb) { -TCGv t0 =tcg_temp_new (); -TCGv res =tcg_temp_new (); +TCGv_i32 t0 =tcg_temp_new (); +TCGv_i32 res =tcg_temp_new ();
I think you missed transforming tcg_temp_new -> tcg_temp_new_i32.
Quoted 7 lines
static bool
trans_l_lwa(DisasContext *dc, arg_load *a){target/openrisc/translate.c +1
-1-TCGv ea; +TCGv_i32 ea;check_r0_write (dc, a->d); ea =tcg_temp_new ();
target/openrisc/translate.c static bool trans_l_bnf(DisasContext *dc, arg_l_bf *a) · line 654
Quoted 10 lines
target/openrisc/translate.c +4
-4-tcg_gen_addi_tl (ea,cpu_R (dc, a->a), a->i); -tcg_gen_qemu_ld_tl (cpu_R (dc, a->d), ea, dc->mem_idx,MO_TEUL ); -tcg_gen_mov_tl (cpu_lock_addr, ea); -tcg_gen_mov_tl (cpu_lock_value,cpu_R (dc, a->d)); +tcg_gen_addi_i32 (ea,cpu_R (dc, a->a), a->i); +tcg_gen_qemu_ld_i32 (cpu_R (dc, a->d), ea, dc->mem_idx,MO_TEUL ); +tcg_gen_mov_i32 (cpu_lock_addr, ea); +tcg_gen_mov_i32 (cpu_lock_value,cpu_R (dc, a->d));return true; }
What about MO_TE -> MO_BE to handle MO_TE[SU][WL]?
I think this is fine to review as is. if you're looking to split it more, maybe moving helper signature changes to a separate patch makes sense (helper.h, fpu_helper.c, sys_helper.c, do_fp*() from translate.c).
Also, might be worth reiterating that the migration stream is unaffected in the commit message.
With the tcg_temp_new transformation:
Re: [RFC PATCH 7/7] target/openrisc: Replace target_ulong -> uint32_t
Quoted 53 lines · Anton Johansson
Quoted 21 lines · Philippe Mathieu-Daudé
The OpenRISC targets are only built as 32-bit, therefore
target_ulongalways expands touint32_t. Replace and adapt the API uses mechanically:target_ulong -> uint32_t target_long -> int32_t tl -> i32 TCGv -> TCGv_i32 tcg_global_mem_new -> tcg_global_mem_new_i32Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
RFC: not sure how to split to ease review :|--- target/openrisc/cpu.h | 22 +-- target/openrisc/helper.h | 8 +- target/openrisc/fpu_helper.c | 8 +- target/openrisc/machine.c | 16 +- target/openrisc/sys_helper.c | 5 +- target/openrisc/translate.c | 374 +++++++++++++++++------------------ 6 files changed, 216 insertions(+), 217 deletions(-)[...]
target/openrisc/translate.c static void gen_ove_cyov(DisasContext *dc) · line 206
Quoted 7 lines
target/openrisc/translate.c +3
-3-static void gen_add (DisasContext *dc,TCGv dest,TCGv srca,TCGv srcb) +static void gen_add (DisasContext *dc,TCGv_i32 dest,TCGv_i32 srca,TCGv_i32 srcb) { -TCGv t0 =tcg_temp_new (); -TCGv res =tcg_temp_new (); +TCGv_i32 t0 =tcg_temp_new (); +TCGv_i32 res =tcg_temp_new ();I think you missed transforming
tcg_temp_new->tcg_temp_new_i32.Quoted 7 lines
static bool trans_l_lwa(DisasContext *dc, arg_load *a) {target/openrisc/translate.c +1
-1-TCGv ea; +TCGv_i32 ea;check_r0_write (dc, a->d); ea =tcg_temp_new ();target/openrisc/translate.c static bool trans_l_bnf(DisasContext *dc, arg_l_bf *a) · line 654
Quoted 10 lines
target/openrisc/translate.c +4
-4-tcg_gen_addi_tl (ea,cpu_R (dc, a->a), a->i); -tcg_gen_qemu_ld_tl (cpu_R (dc, a->d), ea, dc->mem_idx,MO_TEUL ); -tcg_gen_mov_tl (cpu_lock_addr, ea); -tcg_gen_mov_tl (cpu_lock_value,cpu_R (dc, a->d)); +tcg_gen_addi_i32 (ea,cpu_R (dc, a->a), a->i); +tcg_gen_qemu_ld_i32 (cpu_R (dc, a->d), ea, dc->mem_idx,MO_TEUL ); +tcg_gen_mov_i32 (cpu_lock_addr, ea); +tcg_gen_mov_i32 (cpu_lock_value,cpu_R (dc, a->d));return true; }
Quoted 1 line
What about
MO_TE->MO_BEto handle MO_TE[SU][WL]?
I thought we already had that merged...
Quoted 3 lines
I think this is fine to review as is. if you're looking to split it more, maybe moving helper signature changes to a separate patch makes sense (
helper.h,fpu_helper.c,sys_helper.c, do_fp*() fromtranslate.c).
These sum 11 lines, not worth it.
Quoted 7 lines
Also, might be worth reiterating that the migration stream is unaffected in the commit message.
With the
tcg_temp_newtransformation:Reviewed-by Anton Johansson <[email protected]>
Thanks!
Re: [RFC PATCH 7/7] target/openrisc: Replace target_ulong -> uint32_t
Quoted 54 lines · Philippe Mathieu-Daudé
Quoted 53 lines · Anton Johansson
Quoted 21 lines · Philippe Mathieu-Daudé
The OpenRISC targets are only built as 32-bit, therefore
target_ulongalways expands touint32_t. Replace and adapt the API uses mechanically:
target_ulong->uint32_t
target_long->int32_t
tl -> i32
TCGv ->TCGv_i32
tcg_global_mem_new->tcg_global_mem_new_i32Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
RFC: not sure how to split to ease review :|
---
target/openrisc/cpu.h | 22 +-- target/openrisc/helper.h | 8 +-target/openrisc/fpu_helper.c| 8 +- target/openrisc/machine.c | 16 +-target/openrisc/sys_helper.c| 5 +- target/openrisc/translate.c | 374 +++++++++++++++++------------------6 files changed, 216 insertions(+), 217 deletions(-)[...]
Quoted 8 lines
(quoted diff) +1
-1-static void gen_add(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb) +static void gen_add(DisasContext *dc, TCGv_i32 dest, TCGv_i32 srca,
TCGv_i32srcb)
{
- TCGv t0 =tcg_temp_new();
- TCGv res =tcg_temp_new();
+TCGv_i32t0 =tcg_temp_new();
+TCGv_i32res =tcg_temp_new();I think you missed transforming
tcg_temp_new->tcg_temp_new_i32.Quoted 16 lines
static bool
trans_l_lwa(DisasContext *dc, arg_load *a){
- TCGv ea;
+TCGv_i32ea;
check_r0_write(dc, a->d);
ea =tcg_temp_new();
-tcg_gen_addi_tl(ea, cpu_R(dc, a->a), a->i);
-tcg_gen_qemu_ld_tl(cpu_R(dc, a->d), ea, dc->mem_idx, MO_TEUL); -tcg_gen_mov_tl(cpu_lock_addr, ea);
-tcg_gen_mov_tl(cpu_lock_value, cpu_R(dc, a->d));
+tcg_gen_addi_i32(ea, cpu_R(dc, a->a), a->i);
+tcg_gen_qemu_ld_i32(cpu_R(dc, a->d), ea, dc->mem_idx, MO_TEUL); +tcg_gen_mov_i32(cpu_lock_addr, ea);
+tcg_gen_mov_i32(cpu_lock_value, cpu_R(dc, a->d)); return true;
}
Quoted 3 lines
Quoted 1 line
What about
MO_TE->MO_BEto handle MO_TE[SU][WL]?I thought we already had that merged...
Found it in a branch from March 17 of this year, but forgot to post, thanks for the reminder!