target/m68k: Optimize shift_mem() using extract() TCG opcode
PATCH 1/1 target/m68k: Optimize shift_mem() using extract() TCG opcode
When running the scripts/coccinelle/tcg_gen_extract.cocci Coccinelle semantic patch on target/m68k/, we get:
[DBG] candidate at target/m68k/translate.c:3668
Manually inspect and replace combinations of (shri, andi) and (movi, andi) opcodes by the extract opcode.
--- target/m68k/translate.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
target/m68k/translate.c +2 -3
@@ -3665,7 +3665,7 @@ DISAS_INSN(shift_mem)SRC_EA (env, src,OS_WORD , !logical, &addr);tcg_gen_movi_i32 (QREG_CC_V ,0 );if (left) { -tcg_gen_shri_i32 (QREG_CC_C , src,15 ); +tcg_gen_extract_i32 (QREG_CC_C , src,15 ,1 );tcg_gen_shli_i32 (QREG_CC_N , src,1 );/*
@@ -3678,7 +3678,7 @@ DISAS_INSN(shift_mem)tcg_gen_xor_i32 (QREG_CC_V ,QREG_CC_N , src); } }else { -tcg_gen_mov_i32 (QREG_CC_C , src); +tcg_gen_extract_i32 (QREG_CC_C , src,0 ,1 );if (logical) {tcg_gen_shri_i32 (QREG_CC_N , src,1 ); }else {
@@ -3687,7 +3687,6 @@ DISAS_INSN(shift_mem) }gen_ext (QREG_CC_N ,QREG_CC_N ,OS_WORD ,1 ); -tcg_gen_andi_i32 (QREG_CC_C ,QREG_CC_C ,1 );tcg_gen_mov_i32 (QREG_CC_Z ,QREG_CC_N );tcg_gen_mov_i32 (QREG_CC_X ,QREG_CC_C );
Signature · 1 line
2.31.1
Quoted 5 lines · Philippe Mathieu-Daudé
When running the
scripts/coccinelle/tcg_gen_extract.cocciCoccinelle semantic patch on target/m68k/, we get:[DBG] candidate at target/m68k/translate.c:3668
Quoted 7 lines
Manually inspect and replace combinations of (shri, andi) and (movi, andi) opcodes by the extract opcode.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/m68k/translate.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
r~
Quoted 9 lines · Richard Henderson
Quoted 8 lines · Philippe Mathieu-Daudé
When running the
scripts/coccinelle/tcg_gen_extract.cocciCoccinelle semantic patch on target/m68k/, we get:[DBG] candidate at
target/m68k/translate.c:3668Manually inspect and replace combinations of (shri, andi) and (movi, andi) opcodes by the extract opcode.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
target/m68k/translate.c| 5 ++---1 file changed, 2 insertions(+), 3 deletions(-)Reviewed-by Richard Henderson <[email protected]>
Another candidate for tcg-next :)