diff mbox series

[2/9] target/cris: Use tcg_gen_extract_tl

Message ID 20231023160944.10692-3-philmd@linaro.org
State New
Headers show
Series tcg: Use tcg_gen_[s]extract_{i32,i64,tl} | expand

Commit Message

Philippe Mathieu-Daudé Oct. 23, 2023, 4:09 p.m. UTC
Inspired-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/cris/translate.c     | 3 +--
 target/i386/tcg/translate.c | 9 +++------
 2 files changed, 4 insertions(+), 8 deletions(-)

Comments

Richard Henderson Oct. 23, 2023, 11:36 p.m. UTC | #1
On 10/23/23 09:09, Philippe Mathieu-Daudé wrote:
> Inspired-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/cris/translate.c     | 3 +--
>   target/i386/tcg/translate.c | 9 +++------
>   2 files changed, 4 insertions(+), 8 deletions(-)

Accidental merge of two patches, but they both look fine.  :-)

With the split, to both:
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
Edgar E. Iglesias Oct. 24, 2023, 8:44 a.m. UTC | #2
On Tue, Oct 24, 2023 at 1:36 AM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On 10/23/23 09:09, Philippe Mathieu-Daudé wrote:
> > Inspired-by: Richard Henderson <richard.henderson@linaro.org>
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > ---
> >   target/cris/translate.c     | 3 +--
> >   target/i386/tcg/translate.c | 9 +++------
> >   2 files changed, 4 insertions(+), 8 deletions(-)
>
> Accidental merge of two patches, but they both look fine.  :-)
>
> With the split, to both:
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
>
>
CRIS part looks good with Richard's request to split:
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>



> r~
>
diff mbox series

Patch

diff --git a/target/cris/translate.c b/target/cris/translate.c
index b3974ba0bb..65b07e1d80 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -871,8 +871,7 @@  static void gen_tst_cc (DisasContext *dc, TCGv cc, int cond)
                 bits = 15;
             }
 
-            tcg_gen_shri_tl(cc, cc_result, bits);
-            tcg_gen_andi_tl(cc, cc, 1);
+            tcg_gen_extract_tl(cc, cc_result, bits, 1);
         } else {
             cris_evaluate_flags(dc);
             tcg_gen_andi_tl(cc, cpu_PR[PR_CCS],
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 587d88692a..25289eeec9 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -1159,8 +1159,7 @@  static void gen_setcc1(DisasContext *s, int b, TCGv reg)
 
     if (cc.cond == TCG_COND_NE && !cc.use_reg2 && cc.imm == 0 &&
         cc.mask != 0 && (cc.mask & (cc.mask - 1)) == 0) {
-        tcg_gen_shri_tl(reg, cc.reg, ctztl(cc.mask));
-        tcg_gen_andi_tl(reg, reg, 1);
+        tcg_gen_extract_tl(reg, cc.reg, ctztl(cc.mask), 1);
         return;
     }
     if (cc.mask != -1) {
@@ -1783,8 +1782,7 @@  static void gen_rot_rm_T1(DisasContext *s, MemOp ot, int op1, int is_right)
        currently dead.  */
     if (is_right) {
         tcg_gen_shri_tl(cpu_cc_src2, s->T0, mask - 1);
-        tcg_gen_shri_tl(cpu_cc_dst, s->T0, mask);
-        tcg_gen_andi_tl(cpu_cc_dst, cpu_cc_dst, 1);
+        tcg_gen_extract_tl(cpu_cc_dst, s->T0, mask, 1);
     } else {
         tcg_gen_shri_tl(cpu_cc_src2, s->T0, mask);
         tcg_gen_andi_tl(cpu_cc_dst, s->T0, 1);
@@ -1873,8 +1871,7 @@  static void gen_rot_rm_im(DisasContext *s, MemOp ot, int op1, int op2,
            currently dead.  */
         if (is_right) {
             tcg_gen_shri_tl(cpu_cc_src2, s->T0, mask - 1);
-            tcg_gen_shri_tl(cpu_cc_dst, s->T0, mask);
-            tcg_gen_andi_tl(cpu_cc_dst, cpu_cc_dst, 1);
+            tcg_gen_extract_tl(cpu_cc_dst, s->T0, mask, 1);
         } else {
             tcg_gen_shri_tl(cpu_cc_src2, s->T0, mask);
             tcg_gen_andi_tl(cpu_cc_dst, s->T0, 1);