mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
0dffa591e6
Since NaN is very rare in normal programs, so the probability for floating point unordered comparison should be extremely small. Current probability is 3/8, it is too large, this patch changes it to a tiny number. Differential Revision: https://reviews.llvm.org/D65303 llvm-svn: 371541
42 lines
1.1 KiB
LLVM
42 lines
1.1 KiB
LLVM
; 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()
|