https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83618
Bug ID: 83618 Summary: _rdpid_u32 doesn't work on 64-bit targets as gas expects the 64-bit register Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: craig.topper at gmail dot com Target Milestone: --- Trying to compile the _rdpid_u32 intrinsic on x86-64 causes the assembler to print this /tmp/ccbdTr5q.s: Assembler messages: /tmp/ccbdTr5q.s:13: Error: operand type mismatch for `rdpid' It appears that the assembler expects a 64-bit register in 64-bit mode. This seems to be due to an odd quirk of Intel's documentation that says the instruction writes a 64-bit register in 64-bit mode and a 32-bit register in 32-bit mode. But in reality its reading the TSC_AUX_MSR which is only 32-bit so I suspect it always zeros the upper bits of the register in 64-bit mode. Which would be the expected behavior if it had been documented as always using a 32-bit register. So I don't know why the docs made this distinction. Not sure if this should be fixed in gcc or if gas should be taught to accept both a 32-bit or 64-bit register.