Optimize CDQOp

This commit is contained in:
Paulo Matos 2024-01-29 15:12:20 +00:00
parent ca31a0404c
commit 027fbbf051

View File

@ -1395,11 +1395,12 @@ void OpDispatchBuilder::XCHGOp(OpcodeArgs) {
}
void OpDispatchBuilder::CDQOp(OpcodeArgs) {
OrderedNode *Src = LoadSource(GPRClass, Op, Op->Src[0], Op->Flags);
uint8_t DstSize = GetDstSize(Op);
uint8_t SrcSize = DstSize >> 1;
OrderedNode *Src = LoadGPRRegister(X86State::REG_RAX, SrcSize, 0, true);
Src = _Sbfe(OpSize::i64Bit, SrcSize * 8, 0, Src);
Src = _Sbfe(DstSize <= 4 ? OpSize::i32Bit : OpSize::i64Bit, SrcSize * 8, 0,
Src);
StoreResult_WithOpSize(GPRClass, Op, Op->Dest, Src, DstSize, -1);
}