From eebdb4d63a025d212854fb5330e064c97a8ad81a Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Sun, 27 May 2018 19:09:59 +0000 Subject: [PATCH] avoid gcc 7.3 warning --- bochs/cpu/aes.cc | 4 +++- bochs/cpu/avx/avx.cc | 27 ++++++++++++++++++++------- bochs/cpu/avx/avx2.cc | 28 ++++++++++++++++++++-------- bochs/cpu/avx/xop.cc | 4 ++++ 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/bochs/cpu/aes.cc b/bochs/cpu/aes.cc index 77333bfae..cc9c7d7fd 100644 --- a/bochs/cpu/aes.cc +++ b/bochs/cpu/aes.cc @@ -502,6 +502,8 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPCLMULQDQ_VdqHdqWdqIbR(bxInstruction_c *i unsigned len = i->getVL(); Bit8u imm8 = i->Ib(); + r.clear(); + for (unsigned n=0; n < len; n++) { BxPackedXmmRegister op1 = BX_READ_AVX_REG_LANE(i->src1(), n), op2 = BX_READ_AVX_REG_LANE(i->src2(), n); @@ -511,7 +513,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPCLMULQDQ_VdqHdqWdqIbR(bxInstruction_c *i xmm_pclmulqdq(&r.vmm128(n), op1.xmm64u(imm8 & 1), op2.xmm64u((imm8 >> 4) & 1)); } - BX_WRITE_AVX_REGZ(i->dst(), r, len); + BX_WRITE_AVX_REG(i->dst(), r); BX_NEXT_INSTR(i); } diff --git a/bochs/cpu/avx/avx.cc b/bochs/cpu/avx/avx.cc index 42ae6df60..58cdd4a69 100644 --- a/bochs/cpu/avx/avx.cc +++ b/bochs/cpu/avx/avx.cc @@ -339,10 +339,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VSHUFPS_VpsHpsWpsIbR(bxInstruction_c *i) BxPackedAvxRegister op2 = BX_READ_AVX_REG(i->src2()), result; unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) xmm_shufps(&result.vmm128(n), &op1.vmm128(n), &op2.vmm128(n), i->Ib()); - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -356,12 +358,14 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VSHUFPD_VpdHpdWpdIbR(bxInstruction_c *i) unsigned len = i->getVL(); Bit8u order = i->Ib(); + result.clear(); + for (unsigned n=0; n < len; n++) { xmm_shufpd(&result.vmm128(n), &op1.vmm128(n), &op2.vmm128(n), order); order >>= 2; } - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -390,6 +394,8 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VBROADCASTF128_VdqMdq(bxInstruction_c *i) BxPackedAvxRegister dst; BxPackedXmmRegister src; unsigned len = i->getVL(); + + dst.clear(); bx_address eaddr = BX_CPU_RESOLVE_ADDR(i); read_virtual_xmmword(i->seg(), eaddr, &src); @@ -398,7 +404,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VBROADCASTF128_VdqMdq(bxInstruction_c *i) dst.vmm128(n) = src; } - BX_WRITE_AVX_REGZ(i->dst(), dst, len); + BX_WRITE_AVX_REG(i->dst(), dst); BX_NEXT_INSTR(i); } @@ -524,10 +530,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPERMILPS_VpsHpsWpsR(bxInstruction_c *i) BxPackedAvxRegister op2 = BX_READ_AVX_REG(i->src2()), result; unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) xmm_permilps(&result.vmm128(n), &op1.vmm128(n), &op2.vmm128(n)); - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -539,10 +547,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPERMILPD_VpdHpdWpdR(bxInstruction_c *i) BxPackedAvxRegister op2 = BX_READ_AVX_REG(i->src2()), result; unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) xmm_permilpd(&result.vmm128(n), &op1.vmm128(n), &op2.vmm128(n)); - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -552,11 +562,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPERMILPS_VpsWpsIbR(bxInstruction_c *i) { BxPackedAvxRegister op1 = BX_READ_AVX_REG(i->src()), result; unsigned len = i->getVL(); + result.clear(); for (unsigned n=0; n < len; n++) xmm_shufps(&result.vmm128(n), &op1.vmm128(n), &op1.vmm128(n), i->Ib()); - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -568,12 +579,14 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPERMILPD_VpdWpdIbR(bxInstruction_c *i) unsigned len = i->getVL(); Bit8u order = i->Ib(); + result.clear(); + for (unsigned n=0; n < len; n++) { xmm_shufpd(&result.vmm128(n), &op1.vmm128(n), &op1.vmm128(n), order); order >>= 2; } - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } diff --git a/bochs/cpu/avx/avx2.cc b/bochs/cpu/avx/avx2.cc index 0c4686dec..8336c71ef 100644 --- a/bochs/cpu/avx/avx2.cc +++ b/bochs/cpu/avx/avx2.cc @@ -236,10 +236,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPSHUFHW_VdqWdqIbR(bxInstruction_c *i) Bit8u order = i->Ib(); unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) xmm_pshufhw(&result.vmm128(n), &op.vmm128(n), order); - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -249,10 +251,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPSHUFLW_VdqWdqIbR(bxInstruction_c *i) Bit8u order = i->Ib(); unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) xmm_pshuflw(&result.vmm128(n), &op.vmm128(n), order); - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -262,10 +266,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPSHUFB_VdqHdqWdqR(bxInstruction_c *i) BxPackedAvxRegister op2 = BX_READ_AVX_REG(i->src2()), result; unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) xmm_pshufb(&result.vmm128(n), &op1.vmm128(n), &op2.vmm128(n)); - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -274,6 +280,8 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VMPSADBW_VdqHdqWdqIbR(bxInstruction_c *i) BxPackedAvxRegister op1 = BX_READ_AVX_REG(i->src1()); BxPackedAvxRegister op2 = BX_READ_AVX_REG(i->src2()), result; + result.clear(); + Bit8u control = i->Ib(); unsigned len = i->getVL(); @@ -282,7 +290,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VMPSADBW_VdqHdqWdqIbR(bxInstruction_c *i) control >>= 3; } - BX_WRITE_AVX_REGZ(i->dst(), result, len); + BX_WRITE_AVX_REG(i->dst(), result); BX_NEXT_INSTR(i); } @@ -304,13 +312,14 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPBROADCASTB_VdqWbR(bxInstruction_c *i) { BxPackedAvxRegister op; unsigned len = i->getVL(); + op.clear(); Bit8u val_8 = BX_READ_XMM_REG_LO_BYTE(i->src()); for (unsigned n=0; n < len; n++) xmm_pbroadcastb(&op.vmm128(n), val_8); - BX_WRITE_AVX_REGZ(i->dst(), op, len); + BX_WRITE_AVX_REG(i->dst(), op); BX_NEXT_INSTR(i); } @@ -318,13 +327,14 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPBROADCASTW_VdqWwR(bxInstruction_c *i) { BxPackedAvxRegister op; unsigned len = i->getVL(); + op.clear(); Bit16u val_16 = BX_READ_XMM_REG_LO_WORD(i->src()); for (unsigned n=0; n < len; n++) xmm_pbroadcastw(&op.vmm128(n), val_16); - BX_WRITE_AVX_REGZ(i->dst(), op, len); + BX_WRITE_AVX_REG(i->dst(), op); BX_NEXT_INSTR(i); } @@ -332,13 +342,14 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPBROADCASTD_VdqWdR(bxInstruction_c *i) { BxPackedAvxRegister op; unsigned len = i->getVL(); + op.clear(); Bit32u val_32 = BX_READ_XMM_REG_LO_DWORD(i->src()); for (unsigned n=0; n < len; n++) xmm_pbroadcastd(&op.vmm128(n), val_32); - BX_WRITE_AVX_REGZ(i->dst(), op, len); + BX_WRITE_AVX_REG(i->dst(), op); BX_NEXT_INSTR(i); } @@ -346,13 +357,14 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPBROADCASTQ_VdqWqR(bxInstruction_c *i) { BxPackedAvxRegister op; unsigned len = i->getVL(); + op.clear(); Bit64u val_64 = BX_READ_XMM_REG_LO_QWORD(i->src()); for (unsigned n=0; n < len; n++) xmm_pbroadcastq(&op.vmm128(n), val_64); - BX_WRITE_AVX_REGZ(i->dst(), op, len); + BX_WRITE_AVX_REG(i->dst(), op); BX_NEXT_INSTR(i); } diff --git a/bochs/cpu/avx/xop.cc b/bochs/cpu/avx/xop.cc index 7316bda66..1583f1dc2 100644 --- a/bochs/cpu/avx/xop.cc +++ b/bochs/cpu/avx/xop.cc @@ -912,6 +912,8 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPERMIL2PS_VdqHdqWdqIbR(bxInstruction_c *i BxPackedYmmRegister op3 = BX_READ_YMM_REG(i->src3()), result; unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) { xmm_permil2ps(&result.ymm128(n), &op1.ymm128(n), &op2.ymm128(n), &op3.ymm128(n), i->Ib() & 3); } @@ -928,6 +930,8 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VPERMIL2PD_VdqHdqWdqIbR(bxInstruction_c *i BxPackedYmmRegister op3 = BX_READ_YMM_REG(i->src3()), result; unsigned len = i->getVL(); + result.clear(); + for (unsigned n=0; n < len; n++) { xmm_permil2pd(&result.ymm128(n), &op1.ymm128(n), &op2.ymm128(n), &op3.ymm128(n), i->Ib() & 3); }