This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proper use of x86/x86_64 CPUID instruction with extended assembler


>> According to Assembler Templates
>> (https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#AssemblerTemplate),
>> the save of the EBX register and the call to CPUID can be reordered,
>> even with volatile.
>
> No, it doesn't say that.  It says that asm statements may not be
> consecutive.  This is one asm statement.
>
Thanks Andrew. I parsed this incorrectly (I managed to invert it):

    Do not expect a sequence of asm statements to remain
    perfectly consecutive after compilation, even when you
    are using the volatile qualifier. If certain instructions need
    to remain consecutive in the output, put them in a single
    multi-instruction asm statement.

Sorry about that.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]