diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index 5d32fb8f68e..b912949d482 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -3673,6 +3673,14 @@ let Uses = [ECX, EAX] in def MWAITrr : I<0x01, MRM_C9, (outs), (ins), "mwait", []>, TB, Requires<[HasSSE3]>; +def : InstAlias<"mwait %eax, %ecx", (MWAITrr)>, Requires<[In32BitMode]>; +def : InstAlias<"mwait %rax, %rcx", (MWAITrr)>, Requires<[In64BitMode]>; + +def : InstAlias<"monitor %eax, %ecx, %edx", (MONITORrrr)>, + Requires<[In32BitMode]>; +def : InstAlias<"monitor %rax, %rcx, %rdx", (MONITORrrr)>, + Requires<[In64BitMode]>; + //===---------------------------------------------------------------------===// // Non-Instruction Patterns //===---------------------------------------------------------------------===// diff --git a/test/MC/X86/x86-32.s b/test/MC/X86/x86-32.s index 9ff5accf194..de6b96389ea 100644 --- a/test/MC/X86/x86-32.s +++ b/test/MC/X86/x86-32.s @@ -14,9 +14,15 @@ // CHECK: encoding: [0x0f,0xae,0xf0] monitor // CHECK: monitor +// CHECK: encoding: [0x0f,0x01,0xc8] + monitor %eax, %ecx, %edx +// CHECK: monitor // CHECK: encoding: [0x0f,0x01,0xc8] mwait // CHECK: mwait +// CHECK: encoding: [0x0f,0x01,0xc9] + mwait %eax, %ecx +// CHECK: mwait // CHECK: encoding: [0x0f,0x01,0xc9] vmcall diff --git a/test/MC/X86/x86-64.s b/test/MC/X86/x86-64.s index ed3162c0a98..b1fc9accfd1 100644 --- a/test/MC/X86/x86-64.s +++ b/test/MC/X86/x86-64.s @@ -2,6 +2,18 @@ // RUN: FileCheck < %t %s // RUN: FileCheck --check-prefix=CHECK-STDERR < %t.err %s + monitor +// CHECK: monitor +// CHECK: encoding: [0x0f,0x01,0xc8] + monitor %rax, %rcx, %rdx +// CHECK: monitor +// CHECK: encoding: [0x0f,0x01,0xc8] + mwait +// CHECK: mwait +// CHECK: encoding: [0x0f,0x01,0xc9] + mwait %rax, %rcx +// CHECK: mwait +// CHECK: encoding: [0x0f,0x01,0xc9] // Suffix inference: