So I have a comptime lookup table of 256 shuffle masks. At runtime, I calculate a u8 to index into this table and select the correct mask. The only way I've found to do this is with an inline switch:
const result = switch (code) {
inline else => |c| @shuffle(..., ..., ..., masks[c]),
};
The problem is, this generates a jump table which I'm guessing makes the branch predictor very mad indeed...
Is there any way to work around this without hand-rolling inline asm intrinsics for each instruction set?