diff options
author | Ashutosh Nema <ashu1212@gmail.com> | 2016-05-18 11:59:12 +0000 |
---|---|---|
committer | Ashutosh Nema <ashu1212@gmail.com> | 2016-05-18 11:59:12 +0000 |
commit | 348af9cc6b448d739465de991cc0caf032af0eb9 (patch) | |
tree | 4b9c7faed9c512f32c27d6f104e856957ca83801 /llvm/lib/Target/X86/X86ISelLowering.cpp | |
parent | e64e230decbdaa2eab8699641476de9897ce5080 (diff) | |
download | bcm5719-llvm-348af9cc6b448d739465de991cc0caf032af0eb9.tar.gz bcm5719-llvm-348af9cc6b448d739465de991cc0caf032af0eb9.zip |
Add new flag and intrinsic support for MWAITX and MONITORX instructions
Summary:
MONITORX/MWAITX 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.
These instructions are enabled for AMD's bdver4 architecture.
Patch by Ganesh Gopalasubramanian!
Reviewers: echristo, craig.topper, RKSimon
Subscribers: RKSimon, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D19795
llvm-svn: 269911
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 1e3b5225bf6..368e265f8e5 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -22349,7 +22349,8 @@ static MachineBasicBlock *emitRDPKRU(MachineInstr *MI, MachineBasicBlock *BB, } static MachineBasicBlock *emitMonitor(MachineInstr *MI, MachineBasicBlock *BB, - const X86Subtarget &Subtarget) { + const X86Subtarget &Subtarget, + unsigned Opc) { DebugLoc dl = MI->getDebugLoc(); const TargetInstrInfo *TII = Subtarget.getInstrInfo(); // Address into RAX/EAX, other two args into ECX, EDX. @@ -22366,7 +22367,7 @@ static MachineBasicBlock *emitMonitor(MachineInstr *MI, MachineBasicBlock *BB, .addReg(MI->getOperand(ValOps+1).getReg()); // The instruction doesn't actually take any operands though. - BuildMI(*BB, MI, dl, TII->get(X86::MONITORrrr)); + BuildMI(*BB, MI, dl, TII->get(Opc)); MI->eraseFromParent(); // The pseudo is gone now. return BB; @@ -23867,7 +23868,9 @@ X86TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI, // Thread synchronization. case X86::MONITOR: - return emitMonitor(MI, BB, Subtarget); + return emitMonitor(MI, BB, Subtarget, X86::MONITORrrr); + case X86::MONITORX: + return emitMonitor(MI, BB, Subtarget, X86::MONITORXrrr); // PKU feature case X86::WRPKRU: return emitWRPKRU(MI, BB, Subtarget); |