nak: Add an OpPrmt optimization
Given how much OpPrmt we're throwing around for everything from integer conversions to nir_op_extract_*
to swizzling, it would be really good if we had an optimization that could see combine OpPrmt
. Basically, we're talking about a per-byte copy propagation pass. If the source of an OpPrmt is another OpPrmt, see if we can fold the one into the other. For instance:
%2 = prmt %0 0x5410 %1
%3 = prmt %2 0x4432 0
should turn into
%3 = prmt %1 0x4410 0
This is pretty similar to the swizzle-of-swizzle optimzations that NIR does, only on bytes and in the back-end, which always makes things more interesting.