Implement all Vector Integer Instructions introduced with the
"Vector Facility" for s390x TCG. -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJc3p0EAAoJEE3eEPcA/4NaPr0QALKxtoN0YbkLkX0zbyyMa8P4 hqGPOy2G1iaD0Z2cAlCtEdVyHrUBpbLO4ReWc8YyqHHYsRJwUjDLwU/mpLZf4anO mc2AepXiB+c3IItMWYQaUICOwu6mfmdLs8dHnByl3H7+hew8yDq+sYONeMwhwJRB vlLqKJyDn0y74enXtljEYuvMmoB/sVYQ+2WD+Oe+hBKa68Ds0ec5ZN0g8KU+33zE 35Tvkd/DHc5diNQC2U8goHfao76VwF9lm6azUUewx9Kontqq/BFInLqadA3v24+L VGU7RwTM/93p8NsWGKtuosi9YlsA+qJNRXxXI8KiLGL4wEDoArcegErDXuqMvlyv w8ZQOBx5sk/MFfoFVg/zFnz5QySMOMEAXJ7TFEdTbPf/NFQ5WCe77ejASWnfG/fi Zp4HeGzezb1/6hnvLKdbGNse0WocH0+xzY39j7/FpbjyAOtJe3MRx0cZzc+9fSWU urMbfvVf9oDkbByiVuLvuPVA7+wbZ0UcntLhW1H8brLKUav814mCRxTOwclwSmzo sINqFVg89UBGCDQfRR5L+di2YpIKySorxM4V8APntc3cF3n5JWvj6Q2AdXi1ChrK fIRw867Au25yUmifgfn3CK1e4XknGIGS4JRpVbMs1hNavJfaNOH6lGAtlSwWCZkX JzP/X/MxAUjX57YK+xHz =5pRI -----END PGP SIGNATURE----- Merge tag 's390x-tcg-2019-05-17-2' into s390-next-staging Implement all Vector Integer Instructions introduced with the "Vector Facility" for s390x TCG. # gpg: Signature made Fri 17 May 2019 01:37:40 PM CEST # gpg: using RSA key 4DDE10F700FF835A # gpg: Good signature from "David Hildenbrand <david@redhat.com>" [full] # gpg: aka "David Hildenbrand <davidhildenbrand@gmail.com>" [full] * tag 's390x-tcg-2019-05-17-2': (40 commits) s390x/tcg: Implement VECTOR TEST UNDER MASK s390x/tcg: Implement VECTOR SUM ACROSS WORD s390x/tcg: Implement VECTOR SUM ACROSS QUADWORD s390x/tcg: Implement VECTOR SUM ACROSS DOUBLEWORD s390x/tcg: Implement VECTOR SUBTRACT WITH BORROW COMPUTE BORROW INDICATION s390x/tcg: Implement VECTOR SUBTRACT WITH BORROW INDICATION s390x/tcg: Implement VECTOR SUBTRACT COMPUTE BORROW INDICATION s390x/tcg: Implement VECTOR SUBTRACT s390x/tcg: Implement VECTOR SHIFT RIGHT LOGICAL * s390x/tcg: Implement VECTOR SHIFT RIGHT ARITHMETIC s390x/tcg: Implement VECTOR SHIFT LEFT DOUBLE BY BYTE s390x/tcg: Implement VECTOR SHIFT LEFT (BY BYTE) s390x/tcg: Implement VECTOR ELEMENT SHIFT s390x/tcg: Implement VECTOR ELEMENT ROTATE AND INSERT UNDER MASK s390x/tcg: Implement VECTOR ELEMENT ROTATE LEFT LOGICAL s390x/tcg: Implement VECTOR POPULATION COUNT s390x/tcg: Implement VECTOR OR WITH COMPLEMENT s390x/tcg: Implement VECTOR OR s390x/tcg: Implement VECTOR NOT EXCLUSIVE OR s390x/tcg: Implement VECTOR NOR ... Signed-off-by: Cornelia Huck <cohuck@redhat.com>
This commit is contained in:
commit
e85decf2f1
@ -1,7 +1,7 @@
|
||||
obj-y += cpu.o cpu_models.o cpu_features.o gdbstub.o interrupt.o helper.o
|
||||
obj-$(CONFIG_TCG) += translate.o cc_helper.o excp_helper.o fpu_helper.o
|
||||
obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o crypto_helper.o
|
||||
obj-$(CONFIG_TCG) += vec_helper.o
|
||||
obj-$(CONFIG_TCG) += vec_helper.o vec_int_helper.o
|
||||
obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o diag.o
|
||||
obj-$(CONFIG_SOFTMMU) += sigp.o
|
||||
obj-$(CONFIG_KVM) += kvm.o
|
||||
|
@ -402,6 +402,20 @@ static uint32_t cc_calc_lcbb(uint64_t dst)
|
||||
return dst == 16 ? 0 : 3;
|
||||
}
|
||||
|
||||
static uint32_t cc_calc_vc(uint64_t low, uint64_t high)
|
||||
{
|
||||
if (high == -1ull && low == -1ull) {
|
||||
/* all elements match */
|
||||
return 0;
|
||||
} else if (high == 0 && low == 0) {
|
||||
/* no elements match */
|
||||
return 3;
|
||||
} else {
|
||||
/* some elements but not all match */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op,
|
||||
uint64_t src, uint64_t dst, uint64_t vr)
|
||||
{
|
||||
@ -514,6 +528,9 @@ static uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op,
|
||||
case CC_OP_LCBB:
|
||||
r = cc_calc_lcbb(dst);
|
||||
break;
|
||||
case CC_OP_VC:
|
||||
r = cc_calc_vc(src, dst);
|
||||
break;
|
||||
|
||||
case CC_OP_NZ_F32:
|
||||
r = set_cc_nz_f32(dst);
|
||||
|
@ -418,6 +418,7 @@ const char *cc_name(enum cc_op cc_op)
|
||||
[CC_OP_SLA_64] = "CC_OP_SLA_64",
|
||||
[CC_OP_FLOGR] = "CC_OP_FLOGR",
|
||||
[CC_OP_LCBB] = "CC_OP_LCBB",
|
||||
[CC_OP_VC] = "CC_OP_VC",
|
||||
};
|
||||
|
||||
return cc_names[cc_op];
|
||||
|
@ -145,6 +145,72 @@ DEF_HELPER_5(gvec_vpkls_cc64, void, ptr, cptr, cptr, env, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vperm, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(vstl, TCG_CALL_NO_WG, void, env, cptr, i64, i64)
|
||||
|
||||
/* === Vector Integer Instructions === */
|
||||
DEF_HELPER_FLAGS_4(gvec_vavg8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vavg16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vavgl8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vavgl16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_3(gvec_vclz8, TCG_CALL_NO_RWG, void, ptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_3(gvec_vclz16, TCG_CALL_NO_RWG, void, ptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_3(gvec_vctz8, TCG_CALL_NO_RWG, void, ptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_3(gvec_vctz16, TCG_CALL_NO_RWG, void, ptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vgfm8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vgfm16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vgfm32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vgfm64, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vgfma8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vgfma16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vgfma32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vgfma64, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmal8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmal16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmah8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmah16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmalh8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmalh16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmae8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmae16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmae32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmale8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmale16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmale32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmao8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmao16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmao32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmalo8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmalo16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_5(gvec_vmalo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmh8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmh16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmlh8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmlh16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vme8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vme16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vme32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmle8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmle16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmle32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmo8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmo16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmlo8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmlo16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vmlo32, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_3(gvec_vpopct8, TCG_CALL_NO_RWG, void, ptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_3(gvec_vpopct16, TCG_CALL_NO_RWG, void, ptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_verllv8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_verllv16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_verll8, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_verll16, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_verim8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_verim16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vsl, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vsra, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vsrl, TCG_CALL_NO_RWG, void, ptr, cptr, i64, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vscbi8, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_vscbi16, TCG_CALL_NO_RWG, void, ptr, cptr, cptr, i32)
|
||||
DEF_HELPER_4(gvec_vtm, void, ptr, cptr, env, i32)
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
DEF_HELPER_3(servc, i32, env, i64, i64)
|
||||
DEF_HELPER_4(diag, void, env, i32, i32, i32)
|
||||
|
@ -1054,6 +1054,143 @@
|
||||
/* VECTOR UNPACK LOGICAL LOW */
|
||||
F(0xe7d4, VUPLL, VRR_a, V, 0, 0, 0, 0, vup, 0, IF_VEC)
|
||||
|
||||
/* === Vector Integer Instructions === */
|
||||
|
||||
/* VECTOR ADD */
|
||||
F(0xe7f3, VA, VRR_c, V, 0, 0, 0, 0, va, 0, IF_VEC)
|
||||
/* VECTOR ADD COMPUTE CARRY */
|
||||
F(0xe7f1, VACC, VRR_c, V, 0, 0, 0, 0, vacc, 0, IF_VEC)
|
||||
/* VECTOR ADD WITH CARRY */
|
||||
F(0xe7bb, VAC, VRR_d, V, 0, 0, 0, 0, vac, 0, IF_VEC)
|
||||
/* VECTOR ADD WITH CARRY COMPUTE CARRY */
|
||||
F(0xe7b9, VACCC, VRR_d, V, 0, 0, 0, 0, vaccc, 0, IF_VEC)
|
||||
/* VECTOR AND */
|
||||
F(0xe768, VN, VRR_c, V, 0, 0, 0, 0, vn, 0, IF_VEC)
|
||||
/* VECTOR AND WITH COMPLEMENT */
|
||||
F(0xe769, VNC, VRR_c, V, 0, 0, 0, 0, vnc, 0, IF_VEC)
|
||||
/* VECTOR AVERAGE */
|
||||
F(0xe7f2, VAVG, VRR_c, V, 0, 0, 0, 0, vavg, 0, IF_VEC)
|
||||
/* VECTOR AVERAGE LOGICAL */
|
||||
F(0xe7f0, VAVGL, VRR_c, V, 0, 0, 0, 0, vavgl, 0, IF_VEC)
|
||||
/* VECTOR CHECKSUM */
|
||||
F(0xe766, VCKSM, VRR_c, V, 0, 0, 0, 0, vcksm, 0, IF_VEC)
|
||||
/* VECTOR ELEMENT COMPARE */
|
||||
F(0xe7db, VEC, VRR_a, V, 0, 0, 0, 0, vec, cmps64, IF_VEC)
|
||||
/* VECTOR ELEMENT COMPARE LOGICAL */
|
||||
F(0xe7d9, VECL, VRR_a, V, 0, 0, 0, 0, vec, cmpu64, IF_VEC)
|
||||
/* VECTOR COMPARE EQUAL */
|
||||
E(0xe7f8, VCEQ, VRR_b, V, 0, 0, 0, 0, vc, 0, TCG_COND_EQ, IF_VEC)
|
||||
/* VECTOR COMPARE HIGH */
|
||||
E(0xe7fb, VCH, VRR_b, V, 0, 0, 0, 0, vc, 0, TCG_COND_GT, IF_VEC)
|
||||
/* VECTOR COMPARE HIGH LOGICAL */
|
||||
E(0xe7f9, VCHL, VRR_b, V, 0, 0, 0, 0, vc, 0, TCG_COND_GTU, IF_VEC)
|
||||
/* VECTOR COUNT LEADING ZEROS */
|
||||
F(0xe753, VCLZ, VRR_a, V, 0, 0, 0, 0, vclz, 0, IF_VEC)
|
||||
/* VECTOR COUNT TRAILING ZEROS */
|
||||
F(0xe752, VCTZ, VRR_a, V, 0, 0, 0, 0, vctz, 0, IF_VEC)
|
||||
/* VECTOR EXCLUSIVE OR */
|
||||
F(0xe76d, VX, VRR_c, V, 0, 0, 0, 0, vx, 0, IF_VEC)
|
||||
/* VECTOR GALOIS FIELD MULTIPLY SUM */
|
||||
F(0xe7b4, VGFM, VRR_c, V, 0, 0, 0, 0, vgfm, 0, IF_VEC)
|
||||
/* VECTOR GALOIS FIELD MULTIPLY SUM AND ACCUMULATE */
|
||||
F(0xe7bc, VGFMA, VRR_d, V, 0, 0, 0, 0, vgfma, 0, IF_VEC)
|
||||
/* VECTOR LOAD COMPLEMENT */
|
||||
F(0xe7de, VLC, VRR_a, V, 0, 0, 0, 0, vlc, 0, IF_VEC)
|
||||
/* VECTOR LOAD POSITIVE */
|
||||
F(0xe7df, VLP, VRR_a, V, 0, 0, 0, 0, vlp, 0, IF_VEC)
|
||||
/* VECTOR MAXIMUM */
|
||||
F(0xe7ff, VMX, VRR_c, V, 0, 0, 0, 0, vmx, 0, IF_VEC)
|
||||
/* VECTOR MAXIMUM LOGICAL */
|
||||
F(0xe7fd, VMXL, VRR_c, V, 0, 0, 0, 0, vmx, 0, IF_VEC)
|
||||
/* VECTOR MINIMUM */
|
||||
F(0xe7fe, VMN, VRR_c, V, 0, 0, 0, 0, vmx, 0, IF_VEC)
|
||||
/* VECTOR MINIMUM LOGICAL */
|
||||
F(0xe7fc, VMNL, VRR_c, V, 0, 0, 0, 0, vmx, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY AND ADD LOW */
|
||||
F(0xe7aa, VMAL, VRR_d, V, 0, 0, 0, 0, vma, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY AND ADD HIGH */
|
||||
F(0xe7ab, VMAH, VRR_d, V, 0, 0, 0, 0, vma, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY AND ADD LOGICAL HIGH */
|
||||
F(0xe7a9, VMALH, VRR_d, V, 0, 0, 0, 0, vma, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY AND ADD EVEN */
|
||||
F(0xe7ae, VMAE, VRR_d, V, 0, 0, 0, 0, vma, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY AND ADD LOGICAL EVEN */
|
||||
F(0xe7ac, VMALE, VRR_d, V, 0, 0, 0, 0, vma, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY AND ADD ODD */
|
||||
F(0xe7af, VMAO, VRR_d, V, 0, 0, 0, 0, vma, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY AND ADD LOGICAL ODD */
|
||||
F(0xe7ad, VMALO, VRR_d, V, 0, 0, 0, 0, vma, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY HIGH */
|
||||
F(0xe7a3, VMH, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY LOGICAL HIGH */
|
||||
F(0xe7a1, VMLH, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY LOW */
|
||||
F(0xe7a2, VML, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY EVEN */
|
||||
F(0xe7a6, VME, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY LOGICAL EVEN */
|
||||
F(0xe7a4, VMLE, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY ODD */
|
||||
F(0xe7a7, VMO, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC)
|
||||
/* VECTOR MULTIPLY LOGICAL ODD */
|
||||
F(0xe7a5, VMLO, VRR_c, V, 0, 0, 0, 0, vm, 0, IF_VEC)
|
||||
/* VECTOR NAND */
|
||||
F(0xe76e, VNN, VRR_c, VE, 0, 0, 0, 0, vnn, 0, IF_VEC)
|
||||
/* VECTOR NOR */
|
||||
F(0xe76b, VNO, VRR_c, V, 0, 0, 0, 0, vno, 0, IF_VEC)
|
||||
/* VECTOR NOT EXCLUSIVE OR */
|
||||
F(0xe76c, VNX, VRR_c, VE, 0, 0, 0, 0, vnx, 0, IF_VEC)
|
||||
/* VECTOR OR */
|
||||
F(0xe76a, VO, VRR_c, V, 0, 0, 0, 0, vo, 0, IF_VEC)
|
||||
/* VECTOR OR WITH COMPLEMENT */
|
||||
F(0xe76f, VOC, VRR_c, VE, 0, 0, 0, 0, voc, 0, IF_VEC)
|
||||
/* VECTOR POPULATION COUNT */
|
||||
F(0xe750, VPOPCT, VRR_a, V, 0, 0, 0, 0, vpopct, 0, IF_VEC)
|
||||
/* VECTOR ELEMENT ROTATE LEFT LOGICAL */
|
||||
F(0xe773, VERLLV, VRR_c, V, 0, 0, 0, 0, verllv, 0, IF_VEC)
|
||||
F(0xe733, VERLL, VRS_a, V, la2, 0, 0, 0, verll, 0, IF_VEC)
|
||||
/* VECTOR ELEMENT ROTATE AND INSERT UNDER MASK */
|
||||
F(0xe772, VERIM, VRI_d, V, 0, 0, 0, 0, verim, 0, IF_VEC)
|
||||
/* VECTOR ELEMENT SHIFT LEFT */
|
||||
F(0xe770, VESLV, VRR_c, V, 0, 0, 0, 0, vesv, 0, IF_VEC)
|
||||
F(0xe730, VESL, VRS_a, V, la2, 0, 0, 0, ves, 0, IF_VEC)
|
||||
/* VECTOR ELEMENT SHIFT RIGHT ARITHMETIC */
|
||||
F(0xe77a, VESRAV, VRR_c, V, 0, 0, 0, 0, vesv, 0, IF_VEC)
|
||||
F(0xe73a, VESRA, VRS_a, V, la2, 0, 0, 0, ves, 0, IF_VEC)
|
||||
/* VECTOR ELEMENT SHIFT RIGHT LOGICAL */
|
||||
F(0xe778, VESRLV, VRR_c, V, 0, 0, 0, 0, vesv, 0, IF_VEC)
|
||||
F(0xe738, VESRL, VRS_a, V, la2, 0, 0, 0, ves, 0, IF_VEC)
|
||||
/* VECTOR SHIFT LEFT */
|
||||
F(0xe774, VSL, VRR_c, V, 0, 0, 0, 0, vsl, 0, IF_VEC)
|
||||
/* VECTOR SHIFT LEFT BY BYTE */
|
||||
F(0xe775, VSLB, VRR_c, V, 0, 0, 0, 0, vsl, 0, IF_VEC)
|
||||
/* VECTOR SHIFT LEFT DOUBLE BY BYTE */
|
||||
F(0xe777, VSLDB, VRI_d, V, 0, 0, 0, 0, vsldb, 0, IF_VEC)
|
||||
/* VECTOR SHIFT RIGHT ARITHMETIC */
|
||||
F(0xe77e, VSRA, VRR_c, V, 0, 0, 0, 0, vsra, 0, IF_VEC)
|
||||
/* VECTOR SHIFT RIGHT ARITHMETIC BY BYTE */
|
||||
F(0xe77f, VSRAB, VRR_c, V, 0, 0, 0, 0, vsra, 0, IF_VEC)
|
||||
/* VECTOR SHIFT RIGHT LOGICAL */
|
||||
F(0xe77c, VSRL, VRR_c, V, 0, 0, 0, 0, vsrl, 0, IF_VEC)
|
||||
/* VECTOR SHIFT RIGHT LOGICAL BY BYTE */
|
||||
F(0xe77d, VSRLB, VRR_c, V, 0, 0, 0, 0, vsrl, 0, IF_VEC)
|
||||
/* VECTOR SUBTRACT */
|
||||
F(0xe7f7, VS, VRR_c, V, 0, 0, 0, 0, vs, 0, IF_VEC)
|
||||
/* VECTOR SUBTRACT COMPUTE BORROW INDICATION */
|
||||
F(0xe7f5, VSCBI, VRR_c, V, 0, 0, 0, 0, vscbi, 0, IF_VEC)
|
||||
/* VECTOR SUBTRACT WITH BORROW INDICATION */
|
||||
F(0xe7bf, VSBI, VRR_d, V, 0, 0, 0, 0, vsbi, 0, IF_VEC)
|
||||
/* VECTOR SUBTRACT WITH BORROW COMPUTE BORROW INDICATION */
|
||||
F(0xe7bd, VSBCBI, VRR_d, V, 0, 0, 0, 0, vsbcbi, 0, IF_VEC)
|
||||
/* VECTOR SUM ACROSS DOUBLEWORD */
|
||||
F(0xe765, VSUMG, VRR_c, V, 0, 0, 0, 0, vsumg, 0, IF_VEC)
|
||||
/* VECTOR SUM ACROSS QUADWORD */
|
||||
F(0xe767, VSUMQ, VRR_c, V, 0, 0, 0, 0, vsumq, 0, IF_VEC)
|
||||
/* VECTOR SUM ACROSS WORD */
|
||||
F(0xe764, VSUM, VRR_c, V, 0, 0, 0, 0, vsum, 0, IF_VEC)
|
||||
/* VECTOR TEST UNDER MASK */
|
||||
F(0xe7d8, VTM, VRR_a, V, 0, 0, 0, 0, vtm, 0, IF_VEC)
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* COMPARE AND SWAP AND PURGE */
|
||||
E(0xb250, CSP, RRE, Z, r1_32u, ra2, r1_P, 0, csp, 0, MO_TEUL, IF_PRIV)
|
||||
|
@ -200,6 +200,7 @@ enum cc_op {
|
||||
CC_OP_SLA_64, /* Calculate shift left signed (64bit) */
|
||||
CC_OP_FLOGR, /* find leftmost one */
|
||||
CC_OP_LCBB, /* load count to block boundary */
|
||||
CC_OP_VC, /* vector compare result */
|
||||
CC_OP_MAX
|
||||
};
|
||||
|
||||
|
@ -572,6 +572,7 @@ static void gen_op_calc_cc(DisasContext *s)
|
||||
case CC_OP_SLA_32:
|
||||
case CC_OP_SLA_64:
|
||||
case CC_OP_NZ_F128:
|
||||
case CC_OP_VC:
|
||||
/* 2 arguments */
|
||||
gen_helper_calc_cc(cc_op, cpu_env, local_cc_op, cc_src, cc_dst, dummy);
|
||||
break;
|
||||
@ -6092,6 +6093,7 @@ enum DisasInsnEnum {
|
||||
#define FAC_PCI S390_FEAT_ZPCI /* z/PCI facility */
|
||||
#define FAC_AIS S390_FEAT_ADAPTER_INT_SUPPRESSION
|
||||
#define FAC_V S390_FEAT_VECTOR /* vector facility */
|
||||
#define FAC_VE S390_FEAT_VECTOR_ENH /* vector enhancements facility 1 */
|
||||
|
||||
static const DisasInsn insn_info[] = {
|
||||
#include "insn-data.def"
|
||||
|
File diff suppressed because it is too large
Load Diff
616
target/s390x/vec_int_helper.c
Normal file
616
target/s390x/vec_int_helper.c
Normal file
@ -0,0 +1,616 @@
|
||||
/*
|
||||
* QEMU TCG support -- s390x vector integer instruction support
|
||||
*
|
||||
* Copyright (C) 2019 Red Hat Inc
|
||||
*
|
||||
* Authors:
|
||||
* David Hildenbrand <david@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "vec.h"
|
||||
#include "exec/helper-proto.h"
|
||||
#include "tcg/tcg-gvec-desc.h"
|
||||
|
||||
static bool s390_vec_is_zero(const S390Vector *v)
|
||||
{
|
||||
return !v->doubleword[0] && !v->doubleword[1];
|
||||
}
|
||||
|
||||
static void s390_vec_xor(S390Vector *res, const S390Vector *a,
|
||||
const S390Vector *b)
|
||||
{
|
||||
res->doubleword[0] = a->doubleword[0] ^ b->doubleword[0];
|
||||
res->doubleword[1] = a->doubleword[1] ^ b->doubleword[1];
|
||||
}
|
||||
|
||||
static void s390_vec_and(S390Vector *res, const S390Vector *a,
|
||||
const S390Vector *b)
|
||||
{
|
||||
res->doubleword[0] = a->doubleword[0] & b->doubleword[0];
|
||||
res->doubleword[1] = a->doubleword[1] & b->doubleword[1];
|
||||
}
|
||||
|
||||
static bool s390_vec_equal(const S390Vector *a, const S390Vector *b)
|
||||
{
|
||||
return a->doubleword[0] == b->doubleword[0] &&
|
||||
a->doubleword[1] == b->doubleword[1];
|
||||
}
|
||||
|
||||
static void s390_vec_shl(S390Vector *d, const S390Vector *a, uint64_t count)
|
||||
{
|
||||
uint64_t tmp;
|
||||
|
||||
g_assert(count < 128);
|
||||
if (count == 0) {
|
||||
d->doubleword[0] = a->doubleword[0];
|
||||
d->doubleword[1] = a->doubleword[1];
|
||||
} else if (count == 64) {
|
||||
d->doubleword[0] = a->doubleword[1];
|
||||
d->doubleword[1] = 0;
|
||||
} else if (count < 64) {
|
||||
tmp = extract64(a->doubleword[1], 64 - count, count);
|
||||
d->doubleword[1] = a->doubleword[1] << count;
|
||||
d->doubleword[0] = (a->doubleword[0] << count) | tmp;
|
||||
} else {
|
||||
d->doubleword[0] = a->doubleword[1] << (count - 64);
|
||||
d->doubleword[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void s390_vec_sar(S390Vector *d, const S390Vector *a, uint64_t count)
|
||||
{
|
||||
uint64_t tmp;
|
||||
|
||||
if (count == 0) {
|
||||
d->doubleword[0] = a->doubleword[0];
|
||||
d->doubleword[1] = a->doubleword[1];
|
||||
} else if (count == 64) {
|
||||
d->doubleword[1] = a->doubleword[0];
|
||||
d->doubleword[0] = 0;
|
||||
} else if (count < 64) {
|
||||
tmp = a->doubleword[1] >> count;
|
||||
d->doubleword[1] = deposit64(tmp, 64 - count, count, a->doubleword[0]);
|
||||
d->doubleword[0] = (int64_t)a->doubleword[0] >> count;
|
||||
} else {
|
||||
d->doubleword[1] = (int64_t)a->doubleword[0] >> (count - 64);
|
||||
d->doubleword[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void s390_vec_shr(S390Vector *d, const S390Vector *a, uint64_t count)
|
||||
{
|
||||
uint64_t tmp;
|
||||
|
||||
g_assert(count < 128);
|
||||
if (count == 0) {
|
||||
d->doubleword[0] = a->doubleword[0];
|
||||
d->doubleword[1] = a->doubleword[1];
|
||||
} else if (count == 64) {
|
||||
d->doubleword[1] = a->doubleword[0];
|
||||
d->doubleword[0] = 0;
|
||||
} else if (count < 64) {
|
||||
tmp = a->doubleword[1] >> count;
|
||||
d->doubleword[1] = deposit64(tmp, 64 - count, count, a->doubleword[0]);
|
||||
d->doubleword[0] = a->doubleword[0] >> count;
|
||||
} else {
|
||||
d->doubleword[1] = a->doubleword[0] >> (count - 64);
|
||||
d->doubleword[0] = 0;
|
||||
}
|
||||
}
|
||||
#define DEF_VAVG(BITS) \
|
||||
void HELPER(gvec_vavg##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const int32_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, i); \
|
||||
const int32_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, (a + b + 1) >> 1); \
|
||||
} \
|
||||
}
|
||||
DEF_VAVG(8)
|
||||
DEF_VAVG(16)
|
||||
|
||||
#define DEF_VAVGL(BITS) \
|
||||
void HELPER(gvec_vavgl##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, (a + b + 1) >> 1); \
|
||||
} \
|
||||
}
|
||||
DEF_VAVGL(8)
|
||||
DEF_VAVGL(16)
|
||||
|
||||
#define DEF_VCLZ(BITS) \
|
||||
void HELPER(gvec_vclz##BITS)(void *v1, const void *v2, uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, clz32(a) - 32 + BITS); \
|
||||
} \
|
||||
}
|
||||
DEF_VCLZ(8)
|
||||
DEF_VCLZ(16)
|
||||
|
||||
#define DEF_VCTZ(BITS) \
|
||||
void HELPER(gvec_vctz##BITS)(void *v1, const void *v2, uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, a ? ctz32(a) : BITS); \
|
||||
} \
|
||||
}
|
||||
DEF_VCTZ(8)
|
||||
DEF_VCTZ(16)
|
||||
|
||||
/* like binary multiplication, but XOR instead of addition */
|
||||
#define DEF_GALOIS_MULTIPLY(BITS, TBITS) \
|
||||
static uint##TBITS##_t galois_multiply##BITS(uint##TBITS##_t a, \
|
||||
uint##TBITS##_t b) \
|
||||
{ \
|
||||
uint##TBITS##_t res = 0; \
|
||||
\
|
||||
while (b) { \
|
||||
if (b & 0x1) { \
|
||||
res = res ^ a; \
|
||||
} \
|
||||
a = a << 1; \
|
||||
b = b >> 1; \
|
||||
} \
|
||||
return res; \
|
||||
}
|
||||
DEF_GALOIS_MULTIPLY(8, 16)
|
||||
DEF_GALOIS_MULTIPLY(16, 32)
|
||||
DEF_GALOIS_MULTIPLY(32, 64)
|
||||
|
||||
static S390Vector galois_multiply64(uint64_t a, uint64_t b)
|
||||
{
|
||||
S390Vector res = {};
|
||||
S390Vector va = {
|
||||
.doubleword[1] = a,
|
||||
};
|
||||
S390Vector vb = {
|
||||
.doubleword[1] = b,
|
||||
};
|
||||
|
||||
while (!s390_vec_is_zero(&vb)) {
|
||||
if (vb.doubleword[1] & 0x1) {
|
||||
s390_vec_xor(&res, &res, &va);
|
||||
}
|
||||
s390_vec_shl(&va, &va, 1);
|
||||
s390_vec_shr(&vb, &vb, 1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#define DEF_VGFM(BITS, TBITS) \
|
||||
void HELPER(gvec_vgfm##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / TBITS); i++) { \
|
||||
uint##BITS##_t a = s390_vec_read_element##BITS(v2, i * 2); \
|
||||
uint##BITS##_t b = s390_vec_read_element##BITS(v3, i * 2); \
|
||||
uint##TBITS##_t d = galois_multiply##BITS(a, b); \
|
||||
\
|
||||
a = s390_vec_read_element##BITS(v2, i * 2 + 1); \
|
||||
b = s390_vec_read_element##BITS(v3, i * 2 + 1); \
|
||||
d = d ^ galois_multiply32(a, b); \
|
||||
s390_vec_write_element##TBITS(v1, i, d); \
|
||||
} \
|
||||
}
|
||||
DEF_VGFM(8, 16)
|
||||
DEF_VGFM(16, 32)
|
||||
DEF_VGFM(32, 64)
|
||||
|
||||
void HELPER(gvec_vgfm64)(void *v1, const void *v2, const void *v3,
|
||||
uint32_t desc)
|
||||
{
|
||||
S390Vector tmp1, tmp2;
|
||||
uint64_t a, b;
|
||||
|
||||
a = s390_vec_read_element64(v2, 0);
|
||||
b = s390_vec_read_element64(v3, 0);
|
||||
tmp1 = galois_multiply64(a, b);
|
||||
a = s390_vec_read_element64(v2, 1);
|
||||
b = s390_vec_read_element64(v3, 1);
|
||||
tmp2 = galois_multiply64(a, b);
|
||||
s390_vec_xor(v1, &tmp1, &tmp2);
|
||||
}
|
||||
|
||||
#define DEF_VGFMA(BITS, TBITS) \
|
||||
void HELPER(gvec_vgfma##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / TBITS); i++) { \
|
||||
uint##BITS##_t a = s390_vec_read_element##BITS(v2, i * 2); \
|
||||
uint##BITS##_t b = s390_vec_read_element##BITS(v3, i * 2); \
|
||||
uint##TBITS##_t d = galois_multiply##BITS(a, b); \
|
||||
\
|
||||
a = s390_vec_read_element##BITS(v2, i * 2 + 1); \
|
||||
b = s390_vec_read_element##BITS(v3, i * 2 + 1); \
|
||||
d = d ^ galois_multiply32(a, b); \
|
||||
d = d ^ s390_vec_read_element##TBITS(v4, i); \
|
||||
s390_vec_write_element##TBITS(v1, i, d); \
|
||||
} \
|
||||
}
|
||||
DEF_VGFMA(8, 16)
|
||||
DEF_VGFMA(16, 32)
|
||||
DEF_VGFMA(32, 64)
|
||||
|
||||
void HELPER(gvec_vgfma64)(void *v1, const void *v2, const void *v3,
|
||||
const void *v4, uint32_t desc)
|
||||
{
|
||||
S390Vector tmp1, tmp2;
|
||||
uint64_t a, b;
|
||||
|
||||
a = s390_vec_read_element64(v2, 0);
|
||||
b = s390_vec_read_element64(v3, 0);
|
||||
tmp1 = galois_multiply64(a, b);
|
||||
a = s390_vec_read_element64(v2, 1);
|
||||
b = s390_vec_read_element64(v3, 1);
|
||||
tmp2 = galois_multiply64(a, b);
|
||||
s390_vec_xor(&tmp1, &tmp1, &tmp2);
|
||||
s390_vec_xor(v1, &tmp1, v4);
|
||||
}
|
||||
|
||||
#define DEF_VMAL(BITS) \
|
||||
void HELPER(gvec_vmal##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \
|
||||
const uint##BITS##_t c = s390_vec_read_element##BITS(v4, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, a * b + c); \
|
||||
} \
|
||||
}
|
||||
DEF_VMAL(8)
|
||||
DEF_VMAL(16)
|
||||
|
||||
#define DEF_VMAH(BITS) \
|
||||
void HELPER(gvec_vmah##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const int32_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, i); \
|
||||
const int32_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, i); \
|
||||
const int32_t c = (int##BITS##_t)s390_vec_read_element##BITS(v4, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, (a * b + c) >> BITS); \
|
||||
} \
|
||||
}
|
||||
DEF_VMAH(8)
|
||||
DEF_VMAH(16)
|
||||
|
||||
#define DEF_VMALH(BITS) \
|
||||
void HELPER(gvec_vmalh##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \
|
||||
const uint##BITS##_t c = s390_vec_read_element##BITS(v4, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, (a * b + c) >> BITS); \
|
||||
} \
|
||||
}
|
||||
DEF_VMALH(8)
|
||||
DEF_VMALH(16)
|
||||
|
||||
#define DEF_VMAE(BITS, TBITS) \
|
||||
void HELPER(gvec_vmae##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
|
||||
int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \
|
||||
int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \
|
||||
int##TBITS##_t c = (int##BITS##_t)s390_vec_read_element##BITS(v4, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b + c); \
|
||||
} \
|
||||
}
|
||||
DEF_VMAE(8, 16)
|
||||
DEF_VMAE(16, 32)
|
||||
DEF_VMAE(32, 64)
|
||||
|
||||
#define DEF_VMALE(BITS, TBITS) \
|
||||
void HELPER(gvec_vmale##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
|
||||
uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \
|
||||
uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \
|
||||
uint##TBITS##_t c = s390_vec_read_element##BITS(v4, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b + c); \
|
||||
} \
|
||||
}
|
||||
DEF_VMALE(8, 16)
|
||||
DEF_VMALE(16, 32)
|
||||
DEF_VMALE(32, 64)
|
||||
|
||||
#define DEF_VMAO(BITS, TBITS) \
|
||||
void HELPER(gvec_vmao##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \
|
||||
int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \
|
||||
int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \
|
||||
int##TBITS##_t c = (int##BITS##_t)s390_vec_read_element##BITS(v4, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b + c); \
|
||||
} \
|
||||
}
|
||||
DEF_VMAO(8, 16)
|
||||
DEF_VMAO(16, 32)
|
||||
DEF_VMAO(32, 64)
|
||||
|
||||
#define DEF_VMALO(BITS, TBITS) \
|
||||
void HELPER(gvec_vmalo##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
const void *v4, uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \
|
||||
uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \
|
||||
uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \
|
||||
uint##TBITS##_t c = s390_vec_read_element##BITS(v4, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b + c); \
|
||||
} \
|
||||
}
|
||||
DEF_VMALO(8, 16)
|
||||
DEF_VMALO(16, 32)
|
||||
DEF_VMALO(32, 64)
|
||||
|
||||
#define DEF_VMH(BITS) \
|
||||
void HELPER(gvec_vmh##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const int32_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, i); \
|
||||
const int32_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, (a * b) >> BITS); \
|
||||
} \
|
||||
}
|
||||
DEF_VMH(8)
|
||||
DEF_VMH(16)
|
||||
|
||||
#define DEF_VMLH(BITS) \
|
||||
void HELPER(gvec_vmlh##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, (a * b) >> BITS); \
|
||||
} \
|
||||
}
|
||||
DEF_VMLH(8)
|
||||
DEF_VMLH(16)
|
||||
|
||||
#define DEF_VME(BITS, TBITS) \
|
||||
void HELPER(gvec_vme##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
|
||||
int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \
|
||||
int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b); \
|
||||
} \
|
||||
}
|
||||
DEF_VME(8, 16)
|
||||
DEF_VME(16, 32)
|
||||
DEF_VME(32, 64)
|
||||
|
||||
#define DEF_VMLE(BITS, TBITS) \
|
||||
void HELPER(gvec_vmle##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
|
||||
const uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \
|
||||
const uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b); \
|
||||
} \
|
||||
}
|
||||
DEF_VMLE(8, 16)
|
||||
DEF_VMLE(16, 32)
|
||||
DEF_VMLE(32, 64)
|
||||
|
||||
#define DEF_VMO(BITS, TBITS) \
|
||||
void HELPER(gvec_vmo##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 1; i < (128 / TBITS); i++, j += 2) { \
|
||||
int##TBITS##_t a = (int##BITS##_t)s390_vec_read_element##BITS(v2, j); \
|
||||
int##TBITS##_t b = (int##BITS##_t)s390_vec_read_element##BITS(v3, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b); \
|
||||
} \
|
||||
}
|
||||
DEF_VMO(8, 16)
|
||||
DEF_VMO(16, 32)
|
||||
DEF_VMO(32, 64)
|
||||
|
||||
#define DEF_VMLO(BITS, TBITS) \
|
||||
void HELPER(gvec_vmlo##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i, j; \
|
||||
\
|
||||
for (i = 0, j = 0; i < (128 / TBITS); i++, j += 2) { \
|
||||
const uint##TBITS##_t a = s390_vec_read_element##BITS(v2, j); \
|
||||
const uint##TBITS##_t b = s390_vec_read_element##BITS(v3, j); \
|
||||
\
|
||||
s390_vec_write_element##TBITS(v1, i, a * b); \
|
||||
} \
|
||||
}
|
||||
DEF_VMLO(8, 16)
|
||||
DEF_VMLO(16, 32)
|
||||
DEF_VMLO(32, 64)
|
||||
|
||||
#define DEF_VPOPCT(BITS) \
|
||||
void HELPER(gvec_vpopct##BITS)(void *v1, const void *v2, uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, ctpop32(a)); \
|
||||
} \
|
||||
}
|
||||
DEF_VPOPCT(8)
|
||||
DEF_VPOPCT(16)
|
||||
|
||||
#define DEF_VERLLV(BITS) \
|
||||
void HELPER(gvec_verllv##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, rol##BITS(a, b)); \
|
||||
} \
|
||||
}
|
||||
DEF_VERLLV(8)
|
||||
DEF_VERLLV(16)
|
||||
|
||||
#define DEF_VERLL(BITS) \
|
||||
void HELPER(gvec_verll##BITS)(void *v1, const void *v2, uint64_t count, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, rol##BITS(a, count)); \
|
||||
} \
|
||||
}
|
||||
DEF_VERLL(8)
|
||||
DEF_VERLL(16)
|
||||
|
||||
#define DEF_VERIM(BITS) \
|
||||
void HELPER(gvec_verim##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
const uint8_t count = simd_data(desc); \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v1, i); \
|
||||
const uint##BITS##_t b = s390_vec_read_element##BITS(v2, i); \
|
||||
const uint##BITS##_t mask = s390_vec_read_element##BITS(v3, i); \
|
||||
const uint##BITS##_t d = (a & ~mask) | (rol##BITS(b, count) & mask); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, d); \
|
||||
} \
|
||||
}
|
||||
DEF_VERIM(8)
|
||||
DEF_VERIM(16)
|
||||
|
||||
void HELPER(gvec_vsl)(void *v1, const void *v2, uint64_t count,
|
||||
uint32_t desc)
|
||||
{
|
||||
s390_vec_shl(v1, v2, count);
|
||||
}
|
||||
|
||||
void HELPER(gvec_vsra)(void *v1, const void *v2, uint64_t count,
|
||||
uint32_t desc)
|
||||
{
|
||||
s390_vec_sar(v1, v2, count);
|
||||
}
|
||||
|
||||
void HELPER(gvec_vsrl)(void *v1, const void *v2, uint64_t count,
|
||||
uint32_t desc)
|
||||
{
|
||||
s390_vec_shr(v1, v2, count);
|
||||
}
|
||||
|
||||
#define DEF_VSCBI(BITS) \
|
||||
void HELPER(gvec_vscbi##BITS)(void *v1, const void *v2, const void *v3, \
|
||||
uint32_t desc) \
|
||||
{ \
|
||||
int i; \
|
||||
\
|
||||
for (i = 0; i < (128 / BITS); i++) { \
|
||||
const uint##BITS##_t a = s390_vec_read_element##BITS(v2, i); \
|
||||
const uint##BITS##_t b = s390_vec_read_element##BITS(v3, i); \
|
||||
\
|
||||
s390_vec_write_element##BITS(v1, i, a < b); \
|
||||
} \
|
||||
}
|
||||
DEF_VSCBI(8)
|
||||
DEF_VSCBI(16)
|
||||
|
||||
void HELPER(gvec_vtm)(void *v1, const void *v2, CPUS390XState *env,
|
||||
uint32_t desc)
|
||||
{
|
||||
S390Vector tmp;
|
||||
|
||||
s390_vec_and(&tmp, v1, v2);
|
||||
if (s390_vec_is_zero(&tmp)) {
|
||||
/* Selected bits all zeros; or all mask bits zero */
|
||||
env->cc_op = 0;
|
||||
} else if (s390_vec_equal(&tmp, v2)) {
|
||||
/* Selected bits all ones */
|
||||
env->cc_op = 3;
|
||||
} else {
|
||||
/* Selected bits a mix of zeros and ones */
|
||||
env->cc_op = 1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user