Page MenuHomePhabricator

Add new intrinsic support for MONITORX and MWAITX instructions.

Authored by GGanesh on May 2 2016, 12:22 AM.



This patch adds new intrinsics, new flag (-mwaitx) and flag enablement based on cpuid for the instructions MONITORX and MWAITX. Testcases that tests the intrinsics which uses the flag are also added.

These instructions provide similar capability to the MONITOR/MWAIT pair while adding a timer function, such that another termination of the MWAITX instruction occurs when the timer expires. The presence of the MONITORX and MWAITX instructions is indicated by CPUID 8000_0001, ECX, bit 29.

The MONITORX and MWAITX instructions are intercepted by the same bits that intercept MONITOR and MWAIT. MONITORX instruction establishes a range to be monitored. MWAITX instruction causes the processor to stop instruction execution and enter an implementation-dependent optimized state until occurrence of a class of events.

Opcode of MONITORX instruction is "0F 01 FA". Opcode of MWAITX instruction is "0F 01 FB". These opcode information is used in adding tests for the disassembler.

Diff Detail


Event Timeline

GGanesh updated this revision to Diff 55788.May 2 2016, 12:22 AM
GGanesh retitled this revision from to Add new intrinsic support for MONITORX and MWAITX instructions..
GGanesh updated this object.
GGanesh added reviewers: echristo, craig.topper.
GGanesh added subscribers: cfe-commits, llvm-commits.
RKSimon added a subscriber: RKSimon.May 9 2016, 5:58 AM
echristo accepted this revision.May 9 2016, 3:36 PM
echristo edited edge metadata.




This revision is now accepted and ready to land.May 9 2016, 3:36 PM
This revision was automatically updated to reflect the committed changes.