Optimized instruction generation and stem width allocation