A select instruction checks each thread’s condition and keeps one of two results. Unlike a branch, it does not split the warp. Compilers may use it for short branches, especially when both paths are cheap and do not write to memory; otherwise, computing both results may waste work. section 14.3
// Branchless: compute both, select int sum = a + b; #A int diff = a - b; result = condition ? sum : diff; #B
This branchless example computes both arithmetic results, then uses the condition to select one. section 14.3
