I did a brief look through AVX512 instructions to look for a solution, and unfortunatley, it seems we both may have been overthinking this.
vpcompressb more or less does the job in one instruction. Agner Fog doesn't have a latency listed however.
---------
My search methodology was basically this: https://software.intel.com/sites/landingpage/IntrinsicsGuide...
Search for __m512i (integer-based ZMM registers), with the category "swizzle" (which includes permute, insert, and other such instructions). I figure any potential AVX512 instruction would be a "Swizzle" style instruction.
-------
Note: I originally responded to the wrong location in this thread. I copy/pasted my text to here, which is where I originally intended to respond.