Skip to content

Miscompilation of asm("{cntlz|cntlzw} %0, %1" ...) on PowerPC #1467

@isanbard

Description

@isanbard
Bugzilla Link 1095
Resolution FIXED
Resolved on Feb 22, 2010 12:53
Version trunk
OS MacOS X

Extended Description

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.

-bw

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions