[Qemu-devel] [PATCH] tcg: optimize gen_extr_i64_i32()

Philippe Mathieu-Daudé posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170513002906.31201-1-f4bug@amsat.org
Test checkpatch passed
Test docker passed
Test s390x passed
tcg/tcg-op.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[Qemu-devel] [PATCH] tcg: optimize gen_extr_i64_i32()
Posted by Philippe Mathieu-Daudé 6 years, 10 months ago
Inspired by Richard Henderson comment:

    http://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg02277.html

Patch applied mechanically with this coccinelle semantic patch:

    @@
    expression lo, hi,arg;
    @@
    -tcg_gen_extrl_i64_i32(lo, arg);
    -tcg_gen_extrh_i64_i32(hi, arg);
    +tcg_gen_extr_i64_i32(lo, hi, arg);

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tcg/tcg-op.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 6b1f41500c..f3d556c21a 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -2562,8 +2562,7 @@ void tcg_gen_extr_i64_i32(TCGv_i32 lo, TCGv_i32 hi, TCGv_i64 arg)
         tcg_gen_mov_i32(lo, TCGV_LOW(arg));
         tcg_gen_mov_i32(hi, TCGV_HIGH(arg));
     } else {
-        tcg_gen_extrl_i64_i32(lo, arg);
-        tcg_gen_extrh_i64_i32(hi, arg);
+        tcg_gen_extr_i64_i32(lo, hi, arg);
     }
 }
 
-- 
2.11.0


Re: [Qemu-devel] [PATCH] tcg: optimize gen_extr_i64_i32()
Posted by Richard Henderson 6 years, 10 months ago
On 05/12/2017 05:29 PM, Philippe Mathieu-Daudé wrote:
> Inspired by Richard Henderson comment:
> 
>      http://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg02277.html
> 
> Patch applied mechanically with this coccinelle semantic patch:
> 
>      @@
>      expression lo, hi,arg;
>      @@
>      -tcg_gen_extrl_i64_i32(lo, arg);
>      -tcg_gen_extrh_i64_i32(hi, arg);
>      +tcg_gen_extr_i64_i32(lo, hi, arg);
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   tcg/tcg-op.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
> index 6b1f41500c..f3d556c21a 100644
> --- a/tcg/tcg-op.c
> +++ b/tcg/tcg-op.c
> @@ -2562,8 +2562,7 @@ void tcg_gen_extr_i64_i32(TCGv_i32 lo, TCGv_i32 hi, TCGv_i64 arg)
>           tcg_gen_mov_i32(lo, TCGV_LOW(arg));
>           tcg_gen_mov_i32(hi, TCGV_HIGH(arg));
>       } else {
> -        tcg_gen_extrl_i64_i32(lo, arg);
> -        tcg_gen_extrh_i64_i32(hi, arg);
> +        tcg_gen_extr_i64_i32(lo, hi, arg);

You've just created an instance of infinite self-recursion.


r~

Re: [Qemu-devel] [PATCH] tcg: optimize gen_extr_i64_i32()
Posted by Philippe Mathieu-Daudé 6 years, 10 months ago
On 05/12/2017 11:13 PM, Richard Henderson wrote:
> On 05/12/2017 05:29 PM, Philippe Mathieu-Daudé wrote:
>> Inspired by Richard Henderson comment:
>>
>>
>> http://lists.nongnu.org/archive/html/qemu-devel/2017-05/msg02277.html
>>
>> Patch applied mechanically with this coccinelle semantic patch:
>>
>>      @@
>>      expression lo, hi,arg;
>>      @@
>>      -tcg_gen_extrl_i64_i32(lo, arg);
>>      -tcg_gen_extrh_i64_i32(hi, arg);
>>      +tcg_gen_extr_i64_i32(lo, hi, arg);
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   tcg/tcg-op.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
>> index 6b1f41500c..f3d556c21a 100644
>> --- a/tcg/tcg-op.c
>> +++ b/tcg/tcg-op.c
>> @@ -2562,8 +2562,7 @@ void tcg_gen_extr_i64_i32(TCGv_i32 lo, TCGv_i32
>> hi, TCGv_i64 arg)
>>           tcg_gen_mov_i32(lo, TCGV_LOW(arg));
>>           tcg_gen_mov_i32(hi, TCGV_HIGH(arg));
>>       } else {
>> -        tcg_gen_extrl_i64_i32(lo, arg);
>> -        tcg_gen_extrh_i64_i32(hi, arg);
>> +        tcg_gen_extr_i64_i32(lo, hi, arg);
>
> You've just created an instance of infinite self-recursion.

Now I understand why Eric writes "applied mechanically" then "verified 
manually" in his commits, it avoid to ask for non-sens review...