Message ID | 20250415192515.232910-85-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | tcg: Convert to TCGOutOp structures | expand |
On 4/15/25 12:23, Richard Henderson wrote: > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > tcg/ppc/tcg-target.c.inc | 21 +++++++-------------- > 1 file changed, 7 insertions(+), 14 deletions(-) > > diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc > index 1782d05290..669c5eae4a 100644 > --- a/tcg/ppc/tcg-target.c.inc > +++ b/tcg/ppc/tcg-target.c.inc > @@ -2206,8 +2206,8 @@ static void tcg_out_cntxz(TCGContext *s, TCGType type, uint32_t opc, > } > } > > -static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, > - const int *const_args) > +static void tcg_out_cmp2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah, > + TCGArg bl, bool blconst, TCGArg bh, bool bhconst) > { > static const struct { uint8_t bit1, bit2; } bits[] = { > [TCG_COND_LT ] = { CR_LT, CR_LT }, > @@ -2220,18 +2220,9 @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, > [TCG_COND_GEU] = { CR_GT, CR_LT }, > }; > > - TCGCond cond = args[4], cond2; > - TCGArg al, ah, bl, bh; > - int blconst, bhconst; > + TCGCond cond2; > int op, bit1, bit2; > > - al = args[0]; > - ah = args[1]; > - bl = args[2]; > - bh = args[3]; > - blconst = const_args[2]; > - bhconst = const_args[3]; > - > switch (cond) { > case TCG_COND_EQ: > op = CRAND; > @@ -2286,7 +2277,8 @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, > static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, > const int *const_args) > { > - tcg_out_cmp2(s, args + 1, const_args + 1); > + tcg_out_cmp2(s, args[5], args[1], args[2], args[3], const_args[3], > + args[4], const_args[4]); > tcg_out32(s, MFOCRF | RT(TCG_REG_R0) | FXM(0)); > tcg_out_rlw(s, RLWINM, args[0], TCG_REG_R0, CR_EQ + 0*4 + 1, 31, 31); > } > @@ -2294,7 +2286,8 @@ static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, > static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, > const int *const_args) > { > - tcg_out_cmp2(s, args, const_args); > + tcg_out_cmp2(s, args[4], args[0], args[1], args[2], const_args[2], > + args[3], const_args[3]); > tcg_out_bc_lab(s, TCG_COND_EQ, arg_label(args[5])); > } > Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
On Wed Apr 16, 2025 at 5:23 AM AEST, Richard Henderson wrote: > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Looks equivalent. Reviewed-by: Nicholas Piggin <npiggin@gmail.com> > --- > tcg/ppc/tcg-target.c.inc | 21 +++++++-------------- > 1 file changed, 7 insertions(+), 14 deletions(-) > > diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc > index 1782d05290..669c5eae4a 100644 > --- a/tcg/ppc/tcg-target.c.inc > +++ b/tcg/ppc/tcg-target.c.inc > @@ -2206,8 +2206,8 @@ static void tcg_out_cntxz(TCGContext *s, TCGType type, uint32_t opc, > } > } > > -static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, > - const int *const_args) > +static void tcg_out_cmp2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah, > + TCGArg bl, bool blconst, TCGArg bh, bool bhconst) > { > static const struct { uint8_t bit1, bit2; } bits[] = { > [TCG_COND_LT ] = { CR_LT, CR_LT }, > @@ -2220,18 +2220,9 @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, > [TCG_COND_GEU] = { CR_GT, CR_LT }, > }; > > - TCGCond cond = args[4], cond2; > - TCGArg al, ah, bl, bh; > - int blconst, bhconst; > + TCGCond cond2; > int op, bit1, bit2; > > - al = args[0]; > - ah = args[1]; > - bl = args[2]; > - bh = args[3]; > - blconst = const_args[2]; > - bhconst = const_args[3]; > - > switch (cond) { > case TCG_COND_EQ: > op = CRAND; > @@ -2286,7 +2277,8 @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, > static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, > const int *const_args) > { > - tcg_out_cmp2(s, args + 1, const_args + 1); > + tcg_out_cmp2(s, args[5], args[1], args[2], args[3], const_args[3], > + args[4], const_args[4]); > tcg_out32(s, MFOCRF | RT(TCG_REG_R0) | FXM(0)); > tcg_out_rlw(s, RLWINM, args[0], TCG_REG_R0, CR_EQ + 0*4 + 1, 31, 31); > } > @@ -2294,7 +2286,8 @@ static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, > static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, > const int *const_args) > { > - tcg_out_cmp2(s, args, const_args); > + tcg_out_cmp2(s, args[4], args[0], args[1], args[2], const_args[2], > + args[3], const_args[3]); > tcg_out_bc_lab(s, TCG_COND_EQ, arg_label(args[5])); > } >
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 1782d05290..669c5eae4a 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -2206,8 +2206,8 @@ static void tcg_out_cntxz(TCGContext *s, TCGType type, uint32_t opc, } } -static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, - const int *const_args) +static void tcg_out_cmp2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah, + TCGArg bl, bool blconst, TCGArg bh, bool bhconst) { static const struct { uint8_t bit1, bit2; } bits[] = { [TCG_COND_LT ] = { CR_LT, CR_LT }, @@ -2220,18 +2220,9 @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, [TCG_COND_GEU] = { CR_GT, CR_LT }, }; - TCGCond cond = args[4], cond2; - TCGArg al, ah, bl, bh; - int blconst, bhconst; + TCGCond cond2; int op, bit1, bit2; - al = args[0]; - ah = args[1]; - bl = args[2]; - bh = args[3]; - blconst = const_args[2]; - bhconst = const_args[3]; - switch (cond) { case TCG_COND_EQ: op = CRAND; @@ -2286,7 +2277,8 @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, const int *const_args) { - tcg_out_cmp2(s, args + 1, const_args + 1); + tcg_out_cmp2(s, args[5], args[1], args[2], args[3], const_args[3], + args[4], const_args[4]); tcg_out32(s, MFOCRF | RT(TCG_REG_R0) | FXM(0)); tcg_out_rlw(s, RLWINM, args[0], TCG_REG_R0, CR_EQ + 0*4 + 1, 31, 31); } @@ -2294,7 +2286,8 @@ static void tcg_out_setcond2(TCGContext *s, const TCGArg *args, static void tcg_out_brcond2(TCGContext *s, const TCGArg *args, const int *const_args) { - tcg_out_cmp2(s, args, const_args); + tcg_out_cmp2(s, args[4], args[0], args[1], args[2], const_args[2], + args[3], const_args[3]); tcg_out_bc_lab(s, TCG_COND_EQ, arg_label(args[5])); }
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- tcg/ppc/tcg-target.c.inc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)