3 ms·
I am currently coding x86_64 and I am trying to favor as much as reasonably possible "non-predicted branch"/"branchless" code paths. Setcc and cmovcc instructio
by sylware 3y ago
I am currently coding x86_64 and I am trying to favor as much as reasonably possible "non-predicted branch"/"branchless" code paths. Setcc and cmovcc instructions are really usefull, even though if I can think of real "branchless" algorithms, I will favor them.
x86_64 assembly for me is just the transition step before the actual RISC-V jump. This is "register-ization" of some code paths. Once done, it is kind of easy to do a port to another modern ISA. Bu then, I am thinking about all that branch prediction on RISC-V:
Will we have a way to hint a core/hart to dodge prediction for some branches, fine-grained and "cleanly"? I was thinking about implicit branch prediction exclusion via some "known" instruction fusions, but the 'implicit' here is scary.
- celeritascelery 3y ago> Will we have a way to hint a core/hart to dodge prediction for some branches, fine-grained and "cleanly"? Why would you want to avoid the branch predictor? All it can do is speedup your code.
- sylware 3y agoIf I did understand properly, in code paths with many branches near from each other, it would help to hint the predictor about which ones are not worth it.