MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / BMI2Shift

Method BMI2Shift

FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp:1791–1814  ·  view source on GitHub ↗

Handles SARX, SHLX, and SHRX

Source from the content-addressed store, hash-verified

1789
1790// Handles SARX, SHLX, and SHRX
1791void OpDispatchBuilder::BMI2Shift(OpcodeArgs) {
1792 // In the event the source is a memory operand, use the
1793 // exact width instead of the GPR size.
1794 const auto GPRSize = GetGPROpSize();
1795 const auto Size = OpSizeFromSrc(Op);
1796 const auto SrcSize = Op->Src[0].IsGPR() ? GPRSize : Size;
1797
1798 auto* Src = LoadSource_WithOpSize(GPRClass, Op, Op->Src[0], SrcSize, Op->Flags);
1799 auto* Shift = LoadSource_WithOpSize(GPRClass, Op, Op->Src[1], GPRSize, Op->Flags, {.AllowUpperGarbage = true});
1800
1801 Ref Result;
1802 if (Op->OP == 0x6F7) {
1803 // SARX
1804 Result = _Ashr(Size, Src, Shift);
1805 } else if (Op->OP == 0x5F7) {
1806 // SHLX
1807 Result = _Lshl(Size, Src, Shift);
1808 } else {
1809 // SHRX
1810 Result = _Lshr(Size, Src, Shift);
1811 }
1812
1813 StoreResult(GPRClass, Op, Result, OpSize::iInvalid);
1814}
1815
1816void OpDispatchBuilder::BZHI(OpcodeArgs) {
1817 const auto Size = OpSizeFromSrc(Op);

Callers

nothing calls this directly

Calls 1

IsGPRMethod · 0.45

Tested by

no test coverage detected