GCC (and clang) can definitely do it. We use it to write option ROMs in C in qemu. This code is compiled with the `-m16` option. This particular code references 32 bit registers using 66h prefix so wouldn't work on an 8086, but AFAIK that's not a general problem:
https://gitlab.com/qemu-project/qemu/-/blob/master/pc-bios/o...