All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-s390x@nongnu.org
Subject: [PATCH] target/s390x: Optimize save_link_info() using extract() TCG opcode
Date: Sun,  3 Oct 2021 16:29:22 +0200	[thread overview]
Message-ID: <20211003142922.3678039-1-f4bug@amsat.org> (raw)

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



             reply	other threads:[~2021-10-03 14:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-03 14:29 Philippe Mathieu-Daudé [this message]
2021-10-03 15:31 ` [PATCH] target/s390x: Optimize save_link_info() using extract() TCG opcode Richard Henderson
2021-10-03 15:51   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211003142922.3678039-1-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.