Go's 6a assembler has conditional jump instructions:
JCC
JCS
JCXZL
JEQ
JGE
JGT
JHI
JLE
JLS
JLT
JMI
JNE
JOC
JOS
JPC
JPL
JPS
But how do they map to x86 conditional jumps?
A conditional jump instruction, like "je" (jump-if-equal), does a goto somewhere if the two values satisfy the right condition. For example, if the values are equal, subtracting them results in zero, so "je" is the same as "jz".
The conditional instructions transfer the control by breaking the sequential flow and they do it by changing the offset value in IP.
conditional jump (conditional branch) A jump that takes place only if a specified condition holds, e.g. specified register contents zero, nonzero, negative, etc. A Dictionary of Computing. "conditional jump ."
I'm answering this so I don't lose the information, and so other people don't have to go through the same sleuthing game as me. Looking at optab.c and the x86 jumps we can match up the instruction encodings to solve the puzzle.
JCC JAE
JCS JB
JCXZL JECXZ
JEQ JE,JZ
JGE JGE
JGT JG
JHI JA
JLE JLE
JLS JBE
JLT JL
JMI JS
JNE JNE, JNZ
JOC JNO
JOS JO
JPC JNP, JPO
JPL JNS
JPS JP, JPE
The Go assembler's arch.go says:
instructions["JA"] = x86.AJHI
instructions["JAE"] = x86.AJCC
instructions["JB"] = x86.AJCS
etc
which means that Go asm's JHI means Intel asm's JA, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With