Handles SARX, SHLX, and SHRX
| 1789 | |
| 1790 | // Handles SARX, SHLX, and SHRX |
| 1791 | void 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 | |
| 1816 | void OpDispatchBuilder::BZHI(OpcodeArgs) { |
| 1817 | const auto Size = OpSizeFromSrc(Op); |