optimization - assembly - x86_64 - predicates -
i coding assembly x86_64 , arm.
i know whether x86_64 has ways define branch predicates.
i searched in intel documentation failed find relevant info.
we have cmov
rather slow , cmp jmp
combo tends faster.
arm predicates alternative branches. idk mean "branch predicates". maybe mean "predicate conditions"?
cmov
worth compared branch skips on 1 or 2 instructions, if it's @ unpredictable. broadwell , skylake run cmov single uop, previous microarchitectures need 2 uops since has 3 input dependencies. creates data dependency instead of control dependency. branch prediction, when works, can better. also, cmov
can't take immediate operand, frustrating in many cases.
another instruction can use condition input setcc
. use xor reg,reg
/ set flags / setcc low-byte-of-reg
, avoid partial-reg stalls when reading full register.
for carry condition, sbb same,same
produce 0 or -1 (useful , mask), or adc reg, 0
reg += cf
.
Comments
Post a Comment