Codgen for popcnt intrinsic falls over on MacOSX

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

Hi,

Yes, I believe the integrated assembler gets it right, but unfortunately I'm using a toolchain that needs to use the mac assembler so I'd like to get it working with that if possible.

Removing the suffix seems to work ok, I just need to know if it needs to be done conditionally for mac os x to get the patch accepted, and if so how to do that.