Re: [PATCH 08/12] target/ppc: Use gvec to decode XV[N]ABS[DS]P/XVNEG[DS]P

2022-09-24 Thread Richard Henderson

On 9/23/22 21:47, Lucas Mateus Castro(alqotel) wrote:

+static void xv_msb_op1(unsigned vece, TCGv_vec t, TCGv_vec b,
+ void (*tcg_gen_op_vec)(unsigned, TCGv_vec, TCGv_vec, 
TCGv_vec))
+{
+TCGv_vec most_significant_bit = tcg_temp_new_vec_matching(t);
+uint64_t msb = (vece == MO_32) ? SGN_MASK_SP : SGN_MASK_DP;
+tcg_gen_dupi_vec(vece, most_significant_bit, msb);
+tcg_gen_op_vec(vece, t, b, most_significant_bit);
+tcg_temp_free_vec(most_significant_bit);
+}


tcg_constant_vec_matching.  Otherwise,
Reviewed-by: Richard Henderson 

r~



[PATCH 08/12] target/ppc: Use gvec to decode XV[N]ABS[DS]P/XVNEG[DS]P

2022-09-23 Thread Lucas Mateus Castro(alqotel)
From: "Lucas Mateus Castro (alqotel)" 

Moved XVABSSP, XVABSDP, XVNABSSP,XVNABSDP, XVNEGSP and XVNEGDP to
decodetree and used gvec to translate them.

xvabssp:
reptloopmaster patch
8   12500   0,00477900 0,00476000 (-0.4%)
25  40000,00442800 0,00353300 (-20.2%)
100 10000,00478700 0,00366100 (-23.5%)
500 200 0,00973200 0,00649400 (-33.3%)
250040  0,03165200 0,02226700 (-29.7%)
800012  0,09315900 0,06674900 (-28.3%)

xvabsdp:
reptloopmaster patch
8   12500   0,00475000 0,00474400 (-0.1%)
25  40000,00355600 0,00367500 (+3.3%)
100 10000,00444200 0,00366000 (-17.6%)
500 200 0,00942700 0,00732400 (-22.3%)
250040  0,0299 0,02308500 (-22.8%)
800012  0,08770300 0,06683800 (-23.8%)

xvnabssp:
reptloopmaster patch
8   12500   0,00494500 0,00492900 (-0.3%)
25  40000,00397700 0,00338600 (-14.9%)
100 10000,00421400 0,00353500 (-16.1%)
500 200 0,01048000 0,00707100 (-32.5%)
250040  0,03251500 0,02238300 (-31.2%)
800012  0,08889100 0,06469800 (-27.2%)

xvnabsdp:
reptloopmaster patch
8   12500   0,00511000 0,00492700 (-3.6%)
25  40000,00398800 0,00381500 (-4.3%)
100 10000,00390500 0,00365900 (-6.3%)
500 200 0,00924800 0,00784600 (-15.2%)
250040  0,03138900 0,02391600 (-23.8%)
800012  0,09654200 0,05684600 (-41.1%)

xvnegsp:
reptloopmaster patch
8   12500   0,00493900 0,00452800 (-8.3%)
25  40000,00369100 0,00366800 (-0.6%)
100 10000,00371100 0,0038 (+2.4%)
500 200 0,00991100 0,00652300 (-34.2%)
250040  0,03025800 0,02422300 (-19.9%)
800012  0,09251100 0,06457600 (-30.2%)

xvnegdp:
reptloopmaster patch
8   12500   0,00474900 0,00454400 (-4.3%)
25  40000,00353100 0,00325600 (-7.8%)
100 10000,00398600 0,00366800 (-8.0%)
500 200 0,01032300 0,00702400 (-32.0%)
250040  0,03125000 0,02422400 (-22.5%)
800012  0,09475100 0,06173000 (-34.9%)

This one to me seemed the opposite of the previous instructions, as it
looks like there was an improvement in the translation time (itself not
a surprise as operations were done twice before so there was the need to
translate twice as many TCGop)

Signed-off-by: Lucas Mateus Castro (alqotel) 
---
 target/ppc/insn32.decode|  9 
 target/ppc/translate/vsx-impl.c.inc | 76 ++---
 target/ppc/translate/vsx-ops.c.inc  |  6 ---
 3 files changed, 79 insertions(+), 12 deletions(-)

diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode
index ae151c4b62..5b687078be 100644
--- a/target/ppc/insn32.decode
+++ b/target/ppc/insn32.decode
@@ -754,6 +754,15 @@ STXVRHX 01 . . . 0010101101 .   
@X_TSX
 STXVRWX 01 . . . 0011001101 .   @X_TSX
 STXVRDX 01 . . . 0011101101 .   @X_TSX
 
+## VSX Vector Binary Floating-Point Sign Manipulation Instructions
+
+XVABSDP 00 . 0 . 111011001 ..   @XX2
+XVABSSP 00 . 0 . 110011001 ..   @XX2
+XVNABSDP00 . 0 . 01001 ..   @XX2
+XVNABSSP00 . 0 . 110101001 ..   @XX2
+XVNEGDP 00 . 0 . 11001 ..   @XX2
+XVNEGSP 00 . 0 . 110111001 ..   @XX2
+
 ## VSX Scalar Multiply-Add Instructions
 
 XSMADDADP   00 . . . 0011 . . . @XX3
diff --git a/target/ppc/translate/vsx-impl.c.inc 
b/target/ppc/translate/vsx-impl.c.inc
index 7acdbceec4..426a9a3926 100644
--- a/target/ppc/translate/vsx-impl.c.inc
+++ b/target/ppc/translate/vsx-impl.c.inc
@@ -782,15 +782,79 @@ static void glue(gen_, name)(DisasContext *ctx)   
   \
 tcg_temp_free_i64(sgm);  \
 }
 
-VSX_VECTOR_MOVE(xvabsdp, OP_ABS, SGN_MASK_DP)
-VSX_VECTOR_MOVE(xvnabsdp, OP_NABS, SGN_MASK_DP)
-VSX_VECTOR_MOVE(xvnegdp, OP_NEG, SGN_MASK_DP)
 VSX_VECTOR_MOVE(xvcpsgndp, OP_CPSGN, SGN_MASK_DP)
-VSX_VECTOR_MOVE(xvabssp, OP_ABS, SGN_MASK_SP)
-VSX_VECTOR_MOVE(xvnabssp, OP_NABS, SGN_MASK_SP)
-VSX_VECTOR_MOVE(xvnegsp, OP_NEG, SGN_MASK_SP)
 VSX_VECTOR_MOVE(xvcpsgnsp, OP_CPSGN, SGN_MASK_SP)
 
+#define TCG_OP_IMM_i64(FUNC, OP, IMM)   \
+static void FUNC(TCGv_i64 t, TCGv_i64 b)\
+{   \
+OP(t, b, IMM);  \
+}
+
+TCG_OP_IMM_i64(do_xvabssp_i64, tcg_gen_andi_i64, ~SGN_MASK_SP)