mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-08 13:00:43 +00:00
60cefca131
We modeled the RDFLAGS{32,64} operations as "using" {E,R}FLAGS. While technically correct, this is not be desirable for folks who want to examine aspects of the FLAGS register which are not related to computation like whether or not CPUID is a valid instruction. Differential Revision: http://reviews.llvm.org/D17782 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262465 91177308-0d34-0410-b5e6-96231b3b80d8
38 lines
890 B
LLVM
38 lines
890 B
LLVM
; RUN: llc -verify-machineinstrs < %s | FileCheck %s
|
|
target triple = "x86_64-pc-win32"
|
|
|
|
declare i64 @llvm.x86.flags.read.u64()
|
|
declare void @llvm.x86.flags.write.u64(i64)
|
|
|
|
define i64 @read_flags() {
|
|
entry:
|
|
%flags = call i64 @llvm.x86.flags.read.u64()
|
|
ret i64 %flags
|
|
}
|
|
|
|
; CHECK-LABEL: read_flags:
|
|
; CHECK: pushq %rbp
|
|
; CHECK: .seh_pushreg 5
|
|
; CHECK: movq %rsp, %rbp
|
|
; CHECK: .seh_setframe 5, 0
|
|
; CHECK: .seh_endprologue
|
|
; CHECK-NEXT: pushfq
|
|
; CHECK-NEXT: popq %rax
|
|
; CHECK-NEXT: popq %rbp
|
|
|
|
define void @write_flags(i64 %arg) {
|
|
entry:
|
|
call void @llvm.x86.flags.write.u64(i64 %arg)
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: write_flags:
|
|
; CHECK: pushq %rbp
|
|
; CHECK: .seh_pushreg 5
|
|
; CHECK: movq %rsp, %rbp
|
|
; CHECK: .seh_setframe 5, 0
|
|
; CHECK: .seh_endprologue
|
|
; CHECK-NEXT: pushq %rcx
|
|
; CHECK-NEXT: popfq
|
|
; CHECK-NEXT: popq %rbp
|