[LLVMbugs] [Bug 1095] NEW: Miscompilation of asm("{cntlz|cntlzw} %0, %1" ...) on PowerPC

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jan 7 14:45:03 PST 2007


           Summary: Miscompilation of asm("{cntlz|cntlzw} %0, %1" ...) on
           Product: new-bugs
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: isanbard at gmail.com

On my PowerBook G4, compiling this program:

#include <stdio.h>

int main()
  unsigned long int ctz_x = 0x0000f000;
  unsigned long int ctz_c;

  __asm__("{cntlz|cntlzw} %0,%1"
          : "=r" (ctz_c)
          : "r" (ctz_x & -ctz_x));

  printf("ctz_c == %d\n", ctz_c);
  return 0;

results in the use of the mnemonic "cntlz" instead of "cntlzw". This produces an error when trying to 
assemble the program:

  cntlzw_miscompile.s:25:Invalid mnemonic 'cntlz'

GCC outputs "cntlzw" instead.


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list