POWER9 TCG enablement - part5
cover POWER9 TCG enablement - part5
This series contains 15 new instructions for POWER9 described in ISA3.0.
Patches:
01: Adds vector multiply instructions.
vmul10uq : Vector Multiply-by-10 Unsigned Quadword vmul10euq : Vector Multiply-by-10 Extended Unsigned Quadword vmul10cuq : Vector Multiply-by-10 & write Carry Unsigned QW
vmul10ecuq: Vector Multiply-by-10 Extended write Carry Unsigned QW
02: Adds vector extract unsigned left indexed instructions.
vextublx: Vector Extract Unsigned Byte Left
vextuhlx: Vector Extract Unsigned Halfword Left
vextuwlx: Vector Extract Unsigned Word Left
03: Adds vector extract unsigned right indexed instructions.
vextubrx: Vector Extract Unsigned Byte Right-Indexed
vextuhrx: Vector Extract Unsigned Halfword Right-Indexed
vextuwrx: Vector Extract Unsigned Word Right-Indexed
04: Fix invalid mask - cmpl, bctar.
05: Adds vector compare not equal instructions.
vcmpneb - Vector Compare Not Equal Byte
vcmpneh - Vector Compare Not Equal Halfword
vcmpnew - Vector Compare Not Equal Word
06: Adds vclzlsbb/vctzlsbb instructions
vclzlsbb - Vector Count Leading Zero Least-Significant Bits Byte vctzlsbb - Vector Count Trailing Zero Least-Significant Bits Byte
target-ppc/helper.h | 14 ++++ target-ppc/int_helper.c | 134 +++++++++++++++++++++++++++++++---- target-ppc/translate.c | 4 +- target-ppc/translate/vmx-impl.inc.c | 123 +++++++++++++++++++++++++++++++- target-ppc/translate/vmx-ops.inc.c | 24 ++++--- 5 files changed, 274 insertions(+), 25 deletions(-)
PATCH 1/6 target-ppc: add vmul10[u, eu, cu, ecu]q instructions
From: Vasant Hegde <[email protected]>
vmul10uq : Vector Multiply-by-10 Unsigned Quadword VX-form
vmul10euq : Vector Multiply-by-10 Extended Unsigned Quadword VX-form vmul10cuq : Vector Multiply-by-10 & write Carry Unsigned Quadword VX-form
vmul10ecuq: Vector Multiply-by-10 Extended & write Carry Unsigned Quadword VX-form
--- target-ppc/translate/vmx-impl.inc.c | 74 +++++++++++++++++++++++++++++++++++ target-ppc/translate/vmx-ops.inc.c | 8 ++-- 2 files changed, 78 insertions(+), 4 deletions(-)
target-ppc/translate/vmx-impl.inc.c +74 -0
@@ -182,6 +182,54 @@ static void gen_mtvscr(DisasContext *ctx)tcg_temp_free_ptr (p); } +#define GEN_VX_VMUL10 (name, add_cin, ret_carry) \ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ + TCGv_i64 t0 = tcg_temp_new_i64(); \ + TCGv_i64 t1 = tcg_temp_new_i64(); \ + TCGv_i64 t2 = tcg_temp_new_i64(); \ + TCGv_i64 cin = tcg_temp_new_i64(); \ + TCGv_i64 val, z; \ + \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + \ + val = tcg_const_i64(10); \ + z = tcg_const_i64(0); \ + \ + if (add_cin) { \ + tcg_gen_andi_i64(cin, cpu_avrl[rB(ctx->opcode)], 0xF); \ + tcg_gen_movcond_i64(TCG_COND_LTU, cin, cin, val, cin, z); \ + } else { \ + tcg_gen_movi_i64(cin, 0); \ + } \ + \ + tcg_gen_mulu2_i64(t0, t1, cpu_avrl[rA(ctx->opcode)], val); \ + tcg_gen_add2_i64(cpu_avrl[rD(ctx->opcode)], t2, t0, z, cin, z); \ + tcg_gen_add2_i64(t2, t0, t1, z, t2, z); \ + tcg_gen_mulu2_i64(t0, t1, cpu_avrh[rA(ctx->opcode)], val); \ + tcg_gen_add2_i64(cpu_avrh[rD(ctx->opcode)], t2, t0, z, t2, z); \ + \ + if (ret_carry) { \ + tcg_gen_add2_i64(cpu_avrl[rD(ctx->opcode)], t0, t1, z, t2, z); \ + tcg_gen_movi_i64(cpu_avrh[rD(ctx->opcode)], 0); \ + } \ + \ + tcg_temp_free_i64(t0); \ + tcg_temp_free_i64(t1); \ + tcg_temp_free_i64(t2); \ + tcg_temp_free_i64(val); \ + tcg_temp_free_i64(cin); \ + tcg_temp_free_i64(z); \ +} \ + +GEN_VX_VMUL10 (vmul10uq,0 ,0 ); +GEN_VX_VMUL10 (vmul10euq,1 ,0 ); +GEN_VX_VMUL10 (vmul10cuq,0 ,1 ); +GEN_VX_VMUL10 (vmul10ecuq,1 ,1 ); +/* Logical operations */ #define GEN_VX_LOGICAL (name, tcg_op, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \
@@ -276,8 +324,30 @@ static void glue(gen_, name0##_##name1)(DisasContext *ctx) \ } \ } +/* Adds support to provide invalid mask */ +#define GEN_VXFORM_DUAL_EXT (name0, flg0, flg2_0, inval0, \ + name1, flg1, flg2_1, inval1) \ +static void glue(gen_, name0##_##name1)(DisasContext *ctx) \ +{ \ + if ((Rc(ctx->opcode) == 0) && \ + ((ctx->insns_flags & flg0) || (ctx->insns_flags2 & flg2_0)) && \ + !(ctx->opcode & inval0)) { \ + gen_##name0(ctx); \ + } else if ((Rc(ctx->opcode) == 1) && \ + ((ctx->insns_flags & flg1) || (ctx->insns_flags2 & flg2_1)) && \ + !(ctx->opcode & inval1)) { \ + gen_##name1(ctx); \ + } else { \ + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); \ + } \ +} +GEN_VXFORM (vaddubm,0 ,0 ); +GEN_VXFORM_DUAL_EXT (vaddubm,PPC_NONE ,PPC2_ALTIVEC_207 ,0 , \ + vmul10cuq, PPC_NONE, PPC2_ISA300, 0x0000F800)GEN_VXFORM (vadduhm,0 ,1 ); +GEN_VXFORM_DUAL (vadduhm,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vmul10ecuq, PPC_NONE, PPC2_ISA300)GEN_VXFORM (vadduwm,0 ,2 );GEN_VXFORM (vaddudm,0 ,3 );GEN_VXFORM (vsububm,0 ,16 );
@@ -390,7 +460,11 @@ GEN_VXFORM(vsro, 6, 17);GEN_VXFORM (vaddcuw,0 ,6 );GEN_VXFORM (vsubcuw,0 ,22 );GEN_VXFORM_ENV (vaddubs,0 ,8 ); +GEN_VXFORM_DUAL_EXT (vaddubs,PPC_NONE ,PPC2_ALTIVEC_207 ,0 , \ + vmul10uq, PPC_NONE, PPC2_ISA300, 0x0000F800)GEN_VXFORM_ENV (vadduhs,0 ,9 ); +GEN_VXFORM_DUAL (vadduhs,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vmul10euq, PPC_NONE, PPC2_ISA300)GEN_VXFORM_ENV (vadduws,0 ,10 );GEN_VXFORM_ENV (vaddsbs,0 ,12 );GEN_VXFORM_ENV (vaddshs,0 ,13 );
target-ppc/translate/vmx-ops.inc.c +4 -4
@@ -55,8 +55,8 @@ GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x00000000, type0, type1) GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x00000000, tp0, tp1), \ GEN_HANDLER_E(name0##_##name1, 0x4, opc2, (opc3 | 0x10), 0x00000000, tp0, tp1), -GEN_VXFORM (vaddubm,0 ,0 ), -GEN_VXFORM (vadduhm,0 ,1 ), +GEN_VXFORM_DUAL (vaddubm, vmul10cuq,0 ,0 ,PPC_ALTIVEC ,PPC_NONE ), +GEN_VXFORM_DUAL (vadduhm, vmul10ecuq,0 ,1 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM (vadduwm,0 ,2 ),GEN_VXFORM_207 (vaddudm,0 ,3 ), GEN_VXFORM_DUAL(vsububm, bcdadd, 0, 16, PPC_ALTIVEC, PPC_NONE),
@@ -123,8 +123,8 @@ GEN_VXFORM(vslo, 6, 16),GEN_VXFORM (vsro,6 ,17 ),GEN_VXFORM (vaddcuw,0 ,6 ),GEN_VXFORM (vsubcuw,0 ,22 ), -GEN_VXFORM (vaddubs,0 ,8 ), -GEN_VXFORM (vadduhs,0 ,9 ), +GEN_VXFORM_DUAL (vaddubs, vmul10uq,0 ,8 ,PPC_ALTIVEC ,PPC_NONE ), +GEN_VXFORM_DUAL (vadduhs, vmul10euq,0 ,9 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM (vadduws,0 ,10 ),GEN_VXFORM (vaddsbs,0 ,12 ), GEN_VXFORM(vaddshs, 0, 13),
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 1/6] target-ppc: add vmul10[u, eu, cu, ecu]q instructions
Quoted 1 line · Rajalakshmi Srinivasaraghavan
+ val =
tcg_const_i64(10); \
Rename this "ten" for clarity?
target-ppc/translate/vmx-impl.inc.c static void gen_mtvscr(DisasContext *ctx) · line 204
Quoted 5 lines
target-ppc/translate/vmx-impl.inc.c +5
-0+ z =tcg_const_i64 (0 ); \ + \ +if (add_cin) { \ +tcg_gen_andi_i64 (cin, cpu_avrl[rB (ctx->opcode)],0xF ); \ +tcg_gen_movcond_i64 (TCG_COND_LTU , cin, cin, val, cin, z); \
What is the purpose of this movcond? The docs specifically say that values greater than 9 are undefined.
target-ppc/translate/vmx-impl.inc.c static void gen_mtvscr(DisasContext *ctx) · line 211
Quoted 7 lines
target-ppc/translate/vmx-impl.inc.c +7
-0+ }else { \ +tcg_gen_movi_i64 (cin,0 ); \ + } \ + \ +tcg_gen_mulu2_i64 (t0, t1, cpu_avrl[rA (ctx->opcode)], val); \ +tcg_gen_add2_i64 (cpu_avrl[rD (ctx->opcode)], t2, t0, z, cin, z); \ +tcg_gen_add2_i64 (t2, t0, t1, z, t2, z); \
This two additions are unused if !add_cin, and the second appears to be mergable with the first -- don't use so many z's. I think this simplifies to
if (add_cin) {
tcg_gen_mulu2_i64(t0, t1, cpu_avrl[rA(ctx->opcode)], ten);
tcg_gen_andi_i64(t2, cpu_avrl[rB(ctx->opcode)], 0xF);
tcg_gen_add2_i64(cpu_avrl[rD(ctx->opcode)], t2, t0, t1, t2, z);
} else {
tcg_gen_mulu2_i64(cpu_avrl[rD(ctx->opcode)], t2,
cpu_avrl[rA(ctx->opcode)], ten);
}target-ppc/translate/vmx-impl.inc.c static void gen_mtvscr(DisasContext *ctx) · line 217
Quoted 6 lines
target-ppc/translate/vmx-impl.inc.c +6
-0+tcg_gen_mulu2_i64 (t0, t1, cpu_avrh[rA (ctx->opcode)], val); \ +tcg_gen_add2_i64 (cpu_avrh[rD (ctx->opcode)], t2, t0, z, t2, z); \ + \ +if (ret_carry) { \ +tcg_gen_add2_i64 (cpu_avrl[rD (ctx->opcode)], t0, t1, z, t2, z); \ +tcg_gen_movi_i64 (cpu_avrh[rD (ctx->opcode)],0 ); \
Likewise simplifies to
if (ret_carry) {
tcg_gen_mulu2_i64(t0, t1, cpu_avrh[rA(ctx->opcode)], ten);
tcg_gen_add2_i64(t0, cpu_avrl[rD(ctx->opcode)], t0, t1, t2, z);
tcg_gen_movi_i64(cpu_avrh[rD(ctx->opcode)], 0);
} else {
tcg_gen_mul_i64(t0, cpu_avrh[rA(ctx->opcode)], ten);
tcg_gen_add_i64(cpu_avrh[rD(ctx->opcode)], t0, t2);
}r~
Re: [Qemu-devel] [PATCH 1/6] target-ppc: add vmul10[u, eu, cu, ecu]q instructions
Quoted 39 lines · Richard Henderson
Quoted 1 line · Rajalakshmi Srinivasaraghavan
+ val =
tcg_const_i64(10); \Rename this "ten" for clarity?
target-ppc/translate/vmx-impl.inc.c static void gen_mtvscr(DisasContext *ctx) · line 204
Quoted 5 lines
target-ppc/translate/vmx-impl.inc.c +5
-0+ z =tcg_const_i64 (0 ); \ + \ +if (add_cin) { \ +tcg_gen_andi_i64 (cin, cpu_avrl[rB (ctx->opcode)],0xF ); \ +tcg_gen_movcond_i64 (TCG_COND_LTU , cin, cin, val, cin, z); \What is the purpose of this movcond? The docs specifically say that values greater than 9 are undefined.
target-ppc/translate/vmx-impl.inc.c static void gen_mtvscr(DisasContext *ctx) · line 211
Quoted 7 lines
target-ppc/translate/vmx-impl.inc.c +7
-0+ }else { \ +tcg_gen_movi_i64 (cin,0 ); \ + } \ + \ +tcg_gen_mulu2_i64 (t0, t1, cpu_avrl[rA (ctx->opcode)], val); \ +tcg_gen_add2_i64 (cpu_avrl[rD (ctx->opcode)], t2, t0, z, cin, z); \ +tcg_gen_add2_i64 (t2, t0, t1, z, t2, z); \This two additions are unused if !add_cin, and the second appears to be mergable with the first -- don't use so many z's. I think this simplifies to
if (add_cin) { tcg_gen_mulu2_i64(t0, t1, cpu_avrl[rA(ctx->opcode)], ten); tcg_gen_andi_i64(t2, cpu_avrl[rB(ctx->opcode)], 0xF); tcg_gen_add2_i64(cpu_avrl[rD(ctx->opcode)], t2, t0, t1, t2, z); } else { tcg_gen_mulu2_i64(cpu_avrl[rD(ctx->opcode)], t2, cpu_avrl[rA(ctx->opcode)], ten); }target-ppc/translate/vmx-impl.inc.c static void gen_mtvscr(DisasContext *ctx) · line 217
Quoted 6 lines
target-ppc/translate/vmx-impl.inc.c +6
-0+tcg_gen_mulu2_i64 (t0, t1, cpu_avrh[rA (ctx->opcode)], val); \ +tcg_gen_add2_i64 (cpu_avrh[rD (ctx->opcode)], t2, t0, z, t2, z); \ + \ +if (ret_carry) { \ +tcg_gen_add2_i64 (cpu_avrl[rD (ctx->opcode)], t0, t1, z, t2, z); \ +tcg_gen_movi_i64 (cpu_avrh[rD (ctx->opcode)],0 ); \Likewise simplifies to
Quoted 9 lines
if (ret_carry) {
tcg_gen_mulu2_i64(t0, t1, cpu_avrh[rA(ctx->opcode)], ten);
tcg_gen_add2_i64(t0, cpu_avrl[rD(ctx->opcode)], t0, t1, t2, z);
tcg_gen_movi_i64(cpu_avrh[rD(ctx->opcode)], 0);
} else {
tcg_gen_mul_i64(t0, cpu_avrh[rA(ctx->opcode)], ten);
tcg_gen_add_i64(cpu_avrh[rD(ctx->opcode)], t0, t2);
}Will check and send updated patch.
Quoted 3 lines
r~
Signature · 2 lines
Thanks Rajalakshmi S
Re: [Qemu-devel] [PATCH 1/6] target-ppc: add vmul10[u, eu, cu, ecu]q instructions
In reply to Rajalakshmi SrinivasaraghavanQuoted 39 lines · Rajalakshmi Srinivasaraghavan
From: Vasant Hegde <[email protected]>
vmul10uq : Vector Multiply-by-10 Unsigned Quadword VX-form
vmul10euq : Vector Multiply-by-10 Extended Unsigned Quadword VX-form vmul10cuq : Vector Multiply-by-10 & write Carry Unsigned Quadword VX-form
vmul10ecuq: Vector Multiply-by-10 Extended & write Carry Unsigned Quadword VX-formSigned-off-by Vasant Hegde <[email protected]>[ Add GEN_VXFORM_DUAL_EXT with invalid bit mask ]Signed-off-by Nikunj A Dadhania <[email protected]>Signed-off-by Rajalakshmi Srinivasaraghavan <[email protected]>--- target-ppc/translate/vmx-impl.inc.c | 74 +++++++++++++++++++++++++++++++++++ target-ppc/translate/vmx-ops.inc.c | 8 ++-- 2 files changed, 78 insertions(+), 4 deletions(-)target-ppc/translate/vmx-impl.inc.c +15
-0@@ -182,6 +182,54 @@ static void gen_mtvscr(DisasContext *ctx)tcg_temp_free_ptr (p); } +#define GEN_VX_VMUL10 (name, add_cin, ret_carry) \ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ + TCGv_i64 t0 = tcg_temp_new_i64(); \ + TCGv_i64 t1 = tcg_temp_new_i64(); \ + TCGv_i64 t2 = tcg_temp_new_i64(); \ + TCGv_i64 cin = tcg_temp_new_i64(); \ + TCGv_i64 val, z; \ + \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + \ + val = tcg_const_i64(10); \
target-ppc/translate/vmx-impl.inc.c static void gen_mtvscr(DisasContext *ctx) · line 209
Quoted 10 lines
target-ppc/translate/vmx-impl.inc.c +10
-0+ z =tcg_const_i64 (0 ); \ + \ +if (add_cin) { \ +tcg_gen_andi_i64 (cin, cpu_avrl[rB (ctx->opcode)],0xF ); \ +tcg_gen_movcond_i64 (TCG_COND_LTU , cin, cin, val, cin, z); \ + }else { \ +tcg_gen_movi_i64 (cin,0 ); \ + } \ + \ +tcg_gen_mulu2_i64 (t0, t1, cpu_avrl[rA (ctx->opcode)], val); \
Do you really want to be using an actual mul op, rather than (in << 3)
+ (in << 1)? Obviously working out al the carries correctly will be a bit fiddly.
Quoted 95 lines
target-ppc/translate/vmx-impl.inc.c +49
-0+tcg_gen_add2_i64 (cpu_avrl[rD (ctx->opcode)], t2, t0, z, cin, z); \ +tcg_gen_add2_i64 (t2, t0, t1, z, t2, z); \ +tcg_gen_mulu2_i64 (t0, t1, cpu_avrh[rA (ctx->opcode)], val); \ +tcg_gen_add2_i64 (cpu_avrh[rD (ctx->opcode)], t2, t0, z, t2, z); \ + \ +if (ret_carry) { \ +tcg_gen_add2_i64 (cpu_avrl[rD (ctx->opcode)], t0, t1, z, t2, z); \ +tcg_gen_movi_i64 (cpu_avrh[rD (ctx->opcode)],0 ); \ + } \ + \ +tcg_temp_free_i64 (t0); \ +tcg_temp_free_i64 (t1); \ +tcg_temp_free_i64 (t2); \ +tcg_temp_free_i64 (val); \ +tcg_temp_free_i64 (cin); \ +tcg_temp_free_i64 (z); \ +} \ + +GEN_VX_VMUL10 (vmul10uq,0 ,0 ); +GEN_VX_VMUL10 (vmul10euq,1 ,0 ); +GEN_VX_VMUL10 (vmul10cuq,0 ,1 ); +GEN_VX_VMUL10 (vmul10ecuq,1 ,1 ); +/* Logical operations */ #define GEN_VX_LOGICAL (name, tcg_op, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \@@ -276,8 +324,30 @@ static void glue(gen_, name0##_##name1)(DisasContext *ctx) \ } \ } +/* Adds support to provide invalid mask */ +#define GEN_VXFORM_DUAL_EXT (name0, flg0, flg2_0, inval0, \ + name1, flg1, flg2_1, inval1) \ +static void glue(gen_, name0##_##name1)(DisasContext *ctx) \ +{ \ + if ((Rc(ctx->opcode) == 0) && \ + ((ctx->insns_flags & flg0) || (ctx->insns_flags2 & flg2_0)) && \ + !(ctx->opcode & inval0)) { \ + gen_##name0(ctx); \ + } else if ((Rc(ctx->opcode) == 1) && \ + ((ctx->insns_flags & flg1) || (ctx->insns_flags2 & flg2_1)) && \ + !(ctx->opcode & inval1)) { \ + gen_##name1(ctx); \ + } else { \ + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); \ + } \ +} +GEN_VXFORM (vaddubm,0 ,0 ); +GEN_VXFORM_DUAL_EXT (vaddubm,PPC_NONE ,PPC2_ALTIVEC_207 ,0 , \ + vmul10cuq, PPC_NONE, PPC2_ISA300, 0x0000F800)GEN_VXFORM (vadduhm,0 ,1 ); +GEN_VXFORM_DUAL (vadduhm,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vmul10ecuq, PPC_NONE, PPC2_ISA300)GEN_VXFORM (vadduwm,0 ,2 );GEN_VXFORM (vaddudm,0 ,3 );GEN_VXFORM (vsububm,0 ,16 );@@ -390,7 +460,11 @@ GEN_VXFORM(vsro, 6, 17);GEN_VXFORM (vaddcuw,0 ,6 );GEN_VXFORM (vsubcuw,0 ,22 );GEN_VXFORM_ENV (vaddubs,0 ,8 ); +GEN_VXFORM_DUAL_EXT (vaddubs,PPC_NONE ,PPC2_ALTIVEC_207 ,0 , \ + vmul10uq, PPC_NONE, PPC2_ISA300, 0x0000F800)GEN_VXFORM_ENV (vadduhs,0 ,9 ); +GEN_VXFORM_DUAL (vadduhs,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vmul10euq, PPC_NONE, PPC2_ISA300)GEN_VXFORM_ENV (vadduws,0 ,10 );GEN_VXFORM_ENV (vaddsbs,0 ,12 );GEN_VXFORM_ENV (vaddshs,0 ,13 );target-ppc/translate/vmx-ops.inc.c +4
-4@@ -55,8 +55,8 @@ GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x00000000, type0, type1) GEN_HANDLER_E(name0##_##name1, 0x4, opc2, opc3, 0x00000000, tp0, tp1), \ GEN_HANDLER_E(name0##_##name1, 0x4, opc2, (opc3 | 0x10), 0x00000000, tp0, tp1), -GEN_VXFORM (vaddubm,0 ,0 ), -GEN_VXFORM (vadduhm,0 ,1 ), +GEN_VXFORM_DUAL (vaddubm, vmul10cuq,0 ,0 ,PPC_ALTIVEC ,PPC_NONE ), +GEN_VXFORM_DUAL (vadduhm, vmul10ecuq,0 ,1 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM (vadduwm,0 ,2 ),GEN_VXFORM_207 (vaddudm,0 ,3 ), GEN_VXFORM_DUAL(vsububm, bcdadd, 0, 16, PPC_ALTIVEC, PPC_NONE),@@ -123,8 +123,8 @@ GEN_VXFORM(vslo, 6, 16),GEN_VXFORM (vsro,6 ,17 ),GEN_VXFORM (vaddcuw,0 ,6 ),GEN_VXFORM (vsubcuw,0 ,22 ), -GEN_VXFORM (vaddubs,0 ,8 ), -GEN_VXFORM (vadduhs,0 ,9 ), +GEN_VXFORM_DUAL (vaddubs, vmul10uq,0 ,8 ,PPC_ALTIVEC ,PPC_NONE ), +GEN_VXFORM_DUAL (vadduhs, vmul10euq,0 ,9 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM (vadduws,0 ,10 ),GEN_VXFORM (vaddsbs,0 ,12 ), GEN_VXFORM(vaddshs, 0, 13),
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 1/6] target-ppc: add vmul10[u, eu, cu, ecu]q instructions
Quoted 5 lines · David Gibson
Quoted 1 line
+
tcg_gen_mulu2_i64(t0, t1, cpu_avrl[rA(ctx->opcode)], val); \Do you really want to be using an actual mul op, rather than (in << 3)
+ (in << 1)? Obviously working out al the carries correctly will be a bit fiddly.
I think it's fine. Modern hardware will do the double-word multiply in 3-5 cycles, which is probably equal to what we could do by hand with shifts.
r~
Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/6] target-ppc: add vmul10[u, eu, cu, ecu]q instructions
Quoted 10 lines · Richard Henderson
Quoted 5 lines · David Gibson
Quoted 1 line
+
tcg_gen_mulu2_i64(t0, t1, cpu_avrl[rA(ctx->opcode)], val); \Do you really want to be using an actual mul op, rather than (in << 3)
+ (in << 1)? Obviously working out al the carries correctly will be a bit fiddly.I think it's fine. Modern hardware will do the double-word multiply in 3-5 cycles, which is probably equal to what we could do by hand with shifts.
Fair enough. And it will make for less dicking around with the carry in and carry out.
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 2/6 target-ppc: add vextu[bhw]lx instructions
In reply to Rajalakshmi SrinivasaraghavanFrom: Avinesh Kumar <[email protected]>
vextublx: Vector Extract Unsigned Byte Left vextuhlx: Vector Extract Unsigned Halfword Left vextuwlx: Vector Extract Unsigned Word Left
--- target-ppc/helper.h | 3 ++ target-ppc/int_helper.c | 37 +++++++++++++++++++++++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 19 ++++++++++++++++++ target-ppc/translate/vmx-ops.inc.c | 4 ++- 4 files changed, 62 insertions(+), 1 deletions(-)
target-ppc/helper.h +3 -0
@@ -344,6 +344,9 @@ DEF_HELPER_3(vpmsumb, void, avr, avr, avr) DEF_HELPER_3(vpmsumh, void, avr, avr, avr) DEF_HELPER_3(vpmsumw, void, avr, avr, avr) DEF_HELPER_3(vpmsumd, void, avr, avr, avr) +DEF_HELPER_2(vextublx, tl, tl, avr) +DEF_HELPER_2(vextuhlx, tl, tl, avr) +DEF_HELPER_2(vextuwlx, tl, tl, avr) DEF_HELPER_2(vsbox, void, avr, avr)DEF_HELPER_3 (vcipher, void, avr, avr, avr)
target-ppc/int_helper.c +37 -0
@@ -1705,6 +1705,43 @@ void helper_vlogefp(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *b) } } +#if defined(HOST_WORDS_BIGENDIAN ) +#define VEXTULX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = a & 0xf; \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index + i <= 15) { \ + r = r | b->u8[index + i]; \ + } \ + } \ + return r; \ +} +#else +#define VEXTULX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = 15 - (a & 0xf); \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index - i >= 0) { \ + r = r | b->u8[index - i]; \ + } \ + } \ + return r; \ +} +#endif + +VEXTULX_DO(vextublx, 1) +VEXTULX_DO(vextuhlx, 2) +VEXTULX_DO(vextuwlx, 4) +#undef VEXTULX_DO +/* The specification says that the results are undefined if all of the * shift counts are not identical. We check to make sure that they are * to conform to what real hardware appears to do. */
target-ppc/translate/vmx-impl.inc.c +19 -0
@@ -342,6 +342,19 @@ static void glue(gen_, name0##_##name1)(DisasContext *ctx) \ } \ } +#define GEN_VXFORM_HETRO (name, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ + TCGv_ptr rb; \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + rb = gen_avr_ptr(rB(ctx->opcode)); \ + gen_helper_##name(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], rb); \ + tcg_temp_free_ptr(rb); \ +} +GEN_VXFORM (vaddubm,0 ,0 );GEN_VXFORM_DUAL_EXT (vaddubm,PPC_NONE ,PPC2_ALTIVEC_207 ,0 , \ vmul10cuq,PPC_NONE ,PPC2_ISA300 ,0x0000F800 )
@@ -516,6 +529,12 @@ GEN_VXFORM_ENV(vsubfp, 5, 1);GEN_VXFORM_ENV (vmaxfp,5 ,16 );GEN_VXFORM_ENV (vminfp,5 ,17 ); +GEN_VXFORM_HETRO(vextublx, 6, 24) +GEN_VXFORM_HETRO(vextuhlx, 6, 25) +GEN_VXFORM_HETRO(vextuwlx, 6, 26) +GEN_VXFORM_DUAL (vmrgow,PPC_NONE ,PPC2_ALTIVEC_207 , + vextuwlx, PPC_NONE, PPC2_ISA300) +#define GEN_VXRFORM1 (opname, name, str, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \ { \
target-ppc/translate/vmx-ops.inc.c +3 -1
@@ -91,8 +91,10 @@ GEN_VXFORM(vmrghw, 6, 2),GEN_VXFORM (vmrglb,6 ,4 ),GEN_VXFORM (vmrglh,6 ,5 ),GEN_VXFORM (vmrglw,6 ,6 ), +GEN_VXFORM_300 (vextublx,6 ,24 ), +GEN_VXFORM_300 (vextuhlx,6 ,25 ), +GEN_VXFORM_DUAL (vmrgow, vextuwlx,6 ,26 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM_207 (vmrgew,6 ,30 ), -GEN_VXFORM_207 (vmrgow,6 ,26 ),GEN_VXFORM (vmuloub,4 ,0 ),GEN_VXFORM (vmulouh,4 ,1 ), GEN_VXFORM_DUAL(vmulouw, vmuluwm, 4, 2, PPC_ALTIVEC, PPC_NONE),
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 2/6] target-ppc: add vextu[bhw]lx instructions
Quoted 26 lines · Rajalakshmi Srinivasaraghavan
target-ppc/int_helper.c +26
-0+#if defined(HOST_WORDS_BIGENDIAN ) +#define VEXTULX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = a & 0xf; \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index + i <= 15) { \ + r = r | b->u8[index + i]; \ + } \ + } \ + return r; \ +} +#else +#define VEXTULX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = 15 - (a & 0xf); \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index - i >= 0) { \ + r = r | b->u8[index - i]; \
target-ppc/int_helper.c void helper_vlogefp(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *b) · line 1743
Quoted 10 lines
target-ppc/int_helper.c +10
-0+ } \ + } \ +return r; \ +} +#endif + +VEXTULX_DO(vextublx, 1) +VEXTULX_DO(vextuhlx, 2) +VEXTULX_DO(vextuwlx, 4) +#undef VEXTULX_DO
Ew.
This should be one 128-bit shift and one and.
Since the shift amount is a multiple of 8, the 128-bit shift for vextub[lr]x does not need to cross a double-word boundary, and so can be decomposed into one 64-bit shift of (count & 64 ? hi : lo).
For vextu[hw]lr]x, you'd need to do the whole left-shift, right-shift, or thing.
But still, fantastically better than a loop.
r~
Re: [Qemu-devel] [PATCH 2/6] target-ppc: add vextu[bhw]lx instructions
Quoted 41 lines · Richard Henderson
Quoted 26 lines · Rajalakshmi Srinivasaraghavan
target-ppc/int_helper.c +26
-0+#if defined(HOST_WORDS_BIGENDIAN ) +#define VEXTULX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = a & 0xf; \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index + i <= 15) { \ + r = r | b->u8[index + i]; \ + } \ + } \ + return r; \ +} +#else +#define VEXTULX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = 15 - (a & 0xf); \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index - i >= 0) { \ + r = r | b->u8[index - i]; \target-ppc/int_helper.c void helper_vlogefp(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *b) · line 1743
Quoted 10 lines
target-ppc/int_helper.c +10
-0+ } \ + } \ +return r; \ +} +#endif + +VEXTULX_DO(vextublx, 1) +VEXTULX_DO(vextuhlx, 2) +VEXTULX_DO(vextuwlx, 4) +#undef VEXTULX_DOEw.
This should be one 128-bit shift and one and.
Quoted 7 lines
Since the shift amount is a multiple of 8, the 128-bit shift for vextub[lr]x does not need to cross a double-word boundary, and so can be decomposed into one 64-bit shift of (count & 64 ? hi : lo).
For vextu[hw]lr]x, you'd need to do the whole left-shift, right-shift, or thing.
But still, fantastically better than a loop.
Ack. Will send an updated patch.
Quoted 5 lines
r~
Signature · 2 lines
Thanks Rajalakshmi S
Re: [Qemu-devel] [PATCH 2/6] target-ppc: add vextu[bhw]lx instructions
Quoted 44 lines · Rajalakshmi Srinivasaraghavan
Quoted 41 lines · Richard Henderson
Quoted 26 lines · Rajalakshmi Srinivasaraghavan
(quoted diff) +26
-0+#if defined(HOST_WORDS_BIGENDIAN) +#define VEXTULX_DO(name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = a & 0xf; \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index + i <= 15) { \ + r = r | b->u8[index + i]; \ + } \ + } \ + return r; \ +} +#else +#define VEXTULX_DO(name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = 15 - (a & 0xf); \ + for (i = 0; i < elem; i++) { \ + r = r << 8; \ + if (index - i >= 0) { \ + r = r | b->u8[index - i]; \Review
Quoted 10 lines
(quoted diff) +10
-0+ } \ + } \ + return r; \ +} +#endif + +VEXTULX_DO(vextublx, 1) +VEXTULX_DO(vextuhlx, 2) +VEXTULX_DO(vextuwlx, 4) +#undef VEXTULX_DOEw.
This should be one 128-bit shift and one and.
Quoted 8 lines
Quoted 7 lines
Since the shift amount is a multiple of 8, the 128-bit shift for vextub[lr]x does not need to cross a double-word boundary, and so can be decomposed into one 64-bit shift of (count & 64 ? hi : lo).
For vextu[hw]lr]x, you'd need to do the whole left-shift, right-shift, or thing.
But still, fantastically better than a loop.
Ack. Will send an updated patch.
Attached updated patch.
Quoted 6 lines
Quoted 5 lines
r~
Signature · 2 lines
Thanks Rajalakshmi S
Quoted 1 line
From
59b96e11dd4c649ba9dbf0435439f717b931530fMon Sep 17 00:00:00 2001
From: Rajalakshmi Srinivasaraghavan <[email protected]>
Date: Mon, 24 Oct 2016 11:36:33 +0530
Subject: [PATCH 1/2] target-ppc: add vextu[bhw]lx instructions
vextublx: Vector Extract Unsigned Byte Left vextuhlx: Vector Extract Unsigned Halfword Left vextuwlx: Vector Extract Unsigned Word Left
--- target-ppc/helper.h | 3 ++ target-ppc/int_helper.c | 63 +++++++++++++++++++++++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 18 ++++++++++ target-ppc/translate/vmx-ops.inc.c | 4 ++- 4 files changed, 87 insertions(+), 1 deletions(-)
target-ppc/helper.h +3 -0
@@ -357,6 +357,9 @@ DEF_HELPER_3(vpmsumb, void, avr, avr, avr) DEF_HELPER_3(vpmsumh, void, avr, avr, avr) DEF_HELPER_3(vpmsumw, void, avr, avr, avr) DEF_HELPER_3(vpmsumd, void, avr, avr, avr) +DEF_HELPER_2(vextublx, tl, tl, avr) +DEF_HELPER_2(vextuhlx, tl, tl, avr) +DEF_HELPER_2(vextuwlx, tl, tl, avr) DEF_HELPER_2(vsbox, void, avr, avr)DEF_HELPER_3 (vcipher, void, avr, avr, avr)
target-ppc/int_helper.c +63 -0
69 lines not on this page · raw message
target-ppc/translate/vmx-impl.inc.c +18 -0
@@ -276,6 +276,19 @@ static void glue(gen_, name0##_##name1)(DisasContext *ctx) \ } \ } +#define GEN_VXFORM_HETRO (name, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) \ +{ \ + TCGv_ptr rb; \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + rb = gen_avr_ptr(rB(ctx->opcode)); \ + gen_helper_##name(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], rb); \ + tcg_temp_free_ptr(rb); \ +} +GEN_VXFORM (vaddubm,0 ,0 );GEN_VXFORM (vadduhm,0 ,1 );GEN_VXFORM (vadduwm,0 ,2 );
@@ -441,6 +454,11 @@ GEN_VXFORM_ENV(vaddfp, 5, 0);GEN_VXFORM_ENV (vsubfp,5 ,1 );GEN_VXFORM_ENV (vmaxfp,5 ,16 );GEN_VXFORM_ENV (vminfp,5 ,17 ); +GEN_VXFORM_HETRO(vextublx, 6, 24) +GEN_VXFORM_HETRO(vextuhlx, 6, 25) +GEN_VXFORM_HETRO(vextuwlx, 6, 26) +GEN_VXFORM_DUAL (vmrgow,PPC_NONE ,PPC2_ALTIVEC_207 , + vextuwlx, PPC_NONE, PPC2_ISA300)#define GEN_VXRFORM1 (opname, name, str, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \
target-ppc/translate/vmx-ops.inc.c +3 -1
@@ -91,8 +91,10 @@ GEN_VXFORM(vmrghw, 6, 2),GEN_VXFORM (vmrglb,6 ,4 ),GEN_VXFORM (vmrglh,6 ,5 ),GEN_VXFORM (vmrglw,6 ,6 ), +GEN_VXFORM_300 (vextublx,6 ,24 ), +GEN_VXFORM_300 (vextuhlx,6 ,25 ), +GEN_VXFORM_DUAL (vmrgow, vextuwlx,6 ,26 ,PPC_NONE ,PPC2_ALTIVEC_207 ),GEN_VXFORM_207 (vmrgew,6 ,30 ), -GEN_VXFORM_207 (vmrgow,6 ,26 ),GEN_VXFORM (vmuloub,4 ,0 ),GEN_VXFORM (vmulouh,4 ,1 ), GEN_VXFORM_DUAL(vmulouw, vmuluwm, 4, 2, PPC_ALTIVEC, PPC_NONE),
Signature · 1 line
1.7.1
PATCH 3/6 target-ppc: add vextu[bhw]rx instructions
In reply to Rajalakshmi SrinivasaraghavanFrom: Hariharan T.S <[email protected]>
vextubrx: Vector Extract Unsigned Byte Right-Indexed VX-form
vextuhrx: Vector Extract Unsigned Halfword Right-Indexed VX-form
vextuwrx: Vector Extract Unsigned Word Right-Indexed VX-form
--- target-ppc/helper.h | 3 ++ target-ppc/int_helper.c | 38 ++++++++++++++++++++++++++++++++++- target-ppc/translate/vmx-impl.inc.c | 5 ++++ target-ppc/translate/vmx-ops.inc.c | 4 ++- 4 files changed, 48 insertions(+), 2 deletions(-)
target-ppc/helper.h +3 -0
@@ -347,6 +347,9 @@ DEF_HELPER_3(vpmsumd, void, avr, avr, avr) DEF_HELPER_2(vextublx, tl, tl, avr) DEF_HELPER_2(vextuhlx, tl, tl, avr) DEF_HELPER_2(vextuwlx, tl, tl, avr) +DEF_HELPER_2(vextubrx, tl, tl, avr) +DEF_HELPER_2(vextuhrx, tl, tl, avr) +DEF_HELPER_2(vextuwrx, tl, tl, avr) DEF_HELPER_2(vsbox, void, avr, avr)DEF_HELPER_3 (vcipher, void, avr, avr, avr)
target-ppc/int_helper.c +37 -1
@@ -1561,7 +1561,6 @@ void helper_vpmsumd(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)#endif } -#if defined(HOST_WORDS_BIGENDIAN )#define PKBIG 1#else
@@ -1742,6 +1741,43 @@ VEXTULX_DO(vextuhlx, 2) VEXTULX_DO(vextuwlx, 4)#undef VEXTULX_DO +#if defined(HOST_WORDS_BIGENDIAN ) +#define VEXTURX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = a & 0xf; \ + for (i = elem - 1; i >= 0; i--) { \ + r = r << 8; \ + if ((15 - i - index) >= 0) { \ + r = r | b->u8[15 - i - index]; \ + } \ + } \ + return r; \ +} +#else +#define VEXTURX_DO (name, elem) \ +target_ulong glue(helper_, name)(target_ulong a, ppc_avr_t *b) \ +{ \ + target_ulong r = 0; \ + int i; \ + int index = 15 - (a & 0xf); \ + for (i = elem - 1; i >= 0; i--) { \ + r = r << 8; \ + if ((15 + i - index) <= 15) { \ + r = r | b->u8[15 + i - index]; \ + } \ + } \ + return r; \ +} +#endif + +VEXTURX_DO(vextubrx, 1) +VEXTURX_DO(vextuhrx, 2) +VEXTURX_DO(vextuwrx, 4) +#undef VEXTURX_DO +/* The specification says that the results are undefined if all of the * shift counts are not identical. We check to make sure that they are * to conform to what real hardware appears to do. */
target-ppc/translate/vmx-impl.inc.c +5 -0
@@ -534,6 +534,11 @@ GEN_VXFORM_HETRO(vextuhlx, 6, 25) GEN_VXFORM_HETRO(vextuwlx, 6, 26)GEN_VXFORM_DUAL (vmrgow,PPC_NONE ,PPC2_ALTIVEC_207 , vextuwlx, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_HETRO(vextubrx, 6, 28) +GEN_VXFORM_HETRO(vextuhrx, 6, 29) +GEN_VXFORM_HETRO(vextuwrx, 6, 30) +GEN_VXFORM_DUAL (vmrgew,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vextuwrx, PPC_NONE, PPC2_ISA300)#define GEN_VXRFORM1 (opname, name, str, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \
target-ppc/translate/vmx-ops.inc.c +3 -1
@@ -94,7 +94,9 @@ GEN_VXFORM(vmrglw, 6, 6),GEN_VXFORM_300 (vextublx,6 ,24 ),GEN_VXFORM_300 (vextuhlx,6 ,25 ),GEN_VXFORM_DUAL (vmrgow, vextuwlx,6 ,26 ,PPC_ALTIVEC ,PPC_NONE ), -GEN_VXFORM_207 (vmrgew,6 ,30 ), +GEN_VXFORM_300 (vextubrx,6 ,28 ), +GEN_VXFORM_300 (vextuhrx,6 ,29 ), +GEN_VXFORM_DUAL (vmrgew, vextuwrx,6 ,30 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM (vmuloub,4 ,0 ),GEN_VXFORM (vmulouh,4 ,1 ), GEN_VXFORM_DUAL(vmulouw, vmuluwm, 4, 2, PPC_ALTIVEC, PPC_NONE),
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 3/6] target-ppc: add vextu[bhw]rx instructions
Quoted 2 lines · Rajalakshmi Srinivasaraghavan
From: Hariharan
T.S<[email protected]>
Attached updatde patch based on comments on vextu[bhw]lx.
Signature · 2 lines
Thanks Rajalakshmi S
Quoted 1 line
From
f027eb4903b89720634423c335e3688cf1e8632dMon Sep 17 00:00:00 2001
From: Rajalakshmi Srinivasaraghavan <[email protected]>
Date: Mon, 24 Oct 2016 12:23:31 +0530
Subject: [PATCH 2/2] target-ppc: add vextu[bhw]rx instructions
vextubrx: Vector Extract Unsigned Byte Right-Indexed VX-form
vextuhrx: Vector Extract Unsigned Halfword Right-Indexed VX-form
vextuwrx: Vector Extract Unsigned Word Right-Indexed VX-form
--- target-ppc/helper.h | 3 ++ target-ppc/int_helper.c | 60 +++++++++++++++++++++++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 5 +++ target-ppc/translate/vmx-ops.inc.c | 4 ++- 4 files changed, 71 insertions(+), 1 deletions(-)
target-ppc/helper.h +3 -0
@@ -360,6 +360,9 @@ DEF_HELPER_3(vpmsumd, void, avr, avr, avr) DEF_HELPER_2(vextublx, tl, tl, avr) DEF_HELPER_2(vextuhlx, tl, tl, avr) DEF_HELPER_2(vextuwlx, tl, tl, avr) +DEF_HELPER_2(vextubrx, tl, tl, avr) +DEF_HELPER_2(vextuhrx, tl, tl, avr) +DEF_HELPER_2(vextuwrx, tl, tl, avr) DEF_HELPER_2(vsbox, void, avr, avr)DEF_HELPER_3 (vcipher, void, avr, avr, avr)
target-ppc/int_helper.c +60 -0
66 lines not on this page · raw message
target-ppc/translate/vmx-impl.inc.c +5 -0
@@ -459,6 +459,11 @@ GEN_VXFORM_HETRO(vextuhlx, 6, 25) GEN_VXFORM_HETRO(vextuwlx, 6, 26)GEN_VXFORM_DUAL (vmrgow,PPC_NONE ,PPC2_ALTIVEC_207 , vextuwlx, PPC_NONE, PPC2_ISA300) +GEN_VXFORM_HETRO(vextubrx, 6, 28) +GEN_VXFORM_HETRO(vextuhrx, 6, 29) +GEN_VXFORM_HETRO(vextuwrx, 6, 30) +GEN_VXFORM_DUAL (vmrgew,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vextuwrx, PPC_NONE, PPC2_ISA300)#define GEN_VXRFORM1 (opname, name, str, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \
target-ppc/translate/vmx-ops.inc.c +3 -1
@@ -94,7 +94,9 @@ GEN_VXFORM(vmrglw, 6, 6),GEN_VXFORM_300 (vextublx,6 ,24 ),GEN_VXFORM_300 (vextuhlx,6 ,25 ),GEN_VXFORM_DUAL (vmrgow, vextuwlx,6 ,26 ,PPC_NONE ,PPC2_ALTIVEC_207 ), -GEN_VXFORM_207 (vmrgew,6 ,30 ), +GEN_VXFORM_300 (vextubrx,6 ,28 ), +GEN_VXFORM_300 (vextuhrx,6 ,29 ), +GEN_VXFORM_DUAL (vmrgew, vextuwrx,6 ,30 ,PPC_NONE ,PPC2_ALTIVEC_207 ),GEN_VXFORM (vmuloub,4 ,0 ),GEN_VXFORM (vmulouh,4 ,1 ), GEN_VXFORM_DUAL(vmulouw, vmuluwm, 4, 2, PPC_ALTIVEC, PPC_NONE),
Signature · 1 line
1.7.1
PATCH 4/6 target-ppc: fix invalid mask - cmpl, bctar
In reply to Rajalakshmi SrinivasaraghavanFrom: Avinesh Kumar <[email protected]>
cmpl: invalid bit mask should be 0x00400001 bctar: invalid bit mask should be 0x0000E000
--- target-ppc/translate.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
target-ppc/translate.c +2 -2
@@ -6203,7 +6203,7 @@ static opcode_t opcodes[] = { GEN_HANDLER(invalid, 0x00, 0x00, 0x00, 0xFFFFFFFF, PPC_NONE), GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PPC_INTEGER), GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER), -GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400000, PPC_INTEGER), +GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400001, PPC_INTEGER), GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER),#if defined(TARGET_PPC64 ) GEN_HANDLER_E(cmpeqb, 0x1F, 0x00, 0x07, 0x00600000, PPC_NONE, PPC2_ISA300),
@@ -6297,7 +6297,7 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW),GEN_HANDLER (bc,0x10 ,0xFF ,0xFF ,0x00000000 ,PPC_FLOW ),GEN_HANDLER (bcctr,0x13 ,0x10 ,0x10 ,0x00000000 ,PPC_FLOW ),GEN_HANDLER (bclr,0x13 ,0x10 ,0x00 ,0x00000000 ,PPC_FLOW ), -GEN_HANDLER_E (bctar,0x13 ,0x10 ,0x11 ,0 ,PPC_NONE ,PPC2_BCTAR_ISA207 ), +GEN_HANDLER_E (bctar,0x13 ,0x10 ,0x11 ,0x0000E000 ,PPC_NONE ,PPC2_BCTAR_ISA207 ),GEN_HANDLER (mcrf,0x13 ,0x00 ,0xFF ,0x00000001 ,PPC_INTEGER ),GEN_HANDLER (rfi,0x13 ,0x12 ,0x01 ,0x03FF8001 ,PPC_FLOW ), #if defined(TARGET_PPC64)
Signature · 1 line
1.7.1
David Gibson
AppliedRe: [Qemu-devel] [PATCH 4/6] target-ppc: fix invalid mask - cmpl, bctar
Quoted 8 lines · Rajalakshmi Srinivasaraghavan
From: Avinesh Kumar <[email protected]>
cmpl: invalid bit mask should be 0x00400001 bctar: invalid bit mask should be 0x0000E000Signed-off-by Avinesh Kumar <[email protected]>Signed-off-by Rajalakshmi Srinivasaraghavan
Applied to ppc-for-2.8.
Quoted 26 lines
--- target-ppc/translate.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)target-ppc/translate.c +2
-2@@ -6203,7 +6203,7 @@ static opcode_t opcodes[] = { GEN_HANDLER(invalid, 0x00, 0x00, 0x00, 0xFFFFFFFF, PPC_NONE), GEN_HANDLER(cmp, 0x1F, 0x00, 0x00, 0x00400000, PPC_INTEGER), GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER), -GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400000, PPC_INTEGER), +GEN_HANDLER(cmpl, 0x1F, 0x00, 0x01, 0x00400001, PPC_INTEGER), GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER),#if defined(TARGET_PPC64 ) GEN_HANDLER_E(cmpeqb, 0x1F, 0x00, 0x07, 0x00600000, PPC_NONE, PPC2_ISA300),@@ -6297,7 +6297,7 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW),GEN_HANDLER (bc,0x10 ,0xFF ,0xFF ,0x00000000 ,PPC_FLOW ),GEN_HANDLER (bcctr,0x13 ,0x10 ,0x10 ,0x00000000 ,PPC_FLOW ),GEN_HANDLER (bclr,0x13 ,0x10 ,0x00 ,0x00000000 ,PPC_FLOW ), -GEN_HANDLER_E (bctar,0x13 ,0x10 ,0x11 ,0 ,PPC_NONE ,PPC2_BCTAR_ISA207 ), +GEN_HANDLER_E (bctar,0x13 ,0x10 ,0x11 ,0x0000E000 ,PPC_NONE ,PPC2_BCTAR_ISA207 ),GEN_HANDLER (mcrf,0x13 ,0x00 ,0xFF ,0x00000001 ,PPC_INTEGER ),GEN_HANDLER (rfi,0x13 ,0x12 ,0x01 ,0x03FF8001 ,PPC_FLOW ), #if defined(TARGET_PPC64)
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 5/6 target-ppc: add vector compare not equal instructions
In reply to Rajalakshmi SrinivasaraghavanThe following vector compare not equal instructions are added from ISA 3.0.
vcmpneb - Vector Compare Not Equal Byte
vcmpneh - Vector Compare Not Equal Halfword
vcmpnew - Vector Compare Not Equal Word
--- target-ppc/helper.h | 6 ++++++ target-ppc/int_helper.c | 31 +++++++++++++++++++------------ target-ppc/translate/vmx-impl.inc.c | 11 ++++++++++- target-ppc/translate/vmx-ops.inc.c | 6 +++--- 4 files changed, 38 insertions(+), 16 deletions(-)
target-ppc/helper.h +6 -0
@@ -147,6 +147,9 @@ DEF_HELPER_4(vcmpequb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneb, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneh, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnew, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezh, void, env, avr, avr, avr)DEF_HELPER_4 (vcmpnezw, void, env, avr, avr, avr)
@@ -166,6 +169,9 @@ DEF_HELPER_4(vcmpequb_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneb_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneh_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnew_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezb_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezh_dot, void, env, avr, avr, avr)DEF_HELPER_4 (vcmpnezw_dot, void, env, avr, avr, avr)
target-ppc/int_helper.c +19 -12
@@ -735,20 +735,24 @@ VCMP(gtsd, >, s64)#undef VCMP_DO#undef VCMP -#define VCMPNEZ_DO (suffix, element, etype, record) \ -void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \ +#define VCMPNE_DO (suffix, element, etype, cmpzero, record) \ +void helper_vcmpne##suffix(CPUPPCState *env, ppc_avr_t *r, \ ppc_avr_t *a, ppc_avr_t *b) \ { \ etype ones = (etype)-1; \ etype all = ones; \ - etype none = 0; \ + etype result, none = 0; \ int i; \ \ for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - etype result = ((a->element[i] == 0) \ + if (cmpzero) { \ + result = ((a->element[i] == 0) \ || (b->element[i] == 0) \ || (a->element[i] != b->element[i]) ? \ ones : 0x0); \ + } else { \ + result = (a->element[i] != b->element[i]) ? ones : 0x0; \ + } \ r->element[i] = result; \ all &= result; \ none |= result; \
@@ -762,14 +766,17 @@ void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \* suffix - instruction mnemonic suffix (b: byte, h: halfword, w: word) * element - element type to access from vector */ -#define VCMPNEZ (suffix, element, etype) \ - VCMPNEZ_DO(suffix, element, etype, 0) \ - VCMPNEZ_DO(suffix##_dot, element, etype, 1) -VCMPNEZ(b, u8, uint8_t) -VCMPNEZ(h, u16, uint16_t) -VCMPNEZ(w, u32, uint32_t) -#undef VCMPNEZ_DO -#undef VCMPNEZ +#define VCMPNE (suffix, element, etype, cmpzero) \ + VCMPNE_DO(suffix, element, etype, cmpzero, 0) \ + VCMPNE_DO(suffix##_dot, element, etype, cmpzero, 1) +VCMPNE(zb, u8, uint8_t, 1) +VCMPNE(zh, u16, uint16_t, 1) +VCMPNE(zw, u32, uint32_t, 1) +VCMPNE(b, u8, uint8_t, 0) +VCMPNE(h, u16, uint16_t, 0) +VCMPNE(w, u32, uint32_t, 0) +#undef VCMPNE_DO +#undef VCMPNE#define VCMPFP_DO (suffix, compare, order, record) \ void helper_vcmp##suffix(CPUPPCState *env, ppc_avr_t *r, \
target-ppc/translate/vmx-impl.inc.c +10 -1
@@ -608,7 +608,16 @@ GEN_VXRFORM(vcmpeqfp, 3, 3) GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM(vcmpgtfp, 3, 11) GEN_VXRFORM(vcmpbfp, 3, 15) - +GEN_VXRFORM(vcmpneb, 3, 0) +GEN_VXRFORM(vcmpneh, 3, 1) +GEN_VXRFORM(vcmpnew, 3, 2) + +GEN_VXRFORM_DUAL (vcmpequb,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpneb, PPC_NONE, PPC2_ISA300) +GEN_VXRFORM_DUAL (vcmpequh,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpneh, PPC_NONE, PPC2_ISA300) +GEN_VXRFORM_DUAL (vcmpequw,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpnew, PPC_NONE, PPC2_ISA300)GEN_VXRFORM_DUAL (vcmpeqfp,PPC_ALTIVEC ,PPC_NONE , \ vcmpequd, PPC_NONE, PPC2_ALTIVEC_207) GEN_VXRFORM_DUAL(vcmpbfp, PPC_ALTIVEC, PPC_NONE, \
target-ppc/translate/vmx-ops.inc.c +3 -3
@@ -185,9 +185,6 @@ GEN_HANDLER2_E(name, str, 0x4, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA300), GEN_VXRFORM1_300(name, name, #name, opc2, opc3) \ GEN_VXRFORM1_300(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4))) -GEN_VXRFORM(vcmpequb, 3, 0) -GEN_VXRFORM(vcmpequh, 3, 1) -GEN_VXRFORM(vcmpequw, 3, 2) GEN_VXRFORM_300(vcmpnezb, 3, 4) GEN_VXRFORM_300(vcmpnezh, 3, 5)GEN_VXRFORM_300 (vcmpnezw,3 ,6 )
@@ -201,6 +198,9 @@ GEN_VXRFORM_DUAL(vcmpeqfp, vcmpequd, 3, 3, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM_DUAL(vcmpgtfp, vcmpgtud, 3, 11, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM_DUAL(vcmpbfp, vcmpgtsd, 3, 15, PPC_ALTIVEC, PPC_NONE) +GEN_VXRFORM_DUAL(vcmpequb, vcmpneb, 3, 0, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXRFORM_DUAL(vcmpequh, vcmpneh, 3, 1, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXRFORM_DUAL(vcmpequw, vcmpnew, 3, 2, PPC_NONE, PPC2_ALTIVEC_207)#define GEN_VXFORM_DUAL_INV (name0, name1, opc2, opc3, inval0, inval1, type) \ GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, \
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 5/6] target-ppc: add vector compare not equal instructions
Quoted 6 lines · Rajalakshmi Srinivasaraghavan
The following vector compare not equal instructions are added from ISA 3.0.
vcmpneb - Vector Compare Not Equal Byte
vcmpneh - Vector Compare Not Equal Halfword
vcmpnew - Vector Compare Not Equal Word
Quoted 7 lines
Signed-off-by Rajalakshmi Srinivasaraghavan <[email protected]>--- target-ppc/helper.h | 6 ++++++ target-ppc/int_helper.c | 31 +++++++++++++++++++------------ target-ppc/translate/vmx-impl.inc.c | 11 ++++++++++- target-ppc/translate/vmx-ops.inc.c | 6 +++--- 4 files changed, 38 insertions(+), 16 deletions(-)
r~
David Gibson
AppliedRe: [Qemu-devel] [PATCH 5/6] target-ppc: add vector compare not equal instructions
In reply to Rajalakshmi SrinivasaraghavanQuoted 8 lines · Rajalakshmi Srinivasaraghavan
The following vector compare not equal instructions are added from ISA 3.0.
vcmpneb - Vector Compare Not Equal Byte
vcmpneh - Vector Compare Not Equal Halfword
vcmpnew - Vector Compare Not Equal WordSigned-off-by: Rajalakshmi Srinivasaraghavan
<[email protected]>
Applied to ppc-for-2.8.
Quoted 136 lines
--- target-ppc/helper.h | 6 ++++++ target-ppc/int_helper.c | 31 +++++++++++++++++++------------ target-ppc/translate/vmx-impl.inc.c | 11 ++++++++++- target-ppc/translate/vmx-ops.inc.c | 6 +++--- 4 files changed, 38 insertions(+), 16 deletions(-)target-ppc/helper.h +6
-0@@ -147,6 +147,9 @@ DEF_HELPER_4(vcmpequb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneb, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneh, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnew, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezh, void, env, avr, avr, avr)DEF_HELPER_4 (vcmpnezw, void, env, avr, avr, avr)@@ -166,6 +169,9 @@ DEF_HELPER_4(vcmpequb_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequd_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneb_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpneh_dot, void, env, avr, avr, avr) +DEF_HELPER_4(vcmpnew_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezb_dot, void, env, avr, avr, avr) DEF_HELPER_4(vcmpnezh_dot, void, env, avr, avr, avr)DEF_HELPER_4 (vcmpnezw_dot, void, env, avr, avr, avr)target-ppc/int_helper.c +19
-12@@ -735,20 +735,24 @@ VCMP(gtsd, >, s64)#undef VCMP_DO#undef VCMP -#define VCMPNEZ_DO (suffix, element, etype, record) \ -void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \ +#define VCMPNE_DO (suffix, element, etype, cmpzero, record) \ +void helper_vcmpne##suffix(CPUPPCState *env, ppc_avr_t *r, \ ppc_avr_t *a, ppc_avr_t *b) \ { \ etype ones = (etype)-1; \ etype all = ones; \ - etype none = 0; \ + etype result, none = 0; \ int i; \ \ for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ - etype result = ((a->element[i] == 0) \ + if (cmpzero) { \ + result = ((a->element[i] == 0) \ || (b->element[i] == 0) \ || (a->element[i] != b->element[i]) ? \ ones : 0x0); \ + } else { \ + result = (a->element[i] != b->element[i]) ? ones : 0x0; \ + } \ r->element[i] = result; \ all &= result; \ none |= result; \@@ -762,14 +766,17 @@ void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \* suffix - instruction mnemonic suffix (b: byte, h: halfword, w: word) * element - element type to access from vector */ -#define VCMPNEZ (suffix, element, etype) \ - VCMPNEZ_DO(suffix, element, etype, 0) \ - VCMPNEZ_DO(suffix##_dot, element, etype, 1) -VCMPNEZ(b, u8, uint8_t) -VCMPNEZ(h, u16, uint16_t) -VCMPNEZ(w, u32, uint32_t) -#undef VCMPNEZ_DO -#undef VCMPNEZ +#define VCMPNE (suffix, element, etype, cmpzero) \ + VCMPNE_DO(suffix, element, etype, cmpzero, 0) \ + VCMPNE_DO(suffix##_dot, element, etype, cmpzero, 1) +VCMPNE(zb, u8, uint8_t, 1) +VCMPNE(zh, u16, uint16_t, 1) +VCMPNE(zw, u32, uint32_t, 1) +VCMPNE(b, u8, uint8_t, 0) +VCMPNE(h, u16, uint16_t, 0) +VCMPNE(w, u32, uint32_t, 0) +#undef VCMPNE_DO +#undef VCMPNE#define VCMPFP_DO (suffix, compare, order, record) \ void helper_vcmp##suffix(CPUPPCState *env, ppc_avr_t *r, \target-ppc/translate/vmx-impl.inc.c +10
-1@@ -608,7 +608,16 @@ GEN_VXRFORM(vcmpeqfp, 3, 3) GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM(vcmpgtfp, 3, 11) GEN_VXRFORM(vcmpbfp, 3, 15) - +GEN_VXRFORM(vcmpneb, 3, 0) +GEN_VXRFORM(vcmpneh, 3, 1) +GEN_VXRFORM(vcmpnew, 3, 2) + +GEN_VXRFORM_DUAL (vcmpequb,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpneb, PPC_NONE, PPC2_ISA300) +GEN_VXRFORM_DUAL (vcmpequh,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpneh, PPC_NONE, PPC2_ISA300) +GEN_VXRFORM_DUAL (vcmpequw,PPC_NONE ,PPC2_ALTIVEC_207 , \ + vcmpnew, PPC_NONE, PPC2_ISA300)GEN_VXRFORM_DUAL (vcmpeqfp,PPC_ALTIVEC ,PPC_NONE , \ vcmpequd, PPC_NONE, PPC2_ALTIVEC_207) GEN_VXRFORM_DUAL(vcmpbfp, PPC_ALTIVEC, PPC_NONE, \target-ppc/translate/vmx-ops.inc.c +3
-3@@ -185,9 +185,6 @@ GEN_HANDLER2_E(name, str, 0x4, opc2, opc3, 0x00000000, PPC_NONE, PPC2_ISA300), GEN_VXRFORM1_300(name, name, #name, opc2, opc3) \ GEN_VXRFORM1_300(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4))) -GEN_VXRFORM(vcmpequb, 3, 0) -GEN_VXRFORM(vcmpequh, 3, 1) -GEN_VXRFORM(vcmpequw, 3, 2) GEN_VXRFORM_300(vcmpnezb, 3, 4) GEN_VXRFORM_300(vcmpnezh, 3, 5)GEN_VXRFORM_300 (vcmpnezw,3 ,6 )@@ -201,6 +198,9 @@ GEN_VXRFORM_DUAL(vcmpeqfp, vcmpequd, 3, 3, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM(vcmpgefp, 3, 7) GEN_VXRFORM_DUAL(vcmpgtfp, vcmpgtud, 3, 11, PPC_ALTIVEC, PPC_NONE) GEN_VXRFORM_DUAL(vcmpbfp, vcmpgtsd, 3, 15, PPC_ALTIVEC, PPC_NONE) +GEN_VXRFORM_DUAL(vcmpequb, vcmpneb, 3, 0, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXRFORM_DUAL(vcmpequh, vcmpneh, 3, 1, PPC_NONE, PPC2_ALTIVEC_207) +GEN_VXRFORM_DUAL(vcmpequw, vcmpnew, 3, 2, PPC_NONE, PPC2_ALTIVEC_207)#define GEN_VXFORM_DUAL_INV (name0, name1, opc2, opc3, inval0, inval1, type) \ GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type, \
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 6/6 target-ppc: add vclzlsbb/vctzlsbb instructions
In reply to Rajalakshmi SrinivasaraghavanThe following vector instructions are added from ISA 3.0.
vclzlsbb - Vector Count Leading Zero Least-Significant Bits Byte vctzlsbb - Vector Count Trailing Zero Least-Significant Bits Byte
--- target-ppc/helper.h | 2 ++ target-ppc/int_helper.c | 28 ++++++++++++++++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 14 ++++++++++++++ target-ppc/translate/vmx-ops.inc.c | 2 ++ 4 files changed, 46 insertions(+), 0 deletions(-)
target-ppc/helper.h +2 -0
@@ -343,6 +343,8 @@ DEF_HELPER_2(vpopcntb, void, avr, avr) DEF_HELPER_2(vpopcnth, void, avr, avr) DEF_HELPER_2(vpopcntw, void, avr, avr) DEF_HELPER_2(vpopcntd, void, avr, avr) +DEF_HELPER_1(vclzlsbb, tl, avr) +DEF_HELPER_1(vctzlsbb, tl, avr) DEF_HELPER_3(vbpermd, void, avr, avr, avr) DEF_HELPER_3(vbpermq, void, avr, avr, avr)DEF_HELPER_2 (vgbbd, void, avr, avr)
target-ppc/int_helper.c +28 -0
@@ -881,6 +881,34 @@ VCT(uxs, cvtsduw, u32) VCT(sxs, cvtsdsw, s32)#undef VCT +target_ulong helper_vclzlsbb (ppc_avr_t *r) +{ +target_ulong count =0 ; +int i; + VECTOR_FOR_INORDER_I(i, u8) { +if (r->u8[i] &0x01 ) { +break ; + } + count++; + } +return count; +} +target_ulong helper_vctzlsbb (ppc_avr_t *r) +{ +target_ulong count =0 ; +int i; +#if defined(HOST_WORDS_BIGENDIAN ) +for (i =ARRAY_SIZE (r->u8) -1 ; i >=0 ; i--) { +#else +for (i =0 ; i <ARRAY_SIZE (r->u8); i++) { +#endif +if (r->u8[i] &0x01 ) { +break ; + } + count++; + } +return count; +}void helper_vmhaddshs (CPUPPCState *env,ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b,ppc_avr_t *c) {
target-ppc/translate/vmx-impl.inc.c +14 -0
@@ -691,6 +691,18 @@ static void glue(gen_, name)(DisasContext *ctx) \tcg_temp_free_ptr (rd); \ } +#define GEN_VXFORM_NOA_3 (name, opc2, opc3, opc4) \ +static void glue(gen_, name)(DisasContext *ctx) \ + { \ + TCGv_ptr rb; \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + rb = gen_avr_ptr(rB(ctx->opcode)); \ + gen_helper_##name(cpu_gpr[rD(ctx->opcode)], rb); \ + tcg_temp_free_ptr(rb); \ + }GEN_VXFORM_NOA (vupkhsb,7 ,8 );GEN_VXFORM_NOA (vupkhsh,7 ,9 );GEN_VXFORM_NOA (vupkhsw,7 ,25 );
@@ -905,6 +917,8 @@ GEN_VXFORM_NOA_2(vctzb, 1, 24, 28) GEN_VXFORM_NOA_2(vctzh, 1, 24, 29) GEN_VXFORM_NOA_2(vctzw, 1, 24, 30) GEN_VXFORM_NOA_2(vctzd, 1, 24, 31) +GEN_VXFORM_NOA_3(vclzlsbb, 1, 24, 0) +GEN_VXFORM_NOA_3(vctzlsbb, 1, 24, 1) GEN_VXFORM_NOA(vpopcntb, 1, 28) GEN_VXFORM_NOA(vpopcnth, 1, 29)GEN_VXFORM_NOA (vpopcntw,1 ,30 )
target-ppc/translate/vmx-ops.inc.c +2 -0
@@ -223,6 +223,8 @@ GEN_VXFORM_300_EO(vctzb, 0x01, 0x18, 0x1C),GEN_VXFORM_300_EO (vctzh,0x01 ,0x18 ,0x1D ),GEN_VXFORM_300_EO (vctzw,0x01 ,0x18 ,0x1E ),GEN_VXFORM_300_EO (vctzd,0x01 ,0x18 ,0x1F ), +GEN_VXFORM_300_EO (vclzlsbb,0x01 ,0x18 ,0x0 ), +GEN_VXFORM_300_EO (vctzlsbb,0x01 ,0x18 ,0x1 ),GEN_VXFORM_300 (vpermr,0x1D ,0xFF ), #define GEN_VXFORM_NOA(name, opc2, opc3) \
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 6/6] target-ppc: add vclzlsbb/vctzlsbb instructions
Quoted 4 lines · Rajalakshmi Srinivasaraghavan
target-ppc/int_helper.c +4
-0+return count; +} +target_ulong helper_vctzlsbb (ppc_avr_t *r) +{
...
target-ppc/int_helper.c VCT(uxs, cvtsduw, u32) · line 913
Quoted 4 lines
target-ppc/int_helper.c +2
-0+return count; +}void helper_vmhaddshs (CPUPPCState *env,ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b,ppc_avr_t *c)
Watch your spacing between functions. Otherwise,
r~
Re: [Qemu-devel] [PATCH 6/6] target-ppc: add vclzlsbb/vctzlsbb instructions
Quoted 8 lines · Richard Henderson
Quoted 4 lines · Rajalakshmi Srinivasaraghavan
target-ppc/int_helper.c +4
-0+return count; +} +target_ulong helper_vctzlsbb (ppc_avr_t *r) +{...
Quoted 8 lines
target-ppc/int_helper.c VCT(uxs, cvtsduw, u32) · line 913
Quoted 4 lines
target-ppc/int_helper.c +2
-0+return count; +}void helper_vmhaddshs (CPUPPCState *env,ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b,ppc_avr_t *c)Watch your spacing between functions. Otherwise,
Reviewed-by Richard Henderson <[email protected]>
I've added a couple of extra line breaks and applied to ppc-for-2.8.
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 6/6] target-ppc: add vclzlsbb/vctzlsbb instructions
In reply to Rajalakshmi SrinivasaraghavanQuoted 7 lines · Rajalakshmi Srinivasaraghavan
The following vector instructions are added from ISA 3.0.
vclzlsbb - Vector Count Leading Zero Least-Significant Bits Byte vctzlsbb - Vector Count Trailing Zero Least-Significant Bits Byte
Signed-off-by: Rajalakshmi Srinivasaraghavan
<[email protected]>
This will do for now, but I think you could do better than the loop.
Something like:
tmp = vector & 0x0101010101010101; count = (clz(tmp) + 1) >> 3;
I think would do it (obviously more care would be needed with edge cases).
Quoted 104 lines
--- target-ppc/helper.h | 2 ++ target-ppc/int_helper.c | 28 ++++++++++++++++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 14 ++++++++++++++ target-ppc/translate/vmx-ops.inc.c | 2 ++ 4 files changed, 46 insertions(+), 0 deletions(-)target-ppc/helper.h +2
-0@@ -343,6 +343,8 @@ DEF_HELPER_2(vpopcntb, void, avr, avr) DEF_HELPER_2(vpopcnth, void, avr, avr) DEF_HELPER_2(vpopcntw, void, avr, avr) DEF_HELPER_2(vpopcntd, void, avr, avr) +DEF_HELPER_1(vclzlsbb, tl, avr) +DEF_HELPER_1(vctzlsbb, tl, avr) DEF_HELPER_3(vbpermd, void, avr, avr, avr) DEF_HELPER_3(vbpermq, void, avr, avr, avr)DEF_HELPER_2 (vgbbd, void, avr, avr)target-ppc/int_helper.c +28
-0@@ -881,6 +881,34 @@ VCT(uxs, cvtsduw, u32) VCT(sxs, cvtsdsw, s32)#undef VCT +target_ulong helper_vclzlsbb (ppc_avr_t *r) +{ +target_ulong count =0 ; +int i; + VECTOR_FOR_INORDER_I(i, u8) { +if (r->u8[i] &0x01 ) { +break ; + } + count++; + } +return count; +} +target_ulong helper_vctzlsbb (ppc_avr_t *r) +{ +target_ulong count =0 ; +int i; +#if defined(HOST_WORDS_BIGENDIAN ) +for (i =ARRAY_SIZE (r->u8) -1 ; i >=0 ; i--) { +#else +for (i =0 ; i <ARRAY_SIZE (r->u8); i++) { +#endif +if (r->u8[i] &0x01 ) { +break ; + } + count++; + } +return count; +}void helper_vmhaddshs (CPUPPCState *env,ppc_avr_t *r,ppc_avr_t *a,ppc_avr_t *b,ppc_avr_t *c) {target-ppc/translate/vmx-impl.inc.c +14
-0@@ -691,6 +691,18 @@ static void glue(gen_, name)(DisasContext *ctx) \tcg_temp_free_ptr (rd); \ } +#define GEN_VXFORM_NOA_3 (name, opc2, opc3, opc4) \ +static void glue(gen_, name)(DisasContext *ctx) \ + { \ + TCGv_ptr rb; \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + rb = gen_avr_ptr(rB(ctx->opcode)); \ + gen_helper_##name(cpu_gpr[rD(ctx->opcode)], rb); \ + tcg_temp_free_ptr(rb); \ + }GEN_VXFORM_NOA (vupkhsb,7 ,8 );GEN_VXFORM_NOA (vupkhsh,7 ,9 );GEN_VXFORM_NOA (vupkhsw,7 ,25 );@@ -905,6 +917,8 @@ GEN_VXFORM_NOA_2(vctzb, 1, 24, 28) GEN_VXFORM_NOA_2(vctzh, 1, 24, 29) GEN_VXFORM_NOA_2(vctzw, 1, 24, 30) GEN_VXFORM_NOA_2(vctzd, 1, 24, 31) +GEN_VXFORM_NOA_3(vclzlsbb, 1, 24, 0) +GEN_VXFORM_NOA_3(vctzlsbb, 1, 24, 1) GEN_VXFORM_NOA(vpopcntb, 1, 28) GEN_VXFORM_NOA(vpopcnth, 1, 29)GEN_VXFORM_NOA (vpopcntw,1 ,30 )target-ppc/translate/vmx-ops.inc.c +2
-0@@ -223,6 +223,8 @@ GEN_VXFORM_300_EO(vctzb, 0x01, 0x18, 0x1C),GEN_VXFORM_300_EO (vctzh,0x01 ,0x18 ,0x1D ),GEN_VXFORM_300_EO (vctzw,0x01 ,0x18 ,0x1E ),GEN_VXFORM_300_EO (vctzd,0x01 ,0x18 ,0x1F ), +GEN_VXFORM_300_EO (vclzlsbb,0x01 ,0x18 ,0x0 ), +GEN_VXFORM_300_EO (vctzlsbb,0x01 ,0x18 ,0x1 ),GEN_VXFORM_300 (vpermr,0x1D ,0xFF ), #define GEN_VXFORM_NOA(name, opc2, opc3) \
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