Could you point me where this part of "output side" is, or that flexibility does not exist yet in vkd3d and wined3d was used as an example to grab the idea from?
spirv_compiler_emit_load_reg() (and spirv_compiler_emit_swizzle() in particular) does this, but SPIR-V is perhaps a bit tedious in general. The Wine GLSL code does this in shader_glsl_add_src_param_ext() -> shader_glsl_get_swizzle() -> shader_glsl_swizzle_to_str(), and that's perhaps more straightforward to follow.