From 5103d97ece7409bc0ee2db8f7e4c69aff9706064 Mon Sep 17 00:00:00 2001 From: Shwartsman Date: Thu, 19 Oct 2023 16:59:32 +0300 Subject: [PATCH] mask use of CUT_OPMASK_TO macro instead of magic arithmetic --- bochs/cpu/avx/avx512_bf16.cc | 2 +- bochs/cpu/avx/avx512_cvt.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bochs/cpu/avx/avx512_bf16.cc b/bochs/cpu/avx/avx512_bf16.cc index 247924cb0..24ecbd5f2 100644 --- a/bochs/cpu/avx/avx512_bf16.cc +++ b/bochs/cpu/avx/avx512_bf16.cc @@ -38,7 +38,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VCVTNEPS2BF16_MASK_Vbf16WpsR(bxInstruction dst.clear(); Bit32u opmask = (i->opmask() != 0) ? BX_READ_16BIT_OPMASK(i->opmask()) : 0xffff; // mask according to fp32 source - opmask &= (1 << DWORD_ELEMENTS(len)) - 1; + opmask &= CUT_OPMASK_TO(DWORD_ELEMENTS(len)); for (unsigned n=0, mask = 0x1; n < DWORD_ELEMENTS(len); n++, mask <<= 1) { if (opmask & mask) diff --git a/bochs/cpu/avx/avx512_cvt.cc b/bochs/cpu/avx/avx512_cvt.cc index 4ec4320d0..b811981e1 100644 --- a/bochs/cpu/avx/avx512_cvt.cc +++ b/bochs/cpu/avx/avx512_cvt.cc @@ -882,7 +882,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VCVTPS2PH_MASK_WpsVpsIbM(bxInstruction_c * status.float_rounding_mode = control & 0x3; Bit32u opmask = BX_READ_16BIT_OPMASK(i->opmask()); - opmask &= (1 << DWORD_ELEMENTS(len)) - 1; + opmask &= CUT_OPMASK_TO(DWORD_ELEMENTS(len)); for (unsigned n=0, mask = 0x1; n < DWORD_ELEMENTS(len); n++, mask <<= 1) { if (opmask & mask)