POWER9 TCG enablements - part6
cover POWER9 TCG enablements - part6
This series contains 11 new instructions for POWER9 ISA3.0
Vector Extend Sign
Vector Integer Negate
Vector Byte-Reverse
Patches:
01:
vextsb2w: Vector Extend Sign Byte To Word
vextsh2w: Vector Extend Sign Halfword To Word
vextsb2d: Vector Extend Sign Byte To Doubleword
vextsh2d: Vector Extend Sign Halfword To Doubleword
vextsw2d: Vector Extend Sign Word To Doubleword
02:
vnegw: Vector Negate Word
vnegd: Vector Negate Doubleword
03:
xxbrh: VSX Vector Byte-Reverse Halfword
xxbrw: VSX Vector Byte-Reverse Word
xxbrd: VSX Vector Byte-Reverse Doubleword
xxbrq: VSX Vector Byte-Reverse Quadword
Changelog:
* Added temporary in xxbrq
* Use negate directly in place for computing 2's compliment
* Use int8_t instead for char
* Dropped "VSX Scalar Compare" as fpu_helper needs change with regard to exception flag handling
Nikunj A Dadhania (3):
target-ppc: implement vexts[bh]2w and vexts[bhw]2d
target-ppc: implement vnegw/d instructions
target-ppc: implement xxbr[qdwh] instruction
target-ppc/helper.h | 7 ++++ target-ppc/int_helper.c | 27 +++++++++++++ target-ppc/translate.c | 32 +++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 7 ++++ target-ppc/translate/vmx-ops.inc.c | 7 ++++ target-ppc/translate/vsx-impl.inc.c | 77 +++++++++++++++++++++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 8 ++++ 7 files changed, 165 insertions(+)
Signature · 1 line
2.7.4
PATCH 1/3 target-ppc: implement vexts[bh]2w and vexts[bhw]2d
Vector Extend Sign Instructions:
vextsb2w: Vector Extend Sign Byte To Word
vextsh2w: Vector Extend Sign Halfword To Word
vextsb2d: Vector Extend Sign Byte To Doubleword
vextsh2d: Vector Extend Sign Halfword To Doubleword
vextsw2d: Vector Extend Sign Word To Doubleword
--- target-ppc/helper.h | 5 +++++ target-ppc/int_helper.c | 15 +++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 5 +++++ target-ppc/translate/vmx-ops.inc.c | 5 +++++ 4 files changed, 30 insertions(+)
target-ppc/helper.h +5 -0
@@ -267,6 +267,11 @@ DEF_HELPER_3(vinsertb, void, avr, avr, i32) DEF_HELPER_3(vinserth, void, avr, avr, i32) DEF_HELPER_3(vinsertw, void, avr, avr, i32) DEF_HELPER_3(vinsertd, void, avr, avr, i32) +DEF_HELPER_2(vextsb2w, void, avr, avr) +DEF_HELPER_2(vextsh2w, void, avr, avr) +DEF_HELPER_2(vextsb2d, void, avr, avr) +DEF_HELPER_2(vextsh2d, void, avr, avr) +DEF_HELPER_2(vextsw2d, void, avr, avr) DEF_HELPER_2(vupkhpx, void, avr, avr) DEF_HELPER_2(vupklpx, void, avr, avr)DEF_HELPER_2 (vupkhsb, void, avr, avr)
target-ppc/int_helper.c +15 -0
@@ -1934,6 +1934,21 @@ VEXTRACT(uw, u32) VEXTRACT(d, u64)#undef VEXTRACT +#define VEXT_SIGNED (name, element, mask, cast, recast) \ +void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \ +{ \ + int i; \ + VECTOR_FOR_INORDER_I(i, element) { \ + r->element[i] = (recast)((cast)(b->element[i] & mask)); \ + } \ +} +VEXT_SIGNED(vextsb2w, s32, UINT8_MAX, int8_t, int32_t) +VEXT_SIGNED(vextsb2d, s64, UINT8_MAX, int8_t, int64_t) +VEXT_SIGNED(vextsh2w, s32, UINT16_MAX, int16_t, int32_t) +VEXT_SIGNED(vextsh2d, s64, UINT16_MAX, int16_t, int64_t) +VEXT_SIGNED(vextsw2d, s64, UINT32_MAX, int32_t, int64_t) +#undef VEXT_SIGNED +#define VSPLTI (suffix, element, splat_type) \ void helper_vspltis##suffix(ppc_avr_t *r, uint32_t splat) \ { \
target-ppc/translate/vmx-impl.inc.c +5 -0
@@ -815,6 +815,11 @@ GEN_VXFORM_NOA(vclzb, 1, 28) GEN_VXFORM_NOA(vclzh, 1, 29) GEN_VXFORM_NOA(vclzw, 1, 30) GEN_VXFORM_NOA(vclzd, 1, 31) +GEN_VXFORM_NOA_2(vextsb2w, 1, 24, 16) +GEN_VXFORM_NOA_2(vextsh2w, 1, 24, 17) +GEN_VXFORM_NOA_2(vextsb2d, 1, 24, 24) +GEN_VXFORM_NOA_2(vextsh2d, 1, 24, 25) +GEN_VXFORM_NOA_2(vextsw2d, 1, 24, 26) GEN_VXFORM_NOA_2(vctzb, 1, 24, 28) GEN_VXFORM_NOA_2(vctzh, 1, 24, 29)GEN_VXFORM_NOA_2 (vctzw,1 ,24 ,30 )
target-ppc/translate/vmx-ops.inc.c +5 -0
@@ -215,6 +215,11 @@ GEN_VXFORM_DUAL_INV(vspltish, vinserth, 6, 13, 0x00000000, 0x100000,GEN_VXFORM_DUAL_INV (vspltisw, vinsertw,6 ,14 ,0x00000000 ,0x100000 ,PPC_ALTIVEC ),GEN_VXFORM_300_EXT (vinsertd,6 ,15 ,0x100000 ), +GEN_VXFORM_300_EO (vextsb2w,0x01 ,0x18 ,0x10 ), +GEN_VXFORM_300_EO (vextsh2w,0x01 ,0x18 ,0x11 ), +GEN_VXFORM_300_EO (vextsb2d,0x01 ,0x18 ,0x18 ), +GEN_VXFORM_300_EO (vextsh2d,0x01 ,0x18 ,0x19 ), +GEN_VXFORM_300_EO (vextsw2d,0x01 ,0x18 ,0x1A ),GEN_VXFORM_300_EO (vctzb,0x01 ,0x18 ,0x1C ),GEN_VXFORM_300_EO (vctzh,0x01 ,0x18 ,0x1D ), GEN_VXFORM_300_EO(vctzw, 0x01, 0x18, 0x1E),
Signature · 1 line
2.7.4
PATCH 3/3 target-ppc: implement xxbr[qdwh] instruction
In reply to Nikunj A DadhaniaAdd required helpers (GEN_XX2FORM_EO) for supporting this instruction.
xxbrh: VSX Vector Byte-Reverse Halfword
xxbrw: VSX Vector Byte-Reverse Word
xxbrd: VSX Vector Byte-Reverse Doubleword
xxbrq: VSX Vector Byte-Reverse Quadword
--- target-ppc/translate.c | 32 +++++++++++++++ target-ppc/translate/vsx-impl.inc.c | 77 +++++++++++++++++++++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 8 ++++ 3 files changed, 117 insertions(+)
target-ppc/translate.c +32 -0
@@ -376,6 +376,9 @@ GEN_OPCODE2(name, onam, opc1, opc2, opc3, inval, type, type2)#define GEN_HANDLER_E_2 (name, opc1, opc2, opc3, opc4, inval, type, type2) \ GEN_OPCODE3(name, opc1, opc2, opc3, opc4, inval, type, type2) +#define GEN_HANDLER2_E_2 (name, onam, opc1, opc2, opc3, opc4, inval, typ, typ2) \ +GEN_OPCODE4(name, onam, opc1, opc2, opc3, opc4, inval, typ, typ2) + typedef struct opcode_t { unsigned char opc1, opc2, opc3, opc4; #if HOST_LONG_BITS == 64 /* Explicitly align to 64 bits */
@@ -662,6 +665,21 @@ EXTRACT_HELPER(IMM8, 11, 8); }, \ .oname = stringify(name), \ } +#define GEN_OPCODE4 (name, onam, op1, op2, op3, op4, invl, _typ, _typ2) \ +{ \ + .opc1 = op1, \ + .opc2 = op2, \ + .opc3 = op3, \ + .opc4 = op4, \ + .handler = { \ + .inval1 = invl, \ + .type = _typ, \ + .type2 = _typ2, \ + .handler = &gen_##name, \ + .oname = onam, \ + }, \ + .oname = onam, \ +}#else #define GEN_OPCODE (name, op1, op2, op3, invl, _typ, _typ2) \ { \
@@ -720,6 +738,20 @@ EXTRACT_HELPER(IMM8, 11, 8); }, \ .oname = stringify(name), \ } +#define GEN_OPCODE4 (name, onam, op1, op2, op3, op4, invl, _typ, _typ2) \ +{ \ + .opc1 = op1, \ + .opc2 = op2, \ + .opc3 = op3, \ + .opc4 = op4, \ + .handler = { \ + .inval1 = invl, \ + .type = _typ, \ + .type2 = _typ2, \ + .handler = &gen_##name, \ + }, \ + .oname = onam, \ +}#endif /* SPR load/store helpers */
target-ppc/translate/vsx-impl.inc.c +77 -0
89 lines not on this page · raw message
target-ppc/translate/vsx-ops.inc.c +8 -0
@@ -39,6 +39,10 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2) GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2) +#define GEN_XX2FORM_EO (name, opc2, opc3, opc4, fl2) \ +GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 0, opc3, opc4, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 1, opc3, opc4, 0, PPC_NONE, fl2) +#define GEN_XX3FORM (name, opc2, opc3, fl2) \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2), \
@@ -222,6 +226,10 @@ GEN_XX2FORM(xvrspic, 0x16, 0x0A, PPC2_VSX),GEN_XX2FORM (xvrspim,0x12 ,0x0B ,PPC2_VSX ),GEN_XX2FORM (xvrspip,0x12 ,0x0A ,PPC2_VSX ),GEN_XX2FORM (xvrspiz,0x12 ,0x09 ,PPC2_VSX ), +GEN_XX2FORM_EO (xxbrh,0x16 ,0x1D ,0x07 ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xxbrw,0x16 ,0x1D ,0x0F ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xxbrd,0x16 ,0x1D ,0x17 ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xxbrq,0x16 ,0x1D ,0x1F ,PPC2_ISA300 ), #define VSX_LOGICAL(name, opc2, opc3, fl2) \GEN_XX3FORM (name, opc2, opc3, fl2)
Signature · 1 line
2.7.4
PATCH 2/3 target-ppc: implement vnegw/d instructions
In reply to Nikunj A DadhaniaVector Integer Negate Instructions:
vnegw: Vector Negate Word
vnegd: Vector Negate Doubleword
--- target-ppc/helper.h | 2 ++ target-ppc/int_helper.c | 12 ++++++++++++ target-ppc/translate/vmx-impl.inc.c | 2 ++ target-ppc/translate/vmx-ops.inc.c | 2 ++ 4 files changed, 18 insertions(+)
target-ppc/helper.h +2 -0
@@ -272,6 +272,8 @@ DEF_HELPER_2(vextsh2w, void, avr, avr) DEF_HELPER_2(vextsb2d, void, avr, avr) DEF_HELPER_2(vextsh2d, void, avr, avr) DEF_HELPER_2(vextsw2d, void, avr, avr) +DEF_HELPER_2(vnegw, void, avr, avr) +DEF_HELPER_2(vnegd, void, avr, avr) DEF_HELPER_2(vupkhpx, void, avr, avr) DEF_HELPER_2(vupklpx, void, avr, avr)DEF_HELPER_2 (vupkhsb, void, avr, avr)
target-ppc/int_helper.c +12 -0
@@ -1949,6 +1949,18 @@ VEXT_SIGNED(vextsh2d, s64, UINT16_MAX, int16_t, int64_t) VEXT_SIGNED(vextsw2d, s64, UINT32_MAX, int32_t, int64_t)#undef VEXT_SIGNED +#define VNEG (name, element, mask) \ +void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \ +{ \ + int i; \ + VECTOR_FOR_INORDER_I(i, element) { \ + r->element[i] = -b->element[i]; \ + } \ +} +VNEG(vnegw, s32, UINT32_MAX) +VNEG(vnegd, s64, UINT64_MAX) +#undef VNEG +#define VSPLTI (suffix, element, splat_type) \ void helper_vspltis##suffix(ppc_avr_t *r, uint32_t splat) \ { \
target-ppc/translate/vmx-impl.inc.c +2 -0
@@ -815,6 +815,8 @@ GEN_VXFORM_NOA(vclzb, 1, 28) GEN_VXFORM_NOA(vclzh, 1, 29) GEN_VXFORM_NOA(vclzw, 1, 30) GEN_VXFORM_NOA(vclzd, 1, 31) +GEN_VXFORM_NOA_2(vnegw, 1, 24, 6) +GEN_VXFORM_NOA_2(vnegd, 1, 24, 7) GEN_VXFORM_NOA_2(vextsb2w, 1, 24, 16) GEN_VXFORM_NOA_2(vextsh2w, 1, 24, 17)GEN_VXFORM_NOA_2 (vextsb2d,1 ,24 ,24 )
target-ppc/translate/vmx-ops.inc.c +2 -0
@@ -215,6 +215,8 @@ GEN_VXFORM_DUAL_INV(vspltish, vinserth, 6, 13, 0x00000000, 0x100000,GEN_VXFORM_DUAL_INV (vspltisw, vinsertw,6 ,14 ,0x00000000 ,0x100000 ,PPC_ALTIVEC ),GEN_VXFORM_300_EXT (vinsertd,6 ,15 ,0x100000 ), +GEN_VXFORM_300_EO (vnegw,0x01 ,0x18 ,0x06 ), +GEN_VXFORM_300_EO (vnegd,0x01 ,0x18 ,0x07 ),GEN_VXFORM_300_EO (vextsb2w,0x01 ,0x18 ,0x10 ),GEN_VXFORM_300_EO (vextsh2w,0x01 ,0x18 ,0x11 ), GEN_VXFORM_300_EO(vextsb2d, 0x01, 0x18, 0x18),
Signature · 1 line
2.7.4
Your series seems to have some coding style problems. See output below for more information:
Hi,
Your series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH v1 0/3] POWER9 TCG enablements - part6
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git show --no-patch --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
167305d target-ppc: implement xxbr[qdwh] instruction f648df6 target-ppc: implement vnegw/d instructions fc481f0 target-ppc: implement vexts[bh]2w and vexts[bhw]2d
=== OUTPUT BEGIN ===
Checking PATCH 1/3: target-ppc: implement vexts[bh]2w and vexts[bhw]2d... Checking PATCH 2/3: target-ppc: implement vnegw/d instructions... Checking PATCH 3/3: target-ppc: implement xxbr[qdwh] instruction...
ERROR: Macros with complex values should be enclosed in parenthesis #176: FILE: target-ppc/translate/vsx-ops.inc.c:42:
+#define GEN_XX2FORM_EO(name, opc2, opc3, opc4, fl2) \
+GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 0, opc3, opc4, 0, PPC_NONE, fl2), \
+GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 1, opc3, opc4, 0, PPC_NONE, fl2)
total: 1 errors, 0 warnings, 159 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
David Gibson
AppliedRe: [Qemu-devel] [PATCH v1 1/3] target-ppc: implement vexts[bh]2w and vexts[bhw]2d
In reply to Nikunj A DadhaniaQuoted 9 lines · Nikunj A Dadhania
Vector Extend Sign Instructions:
vextsb2w: Vector Extend Sign Byte To Word
vextsh2w: Vector Extend Sign Halfword To Word
vextsb2d: Vector Extend Sign Byte To Doubleword
vextsh2d: Vector Extend Sign Halfword To Doubleword
vextsw2d: Vector Extend Sign Word To DoublewordSigned-off-by Nikunj A Dadhania <[email protected]>
Applied to ppc-for-2.8, thanks.
Quoted 81 lines
--- target-ppc/helper.h | 5 +++++ target-ppc/int_helper.c | 15 +++++++++++++++ target-ppc/translate/vmx-impl.inc.c | 5 +++++ target-ppc/translate/vmx-ops.inc.c | 5 +++++ 4 files changed, 30 insertions(+)target-ppc/helper.h +5
-0@@ -267,6 +267,11 @@ DEF_HELPER_3(vinsertb, void, avr, avr, i32) DEF_HELPER_3(vinserth, void, avr, avr, i32) DEF_HELPER_3(vinsertw, void, avr, avr, i32) DEF_HELPER_3(vinsertd, void, avr, avr, i32) +DEF_HELPER_2(vextsb2w, void, avr, avr) +DEF_HELPER_2(vextsh2w, void, avr, avr) +DEF_HELPER_2(vextsb2d, void, avr, avr) +DEF_HELPER_2(vextsh2d, void, avr, avr) +DEF_HELPER_2(vextsw2d, void, avr, avr) DEF_HELPER_2(vupkhpx, void, avr, avr) DEF_HELPER_2(vupklpx, void, avr, avr)DEF_HELPER_2 (vupkhsb, void, avr, avr)target-ppc/int_helper.c +15
-0@@ -1934,6 +1934,21 @@ VEXTRACT(uw, u32) VEXTRACT(d, u64)#undef VEXTRACT +#define VEXT_SIGNED (name, element, mask, cast, recast) \ +void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \ +{ \ + int i; \ + VECTOR_FOR_INORDER_I(i, element) { \ + r->element[i] = (recast)((cast)(b->element[i] & mask)); \ + } \ +} +VEXT_SIGNED(vextsb2w, s32, UINT8_MAX, int8_t, int32_t) +VEXT_SIGNED(vextsb2d, s64, UINT8_MAX, int8_t, int64_t) +VEXT_SIGNED(vextsh2w, s32, UINT16_MAX, int16_t, int32_t) +VEXT_SIGNED(vextsh2d, s64, UINT16_MAX, int16_t, int64_t) +VEXT_SIGNED(vextsw2d, s64, UINT32_MAX, int32_t, int64_t) +#undef VEXT_SIGNED +#define VSPLTI (suffix, element, splat_type) \ void helper_vspltis##suffix(ppc_avr_t *r, uint32_t splat) \ { \target-ppc/translate/vmx-impl.inc.c +5
-0@@ -815,6 +815,11 @@ GEN_VXFORM_NOA(vclzb, 1, 28) GEN_VXFORM_NOA(vclzh, 1, 29) GEN_VXFORM_NOA(vclzw, 1, 30) GEN_VXFORM_NOA(vclzd, 1, 31) +GEN_VXFORM_NOA_2(vextsb2w, 1, 24, 16) +GEN_VXFORM_NOA_2(vextsh2w, 1, 24, 17) +GEN_VXFORM_NOA_2(vextsb2d, 1, 24, 24) +GEN_VXFORM_NOA_2(vextsh2d, 1, 24, 25) +GEN_VXFORM_NOA_2(vextsw2d, 1, 24, 26) GEN_VXFORM_NOA_2(vctzb, 1, 24, 28) GEN_VXFORM_NOA_2(vctzh, 1, 24, 29)GEN_VXFORM_NOA_2 (vctzw,1 ,24 ,30 )target-ppc/translate/vmx-ops.inc.c +5
-0@@ -215,6 +215,11 @@ GEN_VXFORM_DUAL_INV(vspltish, vinserth, 6, 13, 0x00000000, 0x100000,GEN_VXFORM_DUAL_INV (vspltisw, vinsertw,6 ,14 ,0x00000000 ,0x100000 ,PPC_ALTIVEC ),GEN_VXFORM_300_EXT (vinsertd,6 ,15 ,0x100000 ), +GEN_VXFORM_300_EO (vextsb2w,0x01 ,0x18 ,0x10 ), +GEN_VXFORM_300_EO (vextsh2w,0x01 ,0x18 ,0x11 ), +GEN_VXFORM_300_EO (vextsb2d,0x01 ,0x18 ,0x18 ), +GEN_VXFORM_300_EO (vextsh2d,0x01 ,0x18 ,0x19 ), +GEN_VXFORM_300_EO (vextsw2d,0x01 ,0x18 ,0x1A ),GEN_VXFORM_300_EO (vctzb,0x01 ,0x18 ,0x1C ),GEN_VXFORM_300_EO (vctzh,0x01 ,0x18 ,0x1D ), GEN_VXFORM_300_EO(vctzw, 0x01, 0x18, 0x1E),
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 v1 2/3] target-ppc: implement vnegw/d instructions
In reply to Nikunj A DadhaniaQuoted 31 lines · Nikunj A Dadhania
Vector Integer Negate Instructions:
vnegw: Vector Negate Word
vnegd: Vector Negate DoublewordSigned-off-by Nikunj A Dadhania <[email protected]>--- target-ppc/helper.h | 2 ++ target-ppc/int_helper.c | 12 ++++++++++++ target-ppc/translate/vmx-impl.inc.c | 2 ++ target-ppc/translate/vmx-ops.inc.c | 2 ++ 4 files changed, 18 insertions(+)target-ppc/helper.h +2
-0@@ -272,6 +272,8 @@ DEF_HELPER_2(vextsh2w, void, avr, avr) DEF_HELPER_2(vextsb2d, void, avr, avr) DEF_HELPER_2(vextsh2d, void, avr, avr) DEF_HELPER_2(vextsw2d, void, avr, avr) +DEF_HELPER_2(vnegw, void, avr, avr) +DEF_HELPER_2(vnegd, void, avr, avr) DEF_HELPER_2(vupkhpx, void, avr, avr) DEF_HELPER_2(vupklpx, void, avr, avr)DEF_HELPER_2 (vupkhsb, void, avr, avr)target-ppc/int_helper.c +0
-0
target-ppc/int_helper.c VEXT_SIGNED(vextsh2d, s64, UINT16_MAX, int16_t, int64_t) · line 1952
Quoted 4 lines
target-ppc/int_helper.c +1
-0@@ -1949,6 +1949,18 @@ VEXT_SIGNED(vextsh2d, s64, UINT16_MAX, int16_t, int64_t) VEXT_SIGNED(vextsw2d, s64, UINT32_MAX, int32_t, int64_t)#undef VEXT_SIGNED +#define VNEG (name, element, mask) \
The mask parameter appears to be unused.
Quoted 40 lines
target-ppc/int_helper.c +11
-0+void helper_##name(ppc_avr_t *r, ppc_avr_t *b) \ +{ \ + int i; \ + VECTOR_FOR_INORDER_I(i, element) { \ + r->element[i] = -b->element[i]; \ + } \ +} +VNEG(vnegw, s32, UINT32_MAX) +VNEG(vnegd, s64, UINT64_MAX) +#undef VNEG +#define VSPLTI (suffix, element, splat_type) \ void helper_vspltis##suffix(ppc_avr_t *r, uint32_t splat) \ { \target-ppc/translate/vmx-impl.inc.c +2
-0@@ -815,6 +815,8 @@ GEN_VXFORM_NOA(vclzb, 1, 28) GEN_VXFORM_NOA(vclzh, 1, 29) GEN_VXFORM_NOA(vclzw, 1, 30) GEN_VXFORM_NOA(vclzd, 1, 31) +GEN_VXFORM_NOA_2(vnegw, 1, 24, 6) +GEN_VXFORM_NOA_2(vnegd, 1, 24, 7) GEN_VXFORM_NOA_2(vextsb2w, 1, 24, 16) GEN_VXFORM_NOA_2(vextsh2w, 1, 24, 17)GEN_VXFORM_NOA_2 (vextsb2d,1 ,24 ,24 )target-ppc/translate/vmx-ops.inc.c +2
-0@@ -215,6 +215,8 @@ GEN_VXFORM_DUAL_INV(vspltish, vinserth, 6, 13, 0x00000000, 0x100000,GEN_VXFORM_DUAL_INV (vspltisw, vinsertw,6 ,14 ,0x00000000 ,0x100000 ,PPC_ALTIVEC ),GEN_VXFORM_300_EXT (vinsertd,6 ,15 ,0x100000 ), +GEN_VXFORM_300_EO (vnegw,0x01 ,0x18 ,0x06 ), +GEN_VXFORM_300_EO (vnegd,0x01 ,0x18 ,0x07 ),GEN_VXFORM_300_EO (vextsb2w,0x01 ,0x18 ,0x10 ),GEN_VXFORM_300_EO (vextsh2w,0x01 ,0x18 ,0x11 ), GEN_VXFORM_300_EO(vextsb2d, 0x01, 0x18, 0x18),
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 v1 3/3] target-ppc: implement xxbr[qdwh] instruction
In reply to Nikunj A DadhaniaQuoted 85 lines · Nikunj A Dadhania
Add required helpers (
GEN_XX2FORM_EO) for supporting this instruction.xxbrh: VSX Vector Byte-Reverse Halfword
xxbrw: VSX Vector Byte-Reverse Word
xxbrd: VSX Vector Byte-Reverse Doubleword
xxbrq: VSX Vector Byte-Reverse QuadwordSigned-off-by Nikunj A Dadhania <[email protected]>--- target-ppc/translate.c | 32 +++++++++++++++ target-ppc/translate/vsx-impl.inc.c | 77 +++++++++++++++++++++++++++++++++++++ target-ppc/translate/vsx-ops.inc.c | 8 ++++ 3 files changed, 117 insertions(+)target-ppc/translate.c +32
-0@@ -376,6 +376,9 @@ GEN_OPCODE2(name, onam, opc1, opc2, opc3, inval, type, type2)#define GEN_HANDLER_E_2 (name, opc1, opc2, opc3, opc4, inval, type, type2) \ GEN_OPCODE3(name, opc1, opc2, opc3, opc4, inval, type, type2) +#define GEN_HANDLER2_E_2 (name, onam, opc1, opc2, opc3, opc4, inval, typ, typ2) \ +GEN_OPCODE4(name, onam, opc1, opc2, opc3, opc4, inval, typ, typ2) + typedef struct opcode_t { unsigned char opc1, opc2, opc3, opc4; #if HOST_LONG_BITS == 64 /* Explicitly align to 64 bits */@@ -662,6 +665,21 @@ EXTRACT_HELPER(IMM8, 11, 8); }, \ .oname = stringify(name), \ } +#define GEN_OPCODE4 (name, onam, op1, op2, op3, op4, invl, _typ, _typ2) \ +{ \ + .opc1 = op1, \ + .opc2 = op2, \ + .opc3 = op3, \ + .opc4 = op4, \ + .handler = { \ + .inval1 = invl, \ + .type = _typ, \ + .type2 = _typ2, \ + .handler = &gen_##name, \ + .oname = onam, \ + }, \ + .oname = onam, \ +}#else #define GEN_OPCODE (name, op1, op2, op3, invl, _typ, _typ2) \ { \@@ -720,6 +738,20 @@ EXTRACT_HELPER(IMM8, 11, 8); }, \ .oname = stringify(name), \ } +#define GEN_OPCODE4 (name, onam, op1, op2, op3, op4, invl, _typ, _typ2) \ +{ \ + .opc1 = op1, \ + .opc2 = op2, \ + .opc3 = op3, \ + .opc4 = op4, \ + .handler = { \ + .inval1 = invl, \ + .type = _typ, \ + .type2 = _typ2, \ + .handler = &gen_##name, \ + }, \ + .oname = onam, \ +}#endif /* SPR load/store helpers */ target-ppc/translate/vsx-impl.inc.c +6
-0@@ -132,6 +132,22 @@ static void gen_bswap16x8(TCGv_i64 outh, TCGv_i64 outl,tcg_temp_free_i64 (mask); } +static void gen_bswap32x4 (TCGv_i64 outh,TCGv_i64 outl, +TCGv_i64 inh,TCGv_i64 inl) +{ +TCGv_i64 hi =tcg_temp_new_i64 (); +TCGv_i64 lo =tcg_temp_new_i64 (); +
target-ppc/translate/vsx-impl.inc.c static void gen_bswap16x8(TCGv_i64 outh, TCGv_i64 outl, · line 150
Quoted 10 lines
target-ppc/translate/vsx-impl.inc.c +10
-0+tcg_gen_bswap64_i64 (hi, inh); +tcg_gen_bswap64_i64 (lo, inl); +tcg_gen_shri_i64 (outh, hi,32 ); +tcg_gen_deposit_i64 (outh, outh, hi,32 ,32 ); +tcg_gen_shri_i64 (outl, lo,32 ); +tcg_gen_deposit_i64 (outl, outl, lo,32 ,32 ); + +tcg_temp_free_i64 (hi); +tcg_temp_free_i64 (lo); +}
Is there actually any advantage to having this 128-bit operation working on two 64-bit "register"s, as opposed to having a bswap32x2 that operates on a single 64-bit register amd calling it twice?
Quoted 24 lines
target-ppc/translate/vsx-impl.inc.c +17
-0static void gen_lxvh8x (DisasContext *ctx) {TCGv EA ;@@ -717,6 +733,67 @@ GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspip, 0x12, 0x0A, 0, PPC2_VSX) GEN_VSX_HELPER_2(xvrspiz, 0x12, 0x09, 0, PPC2_VSX) +static void gen_xxbrd (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_bswap64_i64 (xth, xbh); +tcg_gen_bswap64_i64 (xtl, xbl); +} + +static void gen_xxbrh (DisasContext *ctx) +{
target-ppc/translate/vsx-impl.inc.c GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) · line 762
Quoted 10 lines
target-ppc/translate/vsx-impl.inc.c +10
-0+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 ; + } +gen_bswap16x8 (xth, xtl, xbh, xbl);
Likewise for the 16x8 version, I guess, although that would mean changing the existing users.
Quoted 7 lines
target-ppc/translate/vsx-impl.inc.c +7
-0+} + +static void gen_xxbrq (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));
target-ppc/translate/vsx-impl.inc.c GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) · line 779
Quoted 10 lines
target-ppc/translate/vsx-impl.inc.c +10
-0+TCGv_i64 xbl =cpu_vsrl (xB (ctx->opcode)); +TCGv_i64 t0 =tcg_temp_new_i64 (); + +if (unlikely (!ctx->vsx_enabled)) { +gen_exception (ctx,POWERPC_EXCP_VSXU ); +return ; + } +tcg_gen_bswap64_i64 (t0, xbl); +tcg_gen_bswap64_i64 (xtl, xbh); +tcg_gen_bswap64_i64 (xth, t0);
This looks wrong. You swap xbl as you move it to t0, then swap it again as you put it back into xth. So it looks like you'll translate
0011223344556677 8899AABBCCDDEEFF
to
8899AABBCCDDEEFF 7766554433221100
whereas it should become
FFEEDDCCBBAA9977 7766554433221100Quoted 46 lines
target-ppc/translate/vsx-impl.inc.c +17
-0+tcg_temp_free_i64 (t0); +} + +static void gen_xxbrw (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 ; + } +gen_bswap32x4 (xth, xtl, xbh, xbl); +} +#define VSX_LOGICAL (name, tcg_op) \ static void glue(gen_, name)(DisasContext * ctx) \ { \target-ppc/translate/vsx-ops.inc.c +8
-0@@ -39,6 +39,10 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2) GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2) +#define GEN_XX2FORM_EO (name, opc2, opc3, opc4, fl2) \ +GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 0, opc3, opc4, 0, PPC_NONE, fl2), \ +GEN_HANDLER2_E_2(name, #name, 0x3C, opc2 | 1, opc3, opc4, 0, PPC_NONE, fl2) +#define GEN_XX3FORM (name, opc2, opc3, fl2) \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 0, PPC_NONE, fl2), \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2), \@@ -222,6 +226,10 @@ GEN_XX2FORM(xvrspic, 0x16, 0x0A, PPC2_VSX),GEN_XX2FORM (xvrspim,0x12 ,0x0B ,PPC2_VSX ),GEN_XX2FORM (xvrspip,0x12 ,0x0A ,PPC2_VSX ),GEN_XX2FORM (xvrspiz,0x12 ,0x09 ,PPC2_VSX ), +GEN_XX2FORM_EO (xxbrh,0x16 ,0x1D ,0x07 ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xxbrw,0x16 ,0x1D ,0x0F ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xxbrd,0x16 ,0x1D ,0x17 ,PPC2_ISA300 ), +GEN_XX2FORM_EO (xxbrq,0x16 ,0x1D ,0x1F ,PPC2_ISA300 ), #define VSX_LOGICAL(name, opc2, opc3, fl2) \GEN_XX3FORM (name, opc2, opc3, fl2)
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 v1 3/3] target-ppc: implement xxbr[qdwh] instruction
Quoted 12 lines · David Gibson
Quoted 12 lines
target-ppc/translate/vsx-impl.inc.c +12
-0+static void gen_bswap32x4 (TCGv_i64 outh,TCGv_i64 outl, +TCGv_i64 inh,TCGv_i64 inl) +{ +TCGv_i64 hi =tcg_temp_new_i64 (); +TCGv_i64 lo =tcg_temp_new_i64 (); + +tcg_gen_bswap64_i64 (hi, inh); +tcg_gen_bswap64_i64 (lo, inl); +tcg_gen_shri_i64 (outh, hi,32 ); +tcg_gen_deposit_i64 (outh, outh, hi,32 ,32 ); +tcg_gen_shri_i64 (outl, lo,32 ); +tcg_gen_deposit_i64 (outl, outl, lo,32 ,32 );
Quoted 8 lines
target-ppc/translate/vsx-impl.inc.c static void gen_bswap16x8(TCGv_i64 outh, TCGv_i64 outl, · line 150
Quoted 4 lines
target-ppc/translate/vsx-impl.inc.c +4
-0+ +tcg_temp_free_i64 (hi); +tcg_temp_free_i64 (lo); +}Is there actually any advantage to having this 128-bit operation working on two 64-bit "register"s, as opposed to having a bswap32x2 that operates on a single 64-bit register amd calling it twice?
For this one, no particular advantage.
Quoted 4 lines
Quoted 1 line
+
gen_bswap16x8(xth, xtl, xbh, xbl);Likewise for the 16x8 version, I guess, although that would mean changing the existing users.
For this one, we have to build a 64-bit constant, 0x00ff00ff00ff00ff. On some hosts that's up to 6 insns. Being about to reuse that for both swaps is useful.
Quoted 11 lines
target-ppc/translate/vsx-impl.inc.c GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) · line 779
Quoted 3 lines
target-ppc/translate/vsx-impl.inc.c +3
-0+tcg_gen_bswap64_i64 (t0, xbl); +tcg_gen_bswap64_i64 (xtl, xbh); +tcg_gen_bswap64_i64 (xth, t0);This looks wrong. You swap xbl as you move it to t0, then swap it again as you put it back into xth. So it looks like you'll translate
0011223344556677 8899AABBCCDDEEFF to 8899AABBCCDDEEFF 7766554433221100 whereas it should become FFEEDDCCBBAA9977 7766554433221100
Indeed, the third line should be a move, not a swap.
r~
Re: [Qemu-devel] [PATCH v1 3/3] target-ppc: implement xxbr[qdwh] instruction
Quoted 24 lines · Richard Henderson
Quoted 12 lines · David Gibson
Quoted 12 lines
target-ppc/translate/vsx-impl.inc.c +12
-0+static void gen_bswap32x4 (TCGv_i64 outh,TCGv_i64 outl, +TCGv_i64 inh,TCGv_i64 inl) +{ +TCGv_i64 hi =tcg_temp_new_i64 (); +TCGv_i64 lo =tcg_temp_new_i64 (); + +tcg_gen_bswap64_i64 (hi, inh); +tcg_gen_bswap64_i64 (lo, inl); +tcg_gen_shri_i64 (outh, hi,32 ); +tcg_gen_deposit_i64 (outh, outh, hi,32 ,32 ); +tcg_gen_shri_i64 (outl, lo,32 ); +tcg_gen_deposit_i64 (outl, outl, lo,32 ,32 );Quoted 8 lines
target-ppc/translate/vsx-impl.inc.c static void gen_bswap16x8(TCGv_i64 outh, TCGv_i64 outl, · line 150
Quoted 4 lines
target-ppc/translate/vsx-impl.inc.c +4
-0+ +tcg_temp_free_i64 (hi); +tcg_temp_free_i64 (lo); +}Is there actually any advantage to having this 128-bit operation working on two 64-bit "register"s, as opposed to having a bswap32x2 that operates on a single 64-bit register amd calling it twice?
For this one, no particular advantage.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
+
gen_bswap16x8(xth, xtl, xbh, xbl);Likewise for the 16x8 version, I guess, although that would mean changing the existing users.
For this one, we have to build a 64-bit constant,
0x00ff00ff00ff00ff. On some hosts that's up to 6 insns. Being about to reuse that for both swaps is useful.
Ah, good point.
Quoted 17 lines
Quoted 11 lines
target-ppc/translate/vsx-impl.inc.c GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) · line 779
Quoted 3 lines
target-ppc/translate/vsx-impl.inc.c +3
-0+tcg_gen_bswap64_i64 (t0, xbl); +tcg_gen_bswap64_i64 (xtl, xbh); +tcg_gen_bswap64_i64 (xth, t0);This looks wrong. You swap xbl as you move it to t0, then swap it again as you put it back into xth. So it looks like you'll translate
0011223344556677 8899AABBCCDDEEFF to 8899AABBCCDDEEFF 7766554433221100 whereas it should become FFEEDDCCBBAA9977 7766554433221100Indeed, the third line should be a move, not a swap.
r~
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 v1 2/3] target-ppc: implement vnegw/d instructions
In reply to David GibsonQuoted 36 lines · David Gibson
[ Unknown signature status ]
Quoted 34 lines · Nikunj A Dadhania
Vector Integer Negate Instructions:
vnegw: Vector Negate Word
vnegd: Vector Negate DoublewordSigned-off-by Nikunj A Dadhania <[email protected]>--- target-ppc/helper.h | 2 ++ target-ppc/int_helper.c | 12 ++++++++++++ target-ppc/translate/vmx-impl.inc.c | 2 ++ target-ppc/translate/vmx-ops.inc.c | 2 ++ 4 files changed, 18 insertions(+)target-ppc/helper.h +2
-0@@ -272,6 +272,8 @@ DEF_HELPER_2(vextsh2w, void, avr, avr) DEF_HELPER_2(vextsb2d, void, avr, avr) DEF_HELPER_2(vextsh2d, void, avr, avr) DEF_HELPER_2(vextsw2d, void, avr, avr) +DEF_HELPER_2(vnegw, void, avr, avr) +DEF_HELPER_2(vnegd, void, avr, avr) DEF_HELPER_2(vupkhpx, void, avr, avr) DEF_HELPER_2(vupklpx, void, avr, avr)DEF_HELPER_2 (vupkhsb, void, avr, avr)target-ppc/int_helper.c +0
-0@@ -1949,6 +1949,18 @@ VEXT_SIGNED(vextsh2d, s64, UINT16_MAX, int16_t, int64_t) VEXT_SIGNED(vextsw2d, s64, UINT32_MAX, int32_t, int64_t)#undef VEXT_SIGNED
Quoted 3 lines
target-ppc/int_helper.c VEXT_SIGNED(vextsh2d, s64, UINT16_MAX, int16_t, int64_t) · line 1952
Quoted 1 line
target-ppc/int_helper.c +1
-0+#define VNEG (name, element, mask) \The mask parameter appears to be unused.
Yes, will remove it and send the updated patch.
Regards
Nikunj
Re: [Qemu-devel] [PATCH v1 3/3] target-ppc: implement xxbr[qdwh] instruction
In reply to Richard HendersonQuoted 44 lines · Richard Henderson
Quoted 12 lines · David Gibson
Quoted 12 lines
target-ppc/translate/vsx-impl.inc.c +12
-0+static void gen_bswap32x4 (TCGv_i64 outh,TCGv_i64 outl, +TCGv_i64 inh,TCGv_i64 inl) +{ +TCGv_i64 hi =tcg_temp_new_i64 (); +TCGv_i64 lo =tcg_temp_new_i64 (); + +tcg_gen_bswap64_i64 (hi, inh); +tcg_gen_bswap64_i64 (lo, inl); +tcg_gen_shri_i64 (outh, hi,32 ); +tcg_gen_deposit_i64 (outh, outh, hi,32 ,32 ); +tcg_gen_shri_i64 (outl, lo,32 ); +tcg_gen_deposit_i64 (outl, outl, lo,32 ,32 );Quoted 8 lines
target-ppc/translate/vsx-impl.inc.c static void gen_bswap16x8(TCGv_i64 outh, TCGv_i64 outl, · line 150
Quoted 4 lines
target-ppc/translate/vsx-impl.inc.c +4
-0+ +tcg_temp_free_i64 (hi); +tcg_temp_free_i64 (lo); +}Is there actually any advantage to having this 128-bit operation working on two 64-bit "register"s, as opposed to having a bswap32x2 that operates on a single 64-bit register amd calling it twice?
For this one, no particular advantage.
Quoted 4 lines
Quoted 1 line
+
gen_bswap16x8(xth, xtl, xbh, xbl);Likewise for the 16x8 version, I guess, although that would mean changing the existing users.
For this one, we have to build a 64-bit constant,
0x00ff00ff00ff00ff. On some hosts that's up to 6 insns. Being about to reuse that for both swaps is useful.Quoted 11 lines
target-ppc/translate/vsx-impl.inc.c GEN_VSX_HELPER_2(xvrspim, 0x12, 0x0B, 0, PPC2_VSX) · line 779
Quoted 3 lines
target-ppc/translate/vsx-impl.inc.c +3
-0+tcg_gen_bswap64_i64 (t0, xbl); +tcg_gen_bswap64_i64 (xtl, xbh); +tcg_gen_bswap64_i64 (xth, t0);This looks wrong. You swap xbl as you move it to t0, then swap it again as you put it back into xth. So it looks like you'll translate
0011223344556677 8899AABBCCDDEEFF to 8899AABBCCDDEEFF 7766554433221100 whereas it should become FFEEDDCCBBAA9977 7766554433221100
Quoted 1 line
Indeed, the third line should be a move, not a swap.
Correct, will send updated patch.
Regards
Nikunj