[LLVMdev] Codgen for popcnt intrinsic falls over on MacOSX

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Sat Oct 22 17:19:39 PDT 2011


On Sat, Oct 22, 2011 at 12:03 PM, David Peixotto <dmp at rice.edu> wrote:
> 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
> _______________________________________________

Have you tried "llc -filetype=obj ..."? The integrated assembler may
do the work!

Bruno Cardoso Lopes

More information about the llvm-dev mailing list