* [PATCH] target/s390x: Optimize save_link_info() using extract() TCG opcode
@ 2021-10-03 14:29 Philippe Mathieu-Daudé
2021-10-03 15:31 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-10-03 14:29 UTC (permalink / raw)
To: qemu-devel
Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
Philippe Mathieu-Daudé,
qemu-s390x
When running the scripts/coccinelle/tcg_gen_extract.cocci
Coccinelle semantic patch on target/s390x/, we get:
[DBG] candidate at target/s390x/tcg/translate.c:1560
Manually inspect and replace combinations of (shri, andi)
opcodes by the extract opcode.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/s390x/tcg/translate.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index f284870cd2f..bfd805920c6 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -1557,8 +1557,7 @@ static void save_link_info(DisasContext *s, DisasOps *o)
tcg_gen_andi_i64(o->out, o->out, 0xffffffff00000000ull);
tcg_gen_ori_i64(o->out, o->out, ((s->ilen / 2) << 30) | s->pc_tmp);
t = tcg_temp_new_i64();
- tcg_gen_shri_i64(t, psw_mask, 16);
- tcg_gen_andi_i64(t, t, 0x0f000000);
+ tcg_gen_extract_i64(t, psw_mask, 40, 4);
tcg_gen_or_i64(o->out, o->out, t);
tcg_gen_extu_i32_i64(t, cc_op);
tcg_gen_shli_i64(t, t, 28);
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/s390x: Optimize save_link_info() using extract() TCG opcode
2021-10-03 14:29 [PATCH] target/s390x: Optimize save_link_info() using extract() TCG opcode Philippe Mathieu-Daudé
@ 2021-10-03 15:31 ` Richard Henderson
2021-10-03 15:51 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2021-10-03 15:31 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-s390x, Cornelia Huck, Thomas Huth, David Hildenbrand
On 10/3/21 10:29 AM, Philippe Mathieu-Daudé wrote:
> - tcg_gen_shri_i64(t, psw_mask, 16);
> - tcg_gen_andi_i64(t, t, 0x0f000000);
> + tcg_gen_extract_i64(t, psw_mask, 40, 4);
No, the result should not be at bit 0, but bit 24.
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/s390x: Optimize save_link_info() using extract() TCG opcode
2021-10-03 15:31 ` Richard Henderson
@ 2021-10-03 15:51 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-10-03 15:51 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
Cc: qemu-s390x, Cornelia Huck, Thomas Huth, David Hildenbrand
On 10/3/21 17:31, Richard Henderson wrote:
> On 10/3/21 10:29 AM, Philippe Mathieu-Daudé wrote:
>> - tcg_gen_shri_i64(t, psw_mask, 16);
>> - tcg_gen_andi_i64(t, t, 0x0f000000);
>> + tcg_gen_extract_i64(t, psw_mask, 40, 4);
>
> No, the result should not be at bit 0, but bit 24.
Good catch. I was no sure about that one, should have tagged RFC.
Thanks for the multiple reviews!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-03 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 14:29 [PATCH] target/s390x: Optimize save_link_info() using extract() TCG opcode Philippe Mathieu-Daudé
2021-10-03 15:31 ` Richard Henderson
2021-10-03 15:51 ` Philippe Mathieu-Daudé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.