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]

How to set REX prefix when using RDRAND?


I'm not able to compile a program that uses `rdrand` and a word64 due
to "Error: operand size mismatch for `rdrand'". If I try to explicitly
use `rdrandq` and the word64, then it results in
"Error: invalid instruction suffix for `rdrand'"

According to the Intel manual [1], RDRAND operates on 32-bit operands
even in 64-bit mode. The manual goes onto to say we should use the REX
prefix to operate on 64-bit operands.

How do I set REX prefix when using RDRAND and the inline assembler?

Thanks in advance.

[1] Intel 64 and IA-32 Architectures Software Developerâs Manual,
Volume 2, page 4-298
(https://www-ssl.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf)


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