Skip to content

Commit

Permalink
OpcodeDispatcher: explain why we provide defined bsf behaviour
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Rosenzweig <[email protected]>
  • Loading branch information
alyssarosenzweig committed Oct 22, 2024
1 parent 9c605e7 commit 58a3d17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3726,7 +3726,11 @@ void OpDispatchBuilder::BSFOp(OpcodeArgs) {
// ZF is set to 1 if the source was zero
SetZ_InvalidateNCV(OpSizeFromSrc(Op), Src);

// If Src was zero then the destination doesn't get modified
// If Src was zero then the destination doesn't get modified.
//
// Although Intel does not guarantee that semantic, AMD does and Intel
// hardware satisfies it. We provide the stronger AMD behaviour as
// applications might rely on that in the wild.
auto SelectOp = NZCVSelect(IR::SizeToOpSize(GPRSize), {COND_EQ}, Dest, Result);
StoreResult_WithOpSize(GPRClass, Op, Op->Dest, SelectOp, DstSize, -1);
}
Expand Down

0 comments on commit 58a3d17

Please sign in to comment.