POWER9 TCG enablements - part11
cover POWER9 TCG enablements - part11
This series contains 10 new instructions for POWER9 ISA3.0
VSX Scalar Insert Exponent
VSX Vector Insert Exponent
VSX Vector Extract Exponent/Significand
VSX Scalar Truncate & Convert Quad-Precision Couple of fixes
Bharata B Rao (2):
softfloat: Fix the default qNAN for target-ppc
target-ppc: Add xscvqps[d,w]z instructions
Nikunj A Dadhania (9):
target-ppc: xscvqpdp zero VSR
target-ppc: Add xsiexpdp instruction
target-ppc: Add xsiexpqp instruction
target-ppc: Add xviexpsp instruction
target-ppc: Add xviexpdp instruction
target-ppc: Add xvxexpsp instruction
target-ppc: Add xvxexpdp instruction
target-ppc: Add xvxsigsp instruction
target-ppc: Add xvxsigdp instruction
fpu/softfloat-specialize.h | 2 +- target/ppc/fpu_helper.c | 62 ++++++++++++- target/ppc/helper.h | 3 + target/ppc/translate/vsx-impl.inc.c | 172 ++++++++++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 11 +++ 5 files changed, 248 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/11 target-ppc: xscvqpdp zero VSR
--- target/ppc/fpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/fpu_helper.c +1 -1
@@ -2787,7 +2787,7 @@ void helper_xscvqpdp(CPUPPCState *env, uint32_t opcode)ppc_vsr_t xt, xb;getVSR (rB (opcode) +32 , &xb, env); -getVSR (rD (opcode) +32 , &xt, env); +memset (&xt,0 ,sizeof (xt));if (unlikely (Rc (opcode) !=0 )) {/* TODO: Support xscvqpdpo after round-to-odd is implemented */
Signature · 1 line
2.7.4
PATCH 2/11 softfloat: Fix the default qNAN for target-ppc
In reply to Nikunj A DadhaniaFrom: Bharata B Rao <[email protected]>
Currently float128_default_nan() returns 0xFFFF800000000000 in the higher double word, but it should return 0x7FFF800000000000 which is the correct higher double word for default qNAN on PowerPC.
--- fpu/softfloat-specialize.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fpu/softfloat-specialize.h +1 -1
@@ -181,7 +181,7 @@ float128 float128_default_nan(float_status *status) r.high =LIT64 (0x7FFF7FFFFFFFFFFF ); }else { r.low =LIT64 (0x0000000000000000 ); -#if defined(TARGET_S390X ) +#if defined(TARGET_S390X ) || defined(TARGET_PPC ) r.high =LIT64 (0x7FFF800000000000 );#else r.high =LIT64 (0xFFFF800000000000 );
Signature · 1 line
2.7.4
PATCH 3/11 target-ppc: Add xsiexpdp instruction
In reply to Nikunj A Dadhaniaxsiexpdp: VSX Scalar Insert Exponent Double Precision
--- target/ppc/translate/vsx-impl.inc.c | 20 ++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 21 insertions(+)
target/ppc/translate/vsx-impl.inc.c +20 -0
@@ -1243,6 +1243,26 @@ static void gen_xsxexpqp(DisasContext *ctx)tcg_gen_movi_i64 (xtl,0 ); } +static void gen_xsiexpdp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv ra = cpu_gpr[rA (ctx->opcode)]; +TCGv rb = cpu_gpr[rB (ctx->opcode)]; +TCGv_i64 t0; + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + t0 =tcg_temp_new_i64 (); +tcg_gen_andi_i64 (xth, ra,0x800FFFFFFFFFFFFF ); +tcg_gen_andi_i64 (t0, rb,0x7FF ); +tcg_gen_shli_i64 (t0, t0,52 ); +tcg_gen_or_i64 (xth, xth, t0); +/* dword[1] is undefined */ +tcg_temp_free_i64 (t0); +} +static void gen_xsxsigdp (DisasContext *ctx) {TCGv rt = cpu_gpr[rD (ctx->opcode)];
target/ppc/translate/vsx-ops.inc.c +1 -0
@@ -120,6 +120,7 @@ GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300),GEN_VSX_XFORM_300_EO (xsxexpqp,0x04 ,0x19 ,0x02 ,0x00000001 ),GEN_XX2FORM_EO (xsxsigdp,0x16 ,0x15 ,0x01 ,PPC2_ISA300 ),GEN_VSX_XFORM_300_EO (xsxsigqp,0x04 ,0x19 ,0x12 ,0x00000001 ), +GEN_HANDLER_E (xsiexpdp,0x3C ,0x16 ,0x1C ,0 ,PPC_NONE ,PPC2_ISA300 ), #endif GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX),
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH 03/11] target-ppc: Add xsiexpdp instruction
Quoted 23 lines · Nikunj A Dadhania
xsiexpdp: VSX Scalar Insert Exponent Double Precision
Signed-off-by Nikunj A Dadhania <[email protected]>--- target/ppc/translate/vsx-impl.inc.c | 20 ++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 21 insertions(+)target/ppc/translate/vsx-impl.inc.c +7
-0@@ -1243,6 +1243,26 @@ static void gen_xsxexpqp(DisasContext *ctx)tcg_gen_movi_i64 (xtl,0 ); } +static void gen_xsiexpdp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv ra = cpu_gpr[rA (ctx->opcode)]; +TCGv rb = cpu_gpr[rB (ctx->opcode)]; +TCGv_i64 t0; +
target/ppc/translate/vsx-impl.inc.c static void gen_xsxexpqp(DisasContext *ctx) · line 1262
Quoted 10 lines
target/ppc/translate/vsx-impl.inc.c +10
-0+if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + t0 =tcg_temp_new_i64 (); +tcg_gen_andi_i64 (xth, ra,0x800FFFFFFFFFFFFF ); +tcg_gen_andi_i64 (t0, rb,0x7FF ); +tcg_gen_shli_i64 (t0, t0,52 ); +tcg_gen_or_i64 (xth, xth, t0); +/* dword[1] is undefined */
According to the ISA doc I have, dword[1] is set to 0 rather than being undefined.
Quoted 18 lines
target/ppc/translate/vsx-impl.inc.c +3
-0+tcg_temp_free_i64 (t0); +} +static void gen_xsxsigdp (DisasContext *ctx) {TCGv rt = cpu_gpr[rD (ctx->opcode)];target/ppc/translate/vsx-ops.inc.c +1
-0@@ -120,6 +120,7 @@ GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300),GEN_VSX_XFORM_300_EO (xsxexpqp,0x04 ,0x19 ,0x02 ,0x00000001 ),GEN_XX2FORM_EO (xsxsigdp,0x16 ,0x15 ,0x01 ,PPC2_ISA300 ),GEN_VSX_XFORM_300_EO (xsxsigqp,0x04 ,0x19 ,0x12 ,0x00000001 ), +GEN_HANDLER_E (xsiexpdp,0x3C ,0x16 ,0x1C ,0 ,PPC_NONE ,PPC2_ISA300 ), #endif GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX),
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 03/11] target-ppc: Add xsiexpdp instruction
Quoted 30 lines · David Gibson
[ Unknown signature status ]
Quoted 28 lines · Nikunj A Dadhania
xsiexpdp: VSX Scalar Insert Exponent Double Precision
Signed-off-by Nikunj A Dadhania <[email protected]>--- target/ppc/translate/vsx-impl.inc.c | 20 ++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 21 insertions(+)target/ppc/translate/vsx-impl.inc.c +12
-0@@ -1243,6 +1243,26 @@ static void gen_xsxexpqp(DisasContext *ctx)tcg_gen_movi_i64 (xtl,0 ); } +static void gen_xsiexpdp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv ra = cpu_gpr[rA (ctx->opcode)]; +TCGv rb = cpu_gpr[rB (ctx->opcode)]; +TCGv_i64 t0; + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + t0 =tcg_temp_new_i64 ();
Quoted 8 lines
target/ppc/translate/vsx-impl.inc.c static void gen_xsxexpqp(DisasContext *ctx) · line 1262
Quoted 5 lines
target/ppc/translate/vsx-impl.inc.c +5
-0+tcg_gen_andi_i64 (xth, ra,0x800FFFFFFFFFFFFF ); +tcg_gen_andi_i64 (t0, rb,0x7FF ); +tcg_gen_shli_i64 (t0, t0,52 ); +tcg_gen_or_i64 (xth, xth, t0); +/* dword[1] is undefined */ According to the ISA doc I have, dword[1] is set to 0 rather than being undefined.
Referring to xsiexpdp on page 570:
"The contents of doubleword element 1 of VSR[XT] are undefined."
The revision that I have is dated November 30, 2015
Regards,
Nikunj
Re: [Qemu-devel] [PATCH 03/11] target-ppc: Add xsiexpdp instruction
Quoted 41 lines · Nikunj A Dadhania
Quoted 30 lines · David Gibson
[ Unknown signature status ]
Quoted 28 lines · Nikunj A Dadhania
xsiexpdp: VSX Scalar Insert Exponent Double Precision
Signed-off-by Nikunj A Dadhania <[email protected]>--- target/ppc/translate/vsx-impl.inc.c | 20 ++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 21 insertions(+)target/ppc/translate/vsx-impl.inc.c +12
-0@@ -1243,6 +1243,26 @@ static void gen_xsxexpqp(DisasContext *ctx)tcg_gen_movi_i64 (xtl,0 ); } +static void gen_xsiexpdp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv ra = cpu_gpr[rA (ctx->opcode)]; +TCGv rb = cpu_gpr[rB (ctx->opcode)]; +TCGv_i64 t0; + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + t0 =tcg_temp_new_i64 ();Quoted 8 lines
target/ppc/translate/vsx-impl.inc.c static void gen_xsxexpqp(DisasContext *ctx) · line 1262
Quoted 5 lines
target/ppc/translate/vsx-impl.inc.c +5
-0+tcg_gen_andi_i64 (xth, ra,0x800FFFFFFFFFFFFF ); +tcg_gen_andi_i64 (t0, rb,0x7FF ); +tcg_gen_shli_i64 (t0, t0,52 ); +tcg_gen_or_i64 (xth, xth, t0); +/* dword[1] is undefined */ According to the ISA doc I have, dword[1] is set to 0 rather than being undefined.
Quoted 6 lines
Referring to xsiexpdp on page 570:
"The contents of doubleword element 1 of VSR[XT] are undefined."
The revision that I have is dated November 30, 2015
Ah, sorry. I think I just misread all those "U"s in the pseudo-code as "0"s. I'll blame the fact I'm using the little laptop screen, since I've left my home office to escape the heat.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 4/11 target-ppc: Add xsiexpqp instruction
In reply to Nikunj A Dadhaniaxsiexpqp: VSX Scalar Insert Exponent Quad Precision
--- target/ppc/translate/vsx-impl.inc.c | 22 ++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 23 insertions(+)
target/ppc/translate/vsx-impl.inc.c +22 -0
@@ -1263,6 +1263,28 @@ static void gen_xsiexpdp(DisasContext *ctx)tcg_temp_free_i64 (t0); } +static void gen_xsiexpqp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (rD (ctx->opcode) +32 ); +TCGv_i64 xtl =cpu_vsrl (rD (ctx->opcode) +32 ); +TCGv_i64 xah =cpu_vsrh (rA (ctx->opcode) +32 ); +TCGv_i64 xal =cpu_vsrl (rA (ctx->opcode) +32 ); +TCGv_i64 xbh =cpu_vsrh (rB (ctx->opcode) +32 ); +TCGv_i64 t0; + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + t0 =tcg_temp_new_i64 (); +tcg_gen_andi_i64 (xth, xah,0x8000FFFFFFFFFFFF ); +tcg_gen_andi_i64 (t0, xbh,0x7FFF ); +tcg_gen_shli_i64 (t0, t0,48 ); +tcg_gen_or_i64 (xth, xth, t0); +tcg_gen_mov_i64 (xtl, xal); +tcg_temp_free_i64 (t0); +} +static void gen_xsxsigdp (DisasContext *ctx) {TCGv rt = cpu_gpr[rD (ctx->opcode)];
target/ppc/translate/vsx-ops.inc.c +1 -0
@@ -121,6 +121,7 @@ GEN_VSX_XFORM_300_EO(xsxexpqp, 0x04, 0x19, 0x02, 0x00000001),GEN_XX2FORM_EO (xsxsigdp,0x16 ,0x15 ,0x01 ,PPC2_ISA300 ),GEN_VSX_XFORM_300_EO (xsxsigqp,0x04 ,0x19 ,0x12 ,0x00000001 ),GEN_HANDLER_E (xsiexpdp,0x3C ,0x16 ,0x1C ,0 ,PPC_NONE ,PPC2_ISA300 ), +GEN_VSX_XFORM_300 (xsiexpqp,0x4 ,0x1B ,0x00000001 ), #endif GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX),
Signature · 1 line
2.7.4
PATCH 5/11 target-ppc: Add xviexpsp instruction
In reply to Nikunj A Dadhaniaxviexpsp: VSX Vector Insert Exponent Single Precision
--- target/ppc/translate/vsx-impl.inc.c | 26 ++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 2 files changed, 28 insertions(+)
target/ppc/translate/vsx-impl.inc.c +26 -0
@@ -1344,6 +1344,32 @@ static void gen_xsxsigqp(DisasContext *ctx) }#endif +static void gen_xviexpsp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv_i64 xtl =cpu_vsrl (xT (ctx->opcode)); +TCGv_i64 xah =cpu_vsrh (xA (ctx->opcode)); +TCGv_i64 xal =cpu_vsrl (xA (ctx->opcode)); +TCGv_i64 xbh =cpu_vsrh (xB (ctx->opcode)); +TCGv_i64 xbl =cpu_vsrl (xB (ctx->opcode)); +TCGv_i64 t0; + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + t0 =tcg_temp_new_i64 (); +tcg_gen_andi_i64 (xth, xah,0x807FFFFF807FFFFF ); +tcg_gen_andi_i64 (t0, xbh,0xFF000000FF ); +tcg_gen_shli_i64 (t0, t0,23 ); +tcg_gen_or_i64 (xth, xth, t0); +tcg_gen_andi_i64 (xtl, xal,0x807FFFFF807FFFFF ); +tcg_gen_andi_i64 (t0, xbl,0xFF000000FF ); +tcg_gen_shli_i64 (t0, t0,23 ); +tcg_gen_or_i64 (xtl, xtl, t0); +tcg_temp_free_i64 (t0); +} +#undef GEN_XX2FORM#undef GEN_XX3FORM#undef GEN_XX2IFORM
target/ppc/translate/vsx-ops.inc.c +2 -0
@@ -124,6 +124,8 @@ GEN_HANDLER_E(xsiexpdp, 0x3C, 0x16, 0x1C, 0, PPC_NONE, PPC2_ISA300),GEN_VSX_XFORM_300 (xsiexpqp,0x4 ,0x1B ,0x00000001 ), #endif +GEN_XX3FORM (xviexpsp,0x00 ,0x1B ,PPC2_ISA300 ), +GEN_XX2FORM (xvabsdp,0x12 ,0x1D ,PPC2_VSX ),GEN_XX2FORM (xvnabsdp,0x12 ,0x1E ,PPC2_VSX ), GEN_XX2FORM(xvnegdp, 0x12, 0x1F, PPC2_VSX),
Signature · 1 line
2.7.4
PATCH 6/11 target-ppc: Add xviexpdp instruction
In reply to Nikunj A Dadhaniaxviexpdp: VSX Vector Insert Exponent Dual Precision
--- target/ppc/translate/vsx-impl.inc.c | 26 ++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 27 insertions(+)
target/ppc/translate/vsx-impl.inc.c +26 -0
@@ -1370,6 +1370,32 @@ static void gen_xviexpsp(DisasContext *ctx)tcg_temp_free_i64 (t0); } +static void gen_xviexpdp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv_i64 xtl =cpu_vsrl (xT (ctx->opcode)); +TCGv_i64 xah =cpu_vsrh (xA (ctx->opcode)); +TCGv_i64 xal =cpu_vsrl (xA (ctx->opcode)); +TCGv_i64 xbh =cpu_vsrh (xB (ctx->opcode)); +TCGv_i64 xbl =cpu_vsrl (xB (ctx->opcode)); +TCGv_i64 t0; + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + t0 =tcg_temp_new_i64 (); +tcg_gen_andi_i64 (xth, xah,0x800FFFFFFFFFFFFF ); +tcg_gen_andi_i64 (t0, xbh,0x7FF ); +tcg_gen_shli_i64 (t0, t0,52 ); +tcg_gen_or_i64 (xth, xth, t0); +tcg_gen_andi_i64 (xtl, xal,0x800FFFFFFFFFFFFF ); +tcg_gen_andi_i64 (t0, xbl,0x7FF ); +tcg_gen_shli_i64 (t0, t0,52 ); +tcg_gen_or_i64 (xtl, xtl, t0); +tcg_temp_free_i64 (t0); +} +#undef GEN_XX2FORM#undef GEN_XX3FORM#undef GEN_XX2IFORM
target/ppc/translate/vsx-ops.inc.c +1 -0
@@ -125,6 +125,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001),#endif GEN_XX3FORM (xviexpsp,0x00 ,0x1B ,PPC2_ISA300 ), +GEN_XX3FORM (xviexpdp,0x00 ,0x1F ,PPC2_ISA300 ),GEN_XX2FORM (xvabsdp,0x12 ,0x1D ,PPC2_VSX ), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX),
Signature · 1 line
2.7.4
PATCH 7/11 target-ppc: Add xvxexpsp instruction
In reply to Nikunj A Dadhaniaxvxexpsp: VSX Vector Extract Exponent Single Precision
--- target/ppc/translate/vsx-impl.inc.c | 17 +++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 18 insertions(+)
target/ppc/translate/vsx-impl.inc.c +17 -0
@@ -1396,6 +1396,23 @@ static void gen_xviexpdp(DisasContext *ctx)tcg_temp_free_i64 (t0); } +static void gen_xvxexpsp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv_i64 xtl =cpu_vsrl (xT (ctx->opcode)); +TCGv_i64 xbh =cpu_vsrh (xB (ctx->opcode)); +TCGv_i64 xbl =cpu_vsrl (xB (ctx->opcode)); + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +tcg_gen_shri_i64 (xth, xbh,23 ); +tcg_gen_andi_i64 (xth, xth,0xFF000000FF ); +tcg_gen_shri_i64 (xtl, xbl,23 ); +tcg_gen_andi_i64 (xtl, xtl,0xFF000000FF ); +} +#undef GEN_XX2FORM#undef GEN_XX3FORM#undef GEN_XX2IFORM
target/ppc/translate/vsx-ops.inc.c +1 -0
@@ -126,6 +126,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001),GEN_XX3FORM (xviexpsp,0x00 ,0x1B ,PPC2_ISA300 ),GEN_XX3FORM (xviexpdp,0x00 ,0x1F ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xvxexpsp,0x16 ,0x1D ,0x08 ,PPC2_ISA300 ),GEN_XX2FORM (xvabsdp,0x12 ,0x1D ,PPC2_VSX ), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX),
Signature · 1 line
2.7.4
PATCH 8/11 target-ppc: Add xvxexpdp instruction
In reply to Nikunj A Dadhaniaxvxexpdp: VSX Vector Extract Exponent Dual Precision
--- target/ppc/translate/vsx-impl.inc.c | 17 +++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 18 insertions(+)
target/ppc/translate/vsx-impl.inc.c +17 -0
@@ -1413,6 +1413,23 @@ static void gen_xvxexpsp(DisasContext *ctx)tcg_gen_andi_i64 (xtl, xtl,0xFF000000FF ); } +static void gen_xvxexpdp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv_i64 xtl =cpu_vsrl (xT (ctx->opcode)); +TCGv_i64 xbh =cpu_vsrh (xB (ctx->opcode)); +TCGv_i64 xbl =cpu_vsrl (xB (ctx->opcode)); + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +tcg_gen_shri_i64 (xth, xbh,52 ); +tcg_gen_andi_i64 (xth, xth,0x7FF ); +tcg_gen_shri_i64 (xtl, xbl,52 ); +tcg_gen_andi_i64 (xtl, xtl,0x7FF ); +} +#undef GEN_XX2FORM#undef GEN_XX3FORM#undef GEN_XX2IFORM
target/ppc/translate/vsx-ops.inc.c +1 -0
@@ -126,6 +126,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001),GEN_XX3FORM (xviexpsp,0x00 ,0x1B ,PPC2_ISA300 ),GEN_XX3FORM (xviexpdp,0x00 ,0x1F ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xvxexpdp,0x16 ,0x1D ,0x00 ,PPC2_ISA300 ),GEN_XX2FORM_EO (xvxexpsp,0x16 ,0x1D ,0x08 ,PPC2_ISA300 ), GEN_XX2FORM(xvabsdp, 0x12, 0x1D, PPC2_VSX),
Signature · 1 line
2.7.4
PATCH 9/11 target-ppc: Add xvxsigsp instruction
In reply to Nikunj A Dadhaniaxvxsigsp: VSX Vector Extract Significand Single Precision
--- target/ppc/fpu_helper.c | 20 ++++++++++++++++++++ target/ppc/helper.h | 1 + target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 1 + 4 files changed, 24 insertions(+)
target/ppc/fpu_helper.c +20 -0
@@ -3026,3 +3026,23 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) \ VSX_XXPERM(xxperm, 0) VSX_XXPERM(xxpermr, 1) + +void helper_xvxsigsp (CPUPPCState *env,uint32_t opcode) +{ +ppc_vsr_t xt, xb; +uint32_t exp, i, fraction; + +getVSR (xB (opcode), &xb, env); +memset (&xt,0 ,sizeof (xt)); + +for (i =0 ; i <4 ; i++) { + exp = (xb.VsrW (i) >>23 ) &0xFF ; + fraction = xb.VsrW (i) &0x7FFFFF ; +if (exp !=0 && exp !=255 ) { + xt.VsrW (i) = fraction |0x00800000 ; + }else { + xt.VsrW (i) = fraction; + } + } +putVSR (xT (opcode), &xt, env); +}
target/ppc/helper.h +1 -0
@@ -547,6 +547,7 @@ DEF_HELPER_2(xxperm, void, env, i32) DEF_HELPER_2(xxpermr, void, env, i32) DEF_HELPER_4(xxextractuw, void, env, tl, tl, i32) DEF_HELPER_4(xxinsertw, void, env, tl, tl, i32) +DEF_HELPER_2(xvxsigsp, void, env, i32) DEF_HELPER_2(efscfsi, i32, env, i32)DEF_HELPER_2 (efscfui, i32, env, i32)
target/ppc/translate/vsx-impl.inc.c +2 -0
@@ -1430,6 +1430,8 @@ static void gen_xvxexpdp(DisasContext *ctx)tcg_gen_andi_i64 (xtl, xtl,0x7FF ); } +GEN_VSX_HELPER_2(xvxsigsp, 0x00, 0x04, 0, PPC2_ISA300) +#undef GEN_XX2FORM#undef GEN_XX3FORM#undef GEN_XX2IFORM
target/ppc/translate/vsx-ops.inc.c +1 -0
@@ -128,6 +128,7 @@ GEN_XX3FORM(xviexpsp, 0x00, 0x1B, PPC2_ISA300),GEN_XX3FORM (xviexpdp,0x00 ,0x1F ,PPC2_ISA300 ),GEN_XX2FORM_EO (xvxexpdp,0x16 ,0x1D ,0x00 ,PPC2_ISA300 ),GEN_XX2FORM_EO (xvxexpsp,0x16 ,0x1D ,0x08 ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xvxsigsp,0x16 ,0x1D ,0x09 ,PPC2_ISA300 ),GEN_XX2FORM (xvabsdp,0x12 ,0x1D ,PPC2_VSX ), GEN_XX2FORM(xvnabsdp, 0x12, 0x1E, PPC2_VSX),
Signature · 1 line
2.7.4
PATCH 10/11 target-ppc: Add xvxsigdp instruction
In reply to Nikunj A Dadhaniaxvxsigdp: VSX Vector Extract Significand Dual Precision
--- target/ppc/translate/vsx-impl.inc.c | 40 +++++++++++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 1 + 2 files changed, 41 insertions(+)
target/ppc/translate/vsx-impl.inc.c +40 -0
@@ -1432,6 +1432,46 @@ static void gen_xvxexpdp(DisasContext *ctx) GEN_VSX_HELPER_2(xvxsigsp, 0x00, 0x04, 0, PPC2_ISA300) +static void gen_xvxsigdp (DisasContext *ctx) +{ +TCGv_i64 xth =cpu_vsrh (xT (ctx->opcode)); +TCGv_i64 xtl =cpu_vsrl (xT (ctx->opcode)); +TCGv_i64 xbh =cpu_vsrh (xB (ctx->opcode)); +TCGv_i64 xbl =cpu_vsrl (xB (ctx->opcode)); + +TCGv_i64 t0, zr, nan, exp; + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } + exp =tcg_temp_new_i64 (); + t0 =tcg_temp_new_i64 (); + zr =tcg_const_i64 (0 ); + nan =tcg_const_i64 (2047 ); + +tcg_gen_shri_i64 (exp, xbh,52 ); +tcg_gen_andi_i64 (exp, exp,0x7FF ); +tcg_gen_movi_i64 (t0,0x0010000000000000 ); +tcg_gen_movcond_i64 (TCG_COND_EQ , t0, exp, zr, zr, t0); +tcg_gen_movcond_i64 (TCG_COND_EQ , t0, exp, nan, zr, t0); +tcg_gen_andi_i64 (xth, xbh,0x000FFFFFFFFFFFFF ); +tcg_gen_or_i64 (xth, xth, t0); + +tcg_gen_shri_i64 (exp, xbl,52 ); +tcg_gen_andi_i64 (exp, exp,0x7FF ); +tcg_gen_movi_i64 (t0,0x0010000000000000 ); +tcg_gen_movcond_i64 (TCG_COND_EQ , t0, exp, zr, zr, t0); +tcg_gen_movcond_i64 (TCG_COND_EQ , t0, exp, nan, zr, t0); +tcg_gen_andi_i64 (xtl, xbl,0x000FFFFFFFFFFFFF ); +tcg_gen_or_i64 (xtl, xtl, t0); + +tcg_temp_free_i64 (t0); +tcg_temp_free_i64 (exp); +tcg_temp_free_i64 (zr); +tcg_temp_free_i64 (nan); +} +#undef GEN_XX2FORM#undef GEN_XX3FORM#undef GEN_XX2IFORM
target/ppc/translate/vsx-ops.inc.c +1 -0
@@ -127,6 +127,7 @@ GEN_VSX_XFORM_300(xsiexpqp, 0x4, 0x1B, 0x00000001),GEN_XX3FORM (xviexpsp,0x00 ,0x1B ,PPC2_ISA300 ),GEN_XX3FORM (xviexpdp,0x00 ,0x1F ,PPC2_ISA300 ),GEN_XX2FORM_EO (xvxexpdp,0x16 ,0x1D ,0x00 ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xvxsigdp,0x16 ,0x1D ,0x01 ,PPC2_ISA300 ),GEN_XX2FORM_EO (xvxexpsp,0x16 ,0x1D ,0x08 ,PPC2_ISA300 ), GEN_XX2FORM_EO(xvxsigsp, 0x16, 0x1D, 0x09, PPC2_ISA300),
Signature · 1 line
2.7.4
PATCH 11/11 target-ppc: Add xscvqps[d, w]z instructions
In reply to Nikunj A DadhaniaFrom: Bharata B Rao <[email protected]>
xscvqpsdz: VSX Scalar truncate & Convert Quad-Precision format to
Signed Doubleword format
xscvqpswz: VSX Scalar truncate & Convert Quad-Precision format to
Signed Word format
--- target/ppc/fpu_helper.c | 40 +++++++++++++++++++++++++++++++++++++ target/ppc/helper.h | 2 ++ target/ppc/translate/vsx-impl.inc.c | 2 ++ target/ppc/translate/vsx-ops.inc.c | 2 ++ 4 files changed, 46 insertions(+)
target/ppc/fpu_helper.c +40 -0
@@ -2878,6 +2878,46 @@ VSX_CVT_FP_TO_INT(xvcvspsxws, 4, float32, int32, VsrW(i), VsrW(i), 0x80000000U) VSX_CVT_FP_TO_INT(xvcvspuxds, 2, float32, uint64, VsrW(2*i), VsrD(i), 0ULL)VSX_CVT_FP_TO_INT (xvcvspuxws,4 , float32, uint32,VsrW (i),VsrW (i),0U ) +/* VSX_CVT_FP_TO_INT_VECTOR - VSX floating point to integer conversion +* op - instruction mnemonic +* stp - source type (float32 or float64) +* ttp - target type (int32, uint32, int64 or uint64) +* sfld - source vsr_t field +* tfld - target vsr_t field +* rnan - resulting NaN + */ +#define VSX_CVT_FP_TO_INT_VECTOR (op, stp, ttp, sfld, tfld, rnan) \ +void helper_##op(CPUPPCState *env, uint32_t opcode) \ +{ \ + ppc_vsr_t xt, xb; \ + \ + getVSR(rB(opcode) + 32, &xb, env); \ + memset(&xt, 0, sizeof(xt)); \ + \ + if (unlikely(stp##_is_any_nan(xb.sfld))) { \ + if (stp##_is_signaling_nan(xb.sfld, &env->fp_status)) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 0); \ + } \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0); \ + xt.tfld = rnan; \ + } else { \ + xt.tfld = stp##_to_##ttp##_round_to_zero(xb.sfld, \ + &env->fp_status); \ + if (env->fp_status.float_exception_flags & float_flag_invalid) { \ + float_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0); \ + } \ + } \ + \ + putVSR(rD(opcode) + 32, &xt, env); \ + float_check_status(env); \ +} + +VSX_CVT_FP_TO_INT_VECTOR (xscvqpsdz, float128, int64, f128,VsrD (0 ), \ + 0x8000000000000000ULL) + +VSX_CVT_FP_TO_INT_VECTOR (xscvqpswz, float128, int32, f128,VsrD (0 ), \ +0xffffffff80000000ULL ) +/* VSX_CVT_INT_TO_FP - VSX integer to floating point conversion * op - instruction mnemonic * nels - number of elements (1, 2 or 4)
target/ppc/helper.h +2 -0
@@ -434,6 +434,8 @@ DEF_HELPER_2(xscvdpqp, void, env, i32) DEF_HELPER_2(xscvdpsp, void, env, i32) DEF_HELPER_2(xscvdpspn, i64, env, i64) DEF_HELPER_2(xscvqpdp, void, env, i32) +DEF_HELPER_2(xscvqpsdz, void, env, i32) +DEF_HELPER_2(xscvqpswz, void, env, i32) DEF_HELPER_2(xscvhpdp, void, env, i32) DEF_HELPER_2(xscvspdp, void, env, i32)DEF_HELPER_2 (xscvspdpn, i64, env, i64)
target/ppc/translate/vsx-impl.inc.c +2 -0
@@ -811,6 +811,8 @@ GEN_VSX_HELPER_2(xscvdpsp, 0x12, 0x10, 0, PPC2_VSX) GEN_VSX_HELPER_2(xscvdpqp, 0x04, 0x1A, 0x16, PPC2_ISA300) GEN_VSX_HELPER_XT_XB_ENV(xscvdpspn, 0x16, 0x10, 0, PPC2_VSX207) GEN_VSX_HELPER_2(xscvqpdp, 0x04, 0x1A, 0x14, PPC2_ISA300) +GEN_VSX_HELPER_2(xscvqpsdz, 0x04, 0x1A, 0x19, PPC2_ISA300) +GEN_VSX_HELPER_2(xscvqpswz, 0x04, 0x1A, 0x09, PPC2_ISA300) GEN_VSX_HELPER_2(xscvhpdp, 0x16, 0x15, 0x10, PPC2_ISA300) GEN_VSX_HELPER_2(xscvspdp, 0x12, 0x14, 0, PPC2_VSX)GEN_VSX_HELPER_XT_XB_ENV (xscvspdpn,0x16 ,0x14 ,0 ,PPC2_VSX207 )
target/ppc/translate/vsx-ops.inc.c +2 -0
@@ -114,6 +114,8 @@ GEN_VSX_XFORM_300_EO(xsnegqp, 0x04, 0x19, 0x10, 0x00000001),GEN_VSX_XFORM_300 (xscpsgnqp,0x04 ,0x03 ,0x00000001 ),GEN_VSX_XFORM_300_EO (xscvdpqp,0x04 ,0x1A ,0x16 ,0x00000001 ),GEN_VSX_XFORM_300_EO (xscvqpdp,0x04 ,0x1A ,0x14 ,0x0 ), +GEN_VSX_XFORM_300_EO (xscvqpsdz,0x04 ,0x1A ,0x19 ,0x00000001 ), +GEN_VSX_XFORM_300_EO (xscvqpswz,0x04 ,0x1A ,0x09 ,0x00000001 ), #ifdef TARGET_PPC64 GEN_XX2FORM_EO(xsxexpdp, 0x16, 0x15, 0x00, PPC2_ISA300),
Signature · 1 line
2.7.4
Quoted 22 lines · Nikunj A Dadhania
This series contains 10 new instructions for POWER9 ISA3.0
VSX Scalar Insert Exponent
VSX Vector Insert Exponent
VSX Vector Extract Exponent/Significand
VSX Scalar Truncate & Convert Quad-Precision Couple of fixesBharata B Rao (2):
softfloat: Fix the default qNAN for target-ppc
target-ppc: Add xscvqps[d,w]z instructionsNikunj A Dadhania (9):
target-ppc: xscvqpdp zero VSR
target-ppc: Add xsiexpdp instruction
target-ppc: Add xsiexpqp instruction
target-ppc: Add xviexpsp instruction
target-ppc: Add xviexpdp instruction
target-ppc: Add xvxexpsp instruction
target-ppc: Add xvxexpdp instruction
target-ppc: Add xvxsigsp instruction
target-ppc: Add xvxsigdp instruction
Quoted 6 lines
fpu/softfloat-specialize.h | 2 +- target/ppc/fpu_helper.c | 62 ++++++++++++- target/ppc/helper.h | 3 + target/ppc/translate/vsx-impl.inc.c | 172 ++++++++++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 11 +++ 5 files changed, 248 insertions(+), 2 deletions(-)
Patches 1&2 merged to ppc-for-2.9. The rest pending a query on 3/11.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 22 lines · Nikunj A Dadhania
This series contains 10 new instructions for POWER9 ISA3.0
VSX Scalar Insert Exponent
VSX Vector Insert Exponent
VSX Vector Extract Exponent/Significand
VSX Scalar Truncate & Convert Quad-Precision Couple of fixesBharata B Rao (2):
softfloat: Fix the default qNAN for target-ppc
target-ppc: Add xscvqps[d,w]z instructionsNikunj A Dadhania (9):
target-ppc: xscvqpdp zero VSR
target-ppc: Add xsiexpdp instruction
target-ppc: Add xsiexpqp instruction
target-ppc: Add xviexpsp instruction
target-ppc: Add xviexpdp instruction
target-ppc: Add xvxexpsp instruction
target-ppc: Add xvxexpdp instruction
target-ppc: Add xvxsigsp instruction
target-ppc: Add xvxsigdp instruction
Quoted 6 lines
fpu/softfloat-specialize.h | 2 +- target/ppc/fpu_helper.c | 62 ++++++++++++- target/ppc/helper.h | 3 + target/ppc/translate/vsx-impl.inc.c | 172 ++++++++++++++++++++++++++++++++++++ target/ppc/translate/vsx-ops.inc.c | 11 +++ 5 files changed, 248 insertions(+), 2 deletions(-)
I've now applied the remainder of this series to ppc-for-2.9.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson