diff mbox series

[1/2] target/s390x: Use mutable temporary value for op_ts

Message ID 20240318162633.13017-1-iii@linux.ibm.com
State New
Headers show
Series [1/2] target/s390x: Use mutable temporary value for op_ts | expand

Commit Message

Ilya Leoshkevich March 18, 2024, 4:26 p.m. UTC
From: Ido Plat <ido.plat@ibm.com>

Otherwise TCG would assume the register that holds t1 would be constant
and reuse whenever it needs the value within it.

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
[iii: Adjust a newline and capitalization]
Signed-off-by: Ido Plat <ido.plat@ibm.com>
---
 target/s390x/tcg/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thomas Huth March 18, 2024, 4:33 p.m. UTC | #1
On 18/03/2024 17.26, Ilya Leoshkevich wrote:
> From: Ido Plat <ido.plat@ibm.com>
> 
> Otherwise TCG would assume the register that holds t1 would be constant
> and reuse whenever it needs the value within it.
> 
> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
> [iii: Adjust a newline and capitalization]
> Signed-off-by: Ido Plat <ido.plat@ibm.com>

  Hi Ilya,

please add your Signed-off-by as well when the patch is sent out by you.

  Thanks,
   Thomas
Richard Henderson March 18, 2024, 5:32 p.m. UTC | #2
On 3/18/24 06:26, Ilya Leoshkevich wrote:
> From: Ido Plat <ido.plat@ibm.com>
> 
> Otherwise TCG would assume the register that holds t1 would be constant
> and reuse whenever it needs the value within it.
> 
> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
> [iii: Adjust a newline and capitalization]
> Signed-off-by: Ido Plat <ido.plat@ibm.com>
> ---
>   target/s390x/tcg/translate.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
> index 0d0c672c959..3fdddac7684 100644
> --- a/target/s390x/tcg/translate.c
> +++ b/target/s390x/tcg/translate.c
> @@ -4781,8 +4781,9 @@ static DisasJumpType op_trXX(DisasContext *s, DisasOps *o)
>   
>   static DisasJumpType op_ts(DisasContext *s, DisasOps *o)
>   {
> -    TCGv_i32 t1 = tcg_constant_i32(0xff);
> +    TCGv_i32 t1 = tcg_temp_new_i32();
>   
> +    tcg_gen_movi_i32(t1, 0xff);
>       tcg_gen_atomic_xchg_i32(t1, o->in2, t1, get_mem_index(s), MO_UB);

Better as

     TCGv_i32 ff = tcg_constant_i32(0xff);
     TCGv_i32 t1 = tcg_temp_new_i32();

     tcg_gen_atomic_xchg_i32(t1, o->in2, ff, get_mem_index(s), MO_UB);

With that,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index 0d0c672c959..3fdddac7684 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -4781,8 +4781,9 @@  static DisasJumpType op_trXX(DisasContext *s, DisasOps *o)
 
 static DisasJumpType op_ts(DisasContext *s, DisasOps *o)
 {
-    TCGv_i32 t1 = tcg_constant_i32(0xff);
+    TCGv_i32 t1 = tcg_temp_new_i32();
 
+    tcg_gen_movi_i32(t1, 0xff);
     tcg_gen_atomic_xchg_i32(t1, o->in2, t1, get_mem_index(s), MO_UB);
     tcg_gen_extract_i32(cc_op, t1, 7, 1);
     set_cc_static(s);