I haven't done it, but I'm pretty sure all the e36 motors will swap, even M44's. Unless you want to get creative, knock sensors won't work, and you'll have to swap the DISA intake manifold for your stock e30 one. Oil pans are different too, swap the old one over. Later models had serpentine belt drive, you might be able to use them as-is or replace the pulleys for the stock e30 v-belt setup.
Later ones had the improved timing chain deflector rail and tensioner as well. The M42 was installed up to '96 IIRC.