• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2target triple = "i686-pc-win32"
3
4declare i32 @llvm.x86.flags.read.u32()
5declare void @llvm.x86.flags.write.u32(i32)
6
7define i32 @read_flags() {
8entry:
9  %flags = call i32 @llvm.x86.flags.read.u32()
10  ret i32 %flags
11}
12
13; CHECK-LABEL: _read_flags:
14; CHECK:      pushl   %ebp
15; CHECK-NEXT: movl    %esp, %ebp
16; CHECK-NEXT: pushfl
17; CHECK-NEXT: popl    %eax
18; CHECK-NEXT: popl    %ebp
19
20define x86_fastcallcc void @write_flags(i32 inreg %arg) {
21entry:
22  call void @llvm.x86.flags.write.u32(i32 %arg)
23  ret void
24}
25
26; CHECK-LABEL: @write_flags@4:
27; CHECK:      pushl   %ebp
28; CHECK-NEXT: movl    %esp, %ebp
29; CHECK-NEXT: pushl   %ecx
30; CHECK-NEXT: popfl
31; CHECK-NEXT: popl    %ebp
32