• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2target triple = "x86_64-pc-win32"
3
4declare i64 @llvm.x86.flags.read.u64()
5declare void @llvm.x86.flags.write.u64(i64)
6
7define i64 @read_flags() {
8entry:
9  %flags = call i64 @llvm.x86.flags.read.u64()
10  ret i64 %flags
11}
12
13; CHECK-LABEL: read_flags:
14; CHECK:      pushq   %rbp
15; CHECK:      .seh_pushreg 5
16; CHECK:      movq    %rsp, %rbp
17; CHECK:      .seh_setframe 5, 0
18; CHECK:      .seh_endprologue
19; CHECK-NEXT: pushfq
20; CHECK-NEXT: popq    %rax
21; CHECK-NEXT: popq    %rbp
22
23define void @write_flags(i64 %arg) {
24entry:
25  call void @llvm.x86.flags.write.u64(i64 %arg)
26  ret void
27}
28
29; CHECK-LABEL: write_flags:
30; CHECK:      pushq   %rbp
31; CHECK:      .seh_pushreg 5
32; CHECK:      movq    %rsp, %rbp
33; CHECK:      .seh_setframe 5, 0
34; CHECK:      .seh_endprologue
35; CHECK-NEXT: pushq   %rcx
36; CHECK-NEXT: popfq
37; CHECK-NEXT: popq    %rbp
38