[PATCH] D19796: Add new intrinsic support for MONITORX and MWAITX instructions.

Ganesh Gopalasubramanian via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 00:22:36 PDT 2016


GGanesh created this revision.
GGanesh added reviewers: echristo, craig.topper.
GGanesh added subscribers: cfe-commits, llvm-commits.
Herald added a subscriber: joker.eph.

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.

http://reviews.llvm.org/D19796

Files:
  include/clang/Basic/BuiltinsX86.def
  include/clang/Driver/Options.td
  lib/Basic/Targets.cpp
  lib/Headers/CMakeLists.txt
  lib/Headers/module.modulemap
  lib/Headers/mwaitxintrin.h
  lib/Headers/x86intrin.h
  test/CodeGen/builtins-x86.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19796.55788.patch
Type: text/x-patch
Size: 6538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160502/4e63ceca/attachment-0001.bin>


More information about the cfe-commits mailing list