1; RUN: llc < %s -mtriple=x86_64-linux -mattr=+mwaitx | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+mwaitx | FileCheck %s -check-prefix=WIN64
3; RUN: llc < %s -mtriple=x86_64-linux -mcpu=bdver4 | FileCheck %s
4; RUN: llc < %s -mtriple=x86_64-win32 -mcpu=bdver4 | FileCheck %s -check-prefix=WIN64
5
6; CHECK-LABEL: foo:
7; CHECK: leaq    (%rdi), %rax
8; CHECK-NEXT: movl    %esi, %ecx
9; CHECK-NEXT: monitorx
10; WIN64-LABEL: foo:
11; WIN64:      leaq    (%rcx), %rax
12; WIN64-NEXT: movl    %edx, %ecx
13; WIN64-NEXT: movl    %r8d, %edx
14; WIN64-NEXT: monitorx
15define void @foo(i8* %P, i32 %E, i32 %H) nounwind {
16entry:
17  tail call void @llvm.x86.monitorx(i8* %P, i32 %E, i32 %H)
18  ret void
19}
20
21declare void @llvm.x86.monitorx(i8*, i32, i32) nounwind
22
23; CHECK-LABEL: bar:
24; CHECK: movl    %edi, %ecx
25; CHECK-NEXT: movl    %esi, %eax
26; CHECK-NEXT: movl    %edx, %ebx
27; CHECK-NEXT: mwaitx
28; WIN64-LABEL: bar:
29; WIN64:      movl    %edx, %eax
30; WIN64:      movl    %r8d, %ebx
31; WIN64-NEXT: mwaitx
32define void @bar(i32 %E, i32 %H, i32 %C) nounwind {
33entry:
34  tail call void @llvm.x86.mwaitx(i32 %E, i32 %H, i32 %C)
35  ret void
36}
37
38declare void @llvm.x86.mwaitx(i32, i32, i32) nounwind
39