I don't really know what I'm talking about here, but after reading that my first though is: "Shouldn't we check that `idx_count` is not already three? And shouldn't we zero `idx[0]`?".
We shouldn't zero idx[0] here; duplicating it is the intended behaviour. It's true that this code could be a bit more robust, although that's not an issue introduced by this series, and probably best addressed by extending the index count validation code to cover the affected register types.
I think that's correct, but quite fragile: as soon as, for any reason, `sm4_index_range_array` is modified in a way that causes it to have some padding, the compare might break.
Yeah.