[cfe-users] Does Integrated Assembler need Output Operands listed as Clobbered?

Jeffrey Walton via cfe-users cfe-users at lists.llvm.org
Fri Jan 29 11:47:36 PST 2016


We have a user reporting a crash under Apple's Clang 7.0.2. The code is:

       __asm__ volatile(
#if BOOL_X64 || BOOL_X32
    ".byte 0x48, 0x0f, 0xc7, 0xf0;\n"  // rdrand rax
#else
    ".byte 0x0f, 0xc7, 0xf0;\n"        // rdrand eax
#endif
    "setc %1; "
    : "=a" (val), "=qm" (rc)
    :
    : "cc"
        );

The byte instructions are the op-codes for 'rdrand' instruction. Apple
Clang was late to provide them, so we have an implementation
regardless of downlevel compilers. They are also available for
downlevel GCC compilers in a hosted environment where the iron
provides a modern CPU.

The same user reports adding EAX or RAX as a clobber clears the issue.

Does Clang's Integrated Assembler need Output Operands listed as Clobbered?

Thanks in advance.



More information about the cfe-users mailing list