[LLVMdev] Codgen for popcnt intrinsic falls over on MacOSX
David Peixotto
dmp at rice.edu
Mon Oct 24 07:43:49 PDT 2011
On Oct 22, 2011, at 7:19 PM, Bruno Cardoso Lopes wrote:
> Hi,
>
> 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!
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.
More information about the llvm-dev
mailing list