target/ppc: Remove unused helper_lscbx()
PATCH 1/1 target/ppc: Remove unused helper_lscbx()
The helper_lscbx() function isn't called anywhere. It used to be used by the PPC 601 CPU support; we removed that in commit 005b69fdcc in 2022 but missed this helper function.
---
This came to my attention because Coverity reported a "shifts into sign bit" issue in the function: CID 1663681
--- target/ppc/helper.h | 1 - target/ppc/mem_helper.c | 28 ---------------------------- 2 files changed, 29 deletions(-)
target/ppc/helper.h +0 -1
@@ -54,7 +54,6 @@ DEF_HELPER_FLAGS_2(dcbzl, TCG_CALL_NO_WG, void, env, tl)#endif DEF_HELPER_FLAGS_2(icbi, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_FLAGS_2(icbiep, TCG_CALL_NO_WG, void, env, tl) -DEF_HELPER_5(lscbx, tl, env, tl, i32, i32, i32)#if defined(TARGET_PPC64 )DEF_HELPER_4 (DIVDEU , i64, env, i64, i64, i32)
target/ppc/mem_helper.c +0 -28
@@ -367,34 +367,6 @@ void helper_icbiep(CPUPPCState *env, target_ulong addr)#endif } -/* XXX: to be tested */ -target_ulong helper_lscbx (CPUPPCState *env,target_ulong addr,uint32_t reg, -uint32_t ra,uint32_t rb) -{ -int i, c, d; - - d =24 ; -for (i =0 ; i < xer_bc; i++) { - c =cpu_ldub_data_ra (env, addr,GETPC ()); - addr =addr_add (env, addr,1 ); -/* ra (if not 0) and rb are never modified */ -if (likely (reg != rb && (ra ==0 || reg != ra))) { - env->gpr[reg] = (env->gpr[reg] & ~(0xFF << d)) | (c << d); - } -if (unlikely (c == xer_cmp)) { -break ; - } -if (likely (d !=0 )) { - d -=8 ; - }else { - d =24 ; - reg++; - reg = reg &0x1F ; - } - } -return i; -} -/*****************************************************************************/ /* Altivec extension helpers */ #if HOST_BIG_ENDIAN
Signature · 1 line
2.43.0
Quoted 6 lines · Peter Maydell
The
helper_lscbx()function isn't called anywhere. It used to be used by the PPC 601 CPU support; we removed that in commit005b69fdccin 2022 but missed this helper function.Fixes 005b69fdcc ("target/ppc: Remove PowerPC 601 CPUs")Signed-off-by Peter Maydell <[email protected]>
Quoted 7 lines
---
This came to my attention because Coverity reported a "shifts into sign bit" issue in the function: CID 1663681--- target/ppc/helper.h | 1 - target/ppc/mem_helper.c | 28 ---------------------------- 2 files changed, 29 deletions(-)
"git grep lscbx" returns only the declaration in helper.h and the definition in mem_helper.c -- no TCG translator references, no gen_lscbx, nothing in translate.c. Confirmed dead code with zero callers. Thanks for the cleanup.
Thanks,
Amit
Quoted 56 lines
target/ppc/helper.h +0
-1@@ -54,7 +54,6 @@ DEF_HELPER_FLAGS_2(dcbzl, TCG_CALL_NO_WG, void, env, tl)#endif DEF_HELPER_FLAGS_2(icbi, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_FLAGS_2(icbiep, TCG_CALL_NO_WG, void, env, tl) -DEF_HELPER_5(lscbx, tl, env, tl, i32, i32, i32)#if defined(TARGET_PPC64 )DEF_HELPER_4 (DIVDEU , i64, env, i64, i64, i32)target/ppc/mem_helper.c +0
-28@@ -367,34 +367,6 @@ void helper_icbiep(CPUPPCState *env, target_ulong addr)#endif } -/* XXX: to be tested */ -target_ulong helper_lscbx (CPUPPCState *env,target_ulong addr,uint32_t reg, -uint32_t ra,uint32_t rb) -{ -int i, c, d; - - d =24 ; -for (i =0 ; i < xer_bc; i++) { - c =cpu_ldub_data_ra (env, addr,GETPC ()); - addr =addr_add (env, addr,1 ); -/* ra (if not 0) and rb are never modified */ -if (likely (reg != rb && (ra ==0 || reg != ra))) { - env->gpr[reg] = (env->gpr[reg] & ~(0xFF << d)) | (c << d); - } -if (unlikely (c == xer_cmp)) { -break ; - } -if (likely (d !=0 )) { - d -=8 ; - }else { - d =24 ; - reg++; - reg = reg &0x1F ; - } - } -return i; -} -/*****************************************************************************/ /* Altivec extension helpers */ #if HOST_BIG_ENDIAN Signature · 1 line
2.43.0
Ping: this has been reviewed, is somebody on the ppc side going to pick it up ?
thanks
-- PMM
Quoted 80 lines · Amit Machhiwal
Quoted 6 lines · Peter Maydell
The
helper_lscbx()function isn't called anywhere. It used to be used by the PPC 601 CPU support; we removed that in commit005b69fdccin 2022 but missed this helper function.Fixes 005b69fdcc ("target/ppc: Remove PowerPC 601 CPUs")Signed-off-by Peter Maydell <[email protected]>Quoted 7 lines
---
This came to my attention because Coverity reported a "shifts into sign bit" issue in the function: CID 1663681--- target/ppc/helper.h | 1 - target/ppc/mem_helper.c | 28 ---------------------------- 2 files changed, 29 deletions(-)"git grep lscbx" returns only the declaration in
helper.hand the definition inmem_helper.c-- no TCG translator references, nogen_lscbx, nothing intranslate.c. Confirmed dead code with zero callers. Thanks for the cleanup.Reviewed-by Amit Machhiwal <[email protected]>Thanks,
AmitQuoted 54 lines
target/ppc/helper.h +0
-1@@ -54,7 +54,6 @@ DEF_HELPER_FLAGS_2(dcbzl, TCG_CALL_NO_WG, void, env, tl)#endif DEF_HELPER_FLAGS_2(icbi, TCG_CALL_NO_WG, void, env, tl) DEF_HELPER_FLAGS_2(icbiep, TCG_CALL_NO_WG, void, env, tl) -DEF_HELPER_5(lscbx, tl, env, tl, i32, i32, i32)#if defined(TARGET_PPC64 )DEF_HELPER_4 (DIVDEU , i64, env, i64, i64, i32)target/ppc/mem_helper.c +0
-29@@ -367,34 +367,6 @@ void helper_icbiep(CPUPPCState *env, target_ulong addr)#endif } -/* XXX: to be tested */ -target_ulong helper_lscbx (CPUPPCState *env,target_ulong addr,uint32_t reg, -uint32_t ra,uint32_t rb) -{ -int i, c, d; - - d =24 ; -for (i =0 ; i < xer_bc; i++) { - c =cpu_ldub_data_ra (env, addr,GETPC ()); - addr =addr_add (env, addr,1 ); -/* ra (if not 0) and rb are never modified */ -if (likely (reg != rb && (ra ==0 || reg != ra))) { - env->gpr[reg] = (env->gpr[reg] & ~(0xFF << d)) | (c << d); - } -if (unlikely (c == xer_cmp)) { -break ; - } -if (likely (d !=0 )) { - d -=8 ; - }else { - d =24 ; - reg++; - reg = reg &0x1F ; - } - } -return i; -} -/*****************************************************************************/ /* Altivec extension helpers */ #if HOST_BIG_ENDIAN --2.43.0
Hi Peter,
I am travelling till July end.
If it's urgent, Could you please take it via your next PR or I can take it via next PPC PR in August.
Thanks
Harsh
Quoted 94 lines · Peter Maydell,
Ping: this has been reviewed, is somebody on the ppc side going to pick it up ?
thanks
-- PMMQuoted 27 lines · Amit Machhiwal
Quoted 6 lines · Peter Maydell
The
helper_lscbx()function isn't called anywhere. It used to be used by the PPC 601 CPU support; we removed that in commit005b69fdccin 2022 but missed this helper function.Fixes 005b69fdcc ("target/ppc: Remove PowerPC 601 CPUs")Signed-off-by Peter Maydell <[email protected]>Quoted 7 lines
---
This came to my attention because Coverity reported a "shifts into sign bit" issue in the function: CID 1663681--- target/ppc/helper.h | 1 - target/ppc/mem_helper.c | 28 ---------------------------- 2 files changed, 29 deletions(-)"git grep lscbx" returns only the declaration in
helper.hand the definition inmem_helper.c-- no TCG translator references, nogen_lscbx, nothing intranslate.c. Confirmed dead code with zero callers. Thanks for the cleanup.Reviewed-by Amit Machhiwal <[email protected]>Thanks,
AmitQuoted 1 line
Quoted 5 lines
target/ppc/helper.h DEF_HELPER_FLAGS_2(dcbzl, TCG_CALL_NO_WG, void, env,
Quoted 5 lines
target/ppc/helper.h +0
-0@@ -54,7 +54,6 @@ DEF_HELPER_FLAGS_2(dcbzl, TCG_CALL_NO_WG, void, env,tl)
Quoted 5 lines
Quoted 5 lines
target/ppc/helper.h +0
-1#endif DEF_HELPER_FLAGS_2(icbi, TCG_CALL_NO_WG, void, env, tl)DEF_HELPER_FLAGS_2 (icbiep,TCG_CALL_NO_WG , void, env, tl) -DEF_HELPER_5 (lscbx, tl, env, tl, i32, i32, i32)Quoted 7 lines
target/ppc/mem_helper.c void helper_icbiep(CPUPPCState *env, target_ulong
Quoted 7 lines
target/ppc/helper.h +0
-0#if defined(TARGET_PPC64 )DEF_HELPER_4 (DIVDEU , i64, env, i64, i64, i32)target/ppc/mem_helper.c +0
-0@@ -367,34 +367,6 @@ void helper_icbiep(CPUPPCState *env, target_ulongaddr)
Quoted 5 lines
target/ppc/mem_helper.c void helper_icbiep(CPUPPCState *env, target_ulong addr)
Quoted 5 lines
target/ppc/mem_helper.c +0
-2#endif } -/* XXX: to be tested */ -target_ulong helper_lscbx(CPUPPCState *env, target_ulong addr,
uint32_treg,Quoted 19 lines
Quoted 19 lines
target/ppc/mem_helper.c +0
-19- uint32_t ra, uint32_t rb) -{ - int i, c, d; - - d =24 ; -for (i =0 ; i < xer_bc; i++) { - c =cpu_ldub_data_ra (env, addr,GETPC ()); - addr =addr_add (env, addr,1 ); -/* ra (if not 0) and rb are never modified */ -if (likely (reg != rb && (ra ==0 || reg != ra))) { - env->gpr[reg] = (env->gpr[reg] & ~(0xFF << d)) | (c << d); - } -if (unlikely (c == xer_cmp)) { -break ; - } -if (likely (d !=0 )) { - d -=8 ; - }else { - d =24 ;Quoted 8 lines
target/ppc/mem_helper.c void helper_icbiep(CPUPPCState *env, target_ulong addr)
Quoted 8 lines
target/ppc/mem_helper.c +0
-7- reg++; - reg = reg &0x1F ; - } - } -return i; -} -/*****************************************************************************/
Quoted 4 lines
Quoted 4 lines
target/ppc/mem_helper.c +0
-1/* Altivec extension helpers */ #if HOST_BIG_ENDIAN --2.43.0
Quoted 5 lines · Harsh Prateek Bora
Hi Peter,
I am travelling till July end.
If it's urgent, Could you please take it via your next PR or I can take it via next PPC PR in August.
It's not super urgent, but I'm happy to pick it up via my tree as it's a pretty small safe change.
thanks
-- PMM
Quoted 12 lines · Peter Maydell,
Quoted 5 lines · Harsh Prateek Bora
Hi Peter,
I am travelling till July end.
If it's urgent, Could you please take it via your next PR or I can takeit via next PPC PR in August.
It's not super urgent, but I'm happy to pick it up via my tree as it's a pretty small safe change.
Sure, thanks Peter.
Regards
Harsh
Quoted 3 lines
thanks
-- PMM