This prepares codegen for a change that will remove the identical folds from IR because they are not poison-safe. See D93065 / D97360 for details.
We already generically support scalar types, and there are various target-specific transforms that overlap the vector folds. For example, x86 recognizes the and patterns, but not or. We can end up with 1 extra instruction there, but I think that is still preferred over the blendv alternative that loads a constant vector.
Removing custom code can be a follow-up change.