You either write an entire separate asm function, or use macro utilities to ifdef portions of the function. See for example: https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavcod...
Re:Introducing Dav1d: a new AV1 decoder
by Retr0spectrum on Monday October 01, 2018 @04:10PM
(#18116366)
I would imagine they write separate asm for x86, x86_64, and the various instruction set extensions that exist.
A project may even go so far as to write different asm for the same ISA for different architectures in order to optimize for specific pipeline behavior or whatnot
Or do you actually write separate asm for x86 and x86_64?