reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
; RUN: opt < %s -analyze -branch-prob | FileCheck %s

; This function tests the floating point unorder comparison. The probability
; of NaN should be extremely small.
; CHECK: Printing analysis 'Branch Probability Analysis' for function 'uno'
; CHECK:  edge  -> a probability is 0x00000800 / 0x80000000 = 0.00%
; CHECK:  edge  -> b probability is 0x7ffff800 / 0x80000000 = 100.00% [HOT edge]

define void @uno(float %val1, float %val2) {
  %cond = fcmp uno float %val1, %val2
  br i1 %cond, label %a, label %b

a:
  call void @fa()
  ret void

b:
  call void @fb()
  ret void
}

; This function tests the floating point order comparison.
; CHECK: Printing analysis 'Branch Probability Analysis' for function 'ord'
; CHECK:  edge  -> a probability is 0x7ffff800 / 0x80000000 = 100.00% [HOT edge]
; CHECK:  edge  -> b probability is 0x00000800 / 0x80000000 = 0.00%

define void @ord(float %val1, float %val2) {
  %cond = fcmp ord float %val1, %val2
  br i1 %cond, label %a, label %b

a:
  call void @fa()
  ret void

b:
  call void @fb()
  ret void
}

declare void @fa()
declare void @fb()