Ping: this has been reviewed, is somebody on the ppc side
going to pick it up ?

thanks
-- PMM

On Thu, 9 Jul 2026 at 15:46, Amit Machhiwal <[email protected]> wrote:
>
> On 2026/07/09 10:50 AM, Peter Maydell wrote:
> > 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.
> >
> > Fixes: 005b69fdcc ("target/ppc: Remove PowerPC 601 CPUs")
> > Signed-off-by: Peter Maydell <[email protected]>
> > ---
> > 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.
>
> Reviewed-by: Amit Machhiwal <[email protected]>
>
> Thanks,
> Amit
>
> >
> > diff --git a/target/ppc/helper.h b/target/ppc/helper.h
> > index e99c8c824b..6b2d19a3ad 100644
> > --- a/target/ppc/helper.h
> > +++ b/target/ppc/helper.h
> > @@ -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)
> > diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c
> > index 119dc1df23..787ba2cdec 100644
> > --- a/target/ppc/mem_helper.c
> > +++ b/target/ppc/mem_helper.c
> > @@ -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

Reply via email to