OK, I see. It's better to avoid clobbering ebx.

On Mon, Jul 21, 2014 at 5:39 PM, Reid Kleckner <[email protected]> wrote:

> This is http://llvm.org/PR20311.  IMO a better fix is to use the "=SD"
> constraint on %1, since ebx isn't really clobbered here.
>
> Also, we should probably be checking for PIC defines.
>
> Also, the bug in __cpu_count should be fixed.
>
>
> On Mon, Jul 21, 2014 at 3:45 PM, Akira Hatanaka <[email protected]>
> wrote:
>
>> 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.
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> [email protected]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to