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é <f4...@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 via email to