blob: acae9ce89a898aa516d8b22caeec43cf59de1f4b [file] [edit]
# RUN: llc -mtriple=i686-- -passes=x86-insert-x87-wait -o - %s | FileCheck %s
--- |
define void @fnstenv(ptr %p) strictfp { ret void }
define void @fnsave(ptr %p) strictfp { ret void }
define void @dbg(ptr %p) strictfp !dbg !4 { ret void }
attributes #0 = { strictfp }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug)
!1 = !DIFile(filename: "x.c", directory: "/")
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "dbg", scope: !1, file: !1, line: 1, type: !6, unit: !0)
!5 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 1)
!6 = !DISubroutineType(types: !7)
!7 = !{null}
!8 = !DILocation(line: 1, scope: !4)
...
---
# fnstenv is non-waiting: WAIT must be inserted between the add and the store.
# CHECK-LABEL: name: fnstenv
# CHECK: ADD_Fp80
# CHECK-NEXT: WAIT
# CHECK-NEXT: FSTENVm
name: fnstenv
tracksRegLiveness: true
body: |
bb.0:
liveins: $eax
%0:gr32 = COPY $eax
%1:rfp80 = nofpexcept LD_Fp80m %0, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit $fpcw :: (load (s80))
%2:rfp80 = ADD_Fp80 %1, %1, implicit-def dead $fpsw, implicit $fpcw
FSTENVm %0, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit-def dead $fpcw, implicit $fpsw, implicit $fpcw :: (store (s256))
RET 0
...
---
# fnsave is non-waiting: WAIT must be inserted between the add and the store.
# CHECK-LABEL: name: fnsave
# CHECK: ADD_Fp80
# CHECK-NEXT: WAIT
# CHECK-NEXT: FSAVEm
name: fnsave
tracksRegLiveness: true
body: |
bb.0:
liveins: $eax
%0:gr32 = COPY $eax
%1:rfp80 = nofpexcept LD_Fp80m %0, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit $fpcw :: (load (s80))
%2:rfp80 = ADD_Fp80 %1, %1, implicit-def dead $fpsw, implicit $fpcw
FSAVEm %0, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit-def dead $fpcw, implicit $fpsw, implicit $fpcw :: (store (s256))
RET 0
...
---
# A waiting x87 successor synchronizes, so no WAIT after the first add; a
# DBG_VALUE in between must not change that.
# CHECK-LABEL: name: dbg
# CHECK: ADD_Fp80
# CHECK-NOT: WAIT
# CHECK: DBG_VALUE
# CHECK: ADD_Fp80
# CHECK-NEXT: WAIT
name: dbg
tracksRegLiveness: true
body: |
bb.0:
liveins: $eax
%0:gr32 = COPY $eax
%1:rfp80 = nofpexcept LD_Fp80m %0, 1, $noreg, 0, $noreg, implicit-def dead $fpsw, implicit $fpcw :: (load (s80))
%2:rfp80 = ADD_Fp80 %1, %1, implicit-def dead $fpsw, implicit $fpcw
DBG_VALUE %2, $noreg, !5, !DIExpression(), debug-location !8
%3:rfp80 = ADD_Fp80 %2, %1, implicit-def dead $fpsw, implicit $fpcw
RET 0
...