Page MenuHomePhabricator

[X86] Add intrinsic support for the RDPID instruction
ClosedPublic

Authored by craig.topper on Jan 17 2018, 3:24 PM.

Details

Summary

This adds a new instrinsic to support the rdpid instruction. The implementation is a bit weird because the intrinsic is defined as always returning 32-bits, but the assembler support thinks the instruction produces a 64-bit register in 64-bit mode. But really it zeros the upper 32 bits. So I had to add separate patterns where 64-bit mode uses an extract_subreg.

Clang patch will follow.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Jan 17 2018, 3:24 PM
zvi added a subscriber: zvi.Jan 17 2018, 10:55 PM

Add some basic encoding tests?

I think we already have the encoding tests for the assembler and disassembler. The instructions were already present before this patch.

Context in the diff?

Once more with context

RKSimon accepted this revision.Jan 18 2018, 2:09 PM

LGTM with one (very) minor

lib/Support/Host.cpp
1260 ↗(On Diff #130441)

Revert spacing change to keep = aligned.

This revision is now accepted and ready to land.Jan 18 2018, 2:09 PM
craig.topper added inline comments.Jan 18 2018, 2:20 PM
lib/Support/Host.cpp
1260 ↗(On Diff #130441)

I unaligned it because its checking EDX and the lines above are checking ECX. And the EBX lines above that have a different alignment.

While not paying attention previously I accidentally put the ibt line with the ECX lines as you can see in the before here. I was trying to discourage accidentally doing that again.

RKSimon added inline comments.Jan 18 2018, 2:25 PM
lib/Support/Host.cpp
1260 ↗(On Diff #130441)

OK fair enough - LGTM

This revision was automatically updated to reflect the committed changes.