The attached patch fixes a bug where the __ebx output is clobbered.
Currently, clang generates the following code when cpuid.c in the test case
is compiled:

$ clang cpuid.c -O3 -S -o -

## InlineAsm Start

pushl  %ebx      # save %ebx before cpuid clobbers it.

cpuid

mov    %ebx,%ebx # move the __ebx output to %ebx.

popl   %ebx      # pop saved %ebx. Clobbers __ebx output.

## InlineAsm End

This happens because register '"ebx" is chosen for operand %1 which has
constraint "=r". The attached patch adds %ebx to the clobber list to
prevent this from happening.

Attachment: cpuid1.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to