News for hackers. Stuff that matters.
Re:AMD's Zen 6 Family: Feeding the Beast by josephg on Tuesday November 10, 2026 @05:11PM (#50447003)
You've got it the wrong way around. If the branch predictor was 100% accurate, branchless code would have no performance benefit compared to branching code.

> X86 should support no-branch-predict-if

It almost does. You can use __builtin_expect to hint if the branch is predictable - like assertions. Don't annotate conditionals if they're truly unpredictable. The branch predictor will run, but it's not expensive.

Re:AMD's Zen 6 Family: Feeding the Beast by kevin_thibedeau on Tuesday November 10, 2026 @05:23PM (#50447144)
You should prefer using the standardized likely/unlikely attributes instead.
Re:AMD's Zen 6 Family: Feeding the Beast by nukanse on Wednesday November 11, 2026 @02:08AM (#50450517)
Branchless programming is a thing because those don't work, and branch prediction hurts performance on many cases