FA-89527 / Instruction set emulation / Member archive
Signed comparison ignores overflow · case 02
ge gives the wrong answer when the subtraction overflowed.
Case contract
Input [cond]. Evaluate the condition for all 16 flag states, ordered as NZCV from 0000 to 1111 (N is the most significant), returning 1/0. eq Z; ne !Z; cs C; cc !C; mi N; pl !N; vs V; vc !V; hi C and !Z; ls !C or Z; ge N==V; lt N!=V; gt !Z and N==V; le Z or N!=V; al always. Carry here is set when an unsigned subtraction did not borrow.
Why this case matters
Predicated execution in ARM-style emulators depends on exact condition predicates; unsigned conditions are easily confused with ISAs where carry means borrow.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| condition ge over all flags | [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0] | [1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗