diff mbox series

[v3,14/38] target/s390x: Use TCG_COND_TSTNE for CC_OP_{TM,ICM}

Message ID 20240110224408.10444-15-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg: Introduce TCG_COND_TST{EQ,NE} | expand

Commit Message

Richard Henderson Jan. 10, 2024, 10:43 p.m. UTC
These are all test-and-compare type instructions.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/s390x/tcg/translate.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 19, 2024, 9:59 p.m. UTC | #1
On 10/1/24 23:43, Richard Henderson wrote:
> These are all test-and-compare type instructions.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/s390x/tcg/translate.c | 18 +++++++-----------
>   1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
> index 62ab2be8b1..ae4e7b27ec 100644
> --- a/target/s390x/tcg/translate.c
> +++ b/target/s390x/tcg/translate.c
> @@ -754,10 +754,10 @@ static void disas_jcc(DisasContext *s, DisasCompare *c, uint32_t mask)
>       case CC_OP_TM_64:
>           switch (mask) {
>           case 8:
> -            cond = TCG_COND_EQ;
> +            cond = TCG_COND_TSTEQ;
>               break;
>           case 4 | 2 | 1:
> -            cond = TCG_COND_NE;
> +            cond = TCG_COND_TSTNE;
>               break;
>           default:
>               goto do_dynamic;
> @@ -768,11 +768,11 @@ static void disas_jcc(DisasContext *s, DisasCompare *c, uint32_t mask)
>       case CC_OP_ICM:
>           switch (mask) {
>           case 8:
> -            cond = TCG_COND_EQ;
> +            cond = TCG_COND_TSTEQ;
>               break;
>           case 4 | 2 | 1:
>           case 4 | 2:
> -            cond = TCG_COND_NE;
> +            cond = TCG_COND_TSTNE;
>               break;
>           default:
>               goto do_dynamic;
> @@ -854,18 +854,14 @@ static void disas_jcc(DisasContext *s, DisasCompare *c, uint32_t mask)
>           c->u.s64.a = cc_dst;
>           c->u.s64.b = tcg_constant_i64(0);
>           break;
> +
>       case CC_OP_LTGT_64:
>       case CC_OP_LTUGTU_64:
> -        c->u.s64.a = cc_src;
> -        c->u.s64.b = cc_dst;
> -        break;
> -
>       case CC_OP_TM_32:
>       case CC_OP_TM_64:
>       case CC_OP_ICM:
> -        c->u.s64.a = tcg_temp_new_i64();
> -        c->u.s64.b = tcg_constant_i64(0);
> -        tcg_gen_and_i64(c->u.s64.a, cc_src, cc_dst);
> +        c->u.s64.a = cc_src;
> +        c->u.s64.b = cc_dst;
>           break;
>   
>       case CC_OP_ADDU:

To the best of my s390x knowledge:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index 62ab2be8b1..ae4e7b27ec 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -754,10 +754,10 @@  static void disas_jcc(DisasContext *s, DisasCompare *c, uint32_t mask)
     case CC_OP_TM_64:
         switch (mask) {
         case 8:
-            cond = TCG_COND_EQ;
+            cond = TCG_COND_TSTEQ;
             break;
         case 4 | 2 | 1:
-            cond = TCG_COND_NE;
+            cond = TCG_COND_TSTNE;
             break;
         default:
             goto do_dynamic;
@@ -768,11 +768,11 @@  static void disas_jcc(DisasContext *s, DisasCompare *c, uint32_t mask)
     case CC_OP_ICM:
         switch (mask) {
         case 8:
-            cond = TCG_COND_EQ;
+            cond = TCG_COND_TSTEQ;
             break;
         case 4 | 2 | 1:
         case 4 | 2:
-            cond = TCG_COND_NE;
+            cond = TCG_COND_TSTNE;
             break;
         default:
             goto do_dynamic;
@@ -854,18 +854,14 @@  static void disas_jcc(DisasContext *s, DisasCompare *c, uint32_t mask)
         c->u.s64.a = cc_dst;
         c->u.s64.b = tcg_constant_i64(0);
         break;
+
     case CC_OP_LTGT_64:
     case CC_OP_LTUGTU_64:
-        c->u.s64.a = cc_src;
-        c->u.s64.b = cc_dst;
-        break;
-
     case CC_OP_TM_32:
     case CC_OP_TM_64:
     case CC_OP_ICM:
-        c->u.s64.a = tcg_temp_new_i64();
-        c->u.s64.b = tcg_constant_i64(0);
-        tcg_gen_and_i64(c->u.s64.a, cc_src, cc_dst);
+        c->u.s64.a = cc_src;
+        c->u.s64.b = cc_dst;
         break;
 
     case CC_OP_ADDU: