[LLVMdev] Codgen for popcnt intrinsic falls over on MacOSX
David Peixotto
dmp at rice.edu
Sat Oct 22 07:03:41 PDT 2011
I'm having a problem with the code generated for the popcnt intrinsic on MacOSX. The `llc` program will generate the assembly just fine, but the assembler fails with the error:
suffix or operands invalid for `popcnt'
The problem is that the mac assembler does not support length suffixes on the popcnt instruction (e.g. {w,l,q} suffixes). GCC handles this by not adding the suffixes to popcnt for darwin targets [1].
Indeed if I change the instruction definition in lib/Target/X86/X86InstrSSE.td to drop the suffix, then it works fine. I can submit a patch to that effect, but what is the proper way to handle this?
[1]: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34497#c14
More information about the llvm-dev
mailing list