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

Richard Henderson posted 38 patches 10 months, 1 week ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <laurent@vivier.eu>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, WANG Xuerui <git@xen0n.name>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Huacai Chen <chenhuacai@kernel.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <Alistair.Francis@wdc.com>, Stefan Weil <sw@weilnetz.de>
[PATCH v3 14/38] target/s390x: Use TCG_COND_TSTNE for CC_OP_{TM,ICM}
Posted by Richard Henderson 10 months, 1 week ago
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:
-- 
2.34.1
Re: [PATCH v3 14/38] target/s390x: Use TCG_COND_TSTNE for CC_OP_{TM,ICM}
Posted by Philippe Mathieu-Daudé 9 months, 4 weeks ago
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>