| View previous topic :: View next topic | |
| Author | Message |
|---|---|
| cancandodo Advanced Cheater Reputation: 0 Joined: 09 Mar 2012 Posts: 70 |
Post Posted: Sun Sep 28, 2025 10:37 pm Post subject: how to compare xmm0(double)>0 or <0 then jmp
Reply with quote
alloc(testpoint,10)
testpoint: registerSymbol(testpoint) db 0 0 0 0 0 0 0 0 ============= comisd xmm0,[testpoint] jg code can not work |
| Back to top | |
| ParkourPenguin I post too much Reputation: 152 Joined: 06 Jul 2014 Posts: 4710 |
Instead of `jg` (jump if greater) use `je` (jump if equal) or `jne` (jump if not equal). If the value is not equal to 0, then it's either greater than 0 or less than 0.
Also instead of `db 0 0 0 0 0 0 0 0` use `dq (double)0`. This is the same thing, but it's easier to read. _________________ |
| Back to top | |
| Csimbi I post too much Reputation: 97 Joined: 14 Jul 2007 Posts: 3326 |
Intel manual:
Quote: COMISD (All Versions)
RESULT := OrderedCompare(DEST[63:0] <> SRC[63:0]) { (* Set EFLAGS *) CASE (RESULT) OF UNORDERED: ZF,PF,CF := 111; GREATER_THAN: ZF,PF,CF := 000; LESS_THAN: ZF,PF,CF := 001; EQUAL: ZF,PF,CF := 100; ESAC; OF, AF, SF := 0; } I.e. Code: UNORDERED: ZF,PF,CF 111; jz/jp/jc
EQUAL: ZF,PF,CF 100; jz - covers UNORDERED, too. LESS_THAN: ZF,PF,CF 001; jc - covers UNORDERED, too. GREATER_THAN: ZF,PF,CF 000; jnc - covers UNORDERED, too. So, instead of je, jg, use these. You will always want to skip if parity, then you can use the others to do what you need to. |