This is part of the ongoing attempt to improve select codegen for all targets and select canonicalization in IR (see D24480 for more background).
The transform is a subset of what is done in InstCombine's FoldOpIntoSelect().
I first noticed a regression in the x86 avx512-insert-extract.ll tests with a patch that hopes to convert more selects to basic math ops. This appears to be a general missing DAG transform though, so I added tests for all standard binops in rL296621 (PowerPC was chosen semi-randomly; it has scripted FileCheck support, but so do ARM and x86).
The debug output for "sel_constants_shl_constant" makes me think that this patch is not at fault for that mess. The shl fold happens as expected. PPC then changes the i8 select to an i32 select, but the return value is i64, so the extend gets folded in creating an i64 select. I noticed this problem in a lesser form in D30180; it's why there weren't more improvements for PPC with that patch.