Codegen: Matrixslice support

On top of #8082, this will fix #8093