This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How to set REX prefix when using RDRAND?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 12 Oct 2015 04:34:01 -0400
- Subject: How to set REX prefix when using RDRAND?
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
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)