Massaging the Shader Compiler to emit Optimum Instructions

Modern GPU s feature sophisticated instruction sets for executing shaders. However this blog details how difficult and unintuiative it can be to have the shader compiler leverage the optimum instruction. Consider the simple example of swapping the endian of a 32bit word. (Something that was common on the PlayStation3 in particular) Below are 5 different HLSL [ ]