1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-linux -mattr=+mwaitx | FileCheck %s
3; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+mwaitx | FileCheck %s -check-prefix=WIN64
4; RUN: llc < %s -mtriple=x86_64-linux -mcpu=bdver4 | FileCheck %s
5; RUN: llc < %s -mtriple=x86_64-win32 -mcpu=bdver4 | FileCheck %s -check-prefix=WIN64
6
7define void @foo(i8* %P, i32 %E, i32 %H) nounwind {
8; CHECK-LABEL: foo:
9; CHECK:       # %bb.0: # %entry
10; CHECK-NEXT:    movl %esi, %ecx
11; CHECK-NEXT:    movq %rdi, %rax
12; CHECK-NEXT:    monitorx
13; CHECK-NEXT:    retq
14;
15; WIN64-LABEL: foo:
16; WIN64:       # %bb.0: # %entry
17; WIN64-NEXT:    movq %rcx, %rax
18; WIN64-NEXT:    movl %edx, %ecx
19; WIN64-NEXT:    movl %r8d, %edx
20; WIN64-NEXT:    monitorx
21; WIN64-NEXT:    retq
22entry:
23  tail call void @llvm.x86.monitorx(i8* %P, i32 %E, i32 %H)
24  ret void
25}
26
27declare void @llvm.x86.monitorx(i8*, i32, i32) nounwind
28
29define void @bar(i32 %E, i32 %H, i32 %C) nounwind {
30; CHECK-LABEL: bar:
31; CHECK:       # %bb.0: # %entry
32; CHECK-NEXT:    pushq %rbx
33; CHECK-NEXT:    movl %edx, %ebx
34; CHECK-NEXT:    movl %esi, %eax
35; CHECK-NEXT:    movl %edi, %ecx
36; CHECK-NEXT:    mwaitx
37; CHECK-NEXT:    popq %rbx
38; CHECK-NEXT:    retq
39;
40; WIN64-LABEL: bar:
41; WIN64:       # %bb.0: # %entry
42; WIN64-NEXT:    pushq %rbx
43; WIN64-NEXT:    movl %r8d, %ebx
44; WIN64-NEXT:    movl %edx, %eax
45; WIN64-NEXT:    mwaitx
46; WIN64-NEXT:    popq %rbx
47; WIN64-NEXT:    retq
48entry:
49  tail call void @llvm.x86.mwaitx(i32 %E, i32 %H, i32 %C)
50  ret void
51}
52
53declare void @llvm.x86.mwaitx(i32, i32, i32) nounwind
54