Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
isanbard opened this issue Jan 8, 2007 · 2 comments
Closed

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

isanbard opened this issue Jan 8, 2007 · 2 comments
Labels
bugzilla Issues migrated from bugzilla llvm:core

Comments

@isanbard
Copy link
Contributor

isanbard commented Jan 8, 2007

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

@isanbard
Copy link
Contributor Author

isanbard commented Jan 8, 2007

This was found when trying to compile "gmp".

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
clementval pushed a commit to clementval/llvm-project that referenced this issue Feb 16, 2022
* Fix sigsegvs occuring when malloc'd memory is too small.

* Was not stripping the fir.heap type correctly.

* Fix typo in comment.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla llvm:core
Projects
None yet
Development

No branches or pull requests

1 participant