Tracking Issue for hint::select_unpredictable · Issue #133962 · rust-lang/rust (original) (raw)

Feature gate: #![feature(select_unpredictable)]

This is a tracking issue for hint::select_unpredictable, which selects between two values and hints to the optimizer that it should try to generate branchless code.

Public API

// core::hint

/// Returns either true_val or false_val depending on the value of /// b, with a hint to the compiler that condition is unlikely /// to be correctly predicted by a CPU’s branch predictor. pub fn select_unpredictable(b: bool, true_val: T, false_val: T) -> T;

Steps / History

Unresolved Questions

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html