aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/InstSimplify/fcmp.ll
blob: 0c2be5210a7413b66179e94d0c66ad96bd3b3ee3 (plain)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s

define i1 @poison(float %x) {
; CHECK-LABEL: @poison(
; CHECK-NEXT:    ret i1 poison
;
  %v = fcmp oeq float %x, poison
  ret i1 %v
}

define i1 @poison2(float %x) {
; CHECK-LABEL: @poison2(
; CHECK-NEXT:    ret i1 poison
;
  %v = fcmp ueq float %x, poison
  ret i1 %v
}

define i1 @pr130408(x86_fp80 %x) {
; CHECK-LABEL: @pr130408(
; CHECK-NEXT:    [[BITS:%.*]] = bitcast x86_fp80 [[X:%.*]] to i80
; CHECK-NEXT:    [[MASKED:%.*]] = and i80 [[BITS]], -604444463063240877801473
; CHECK-NEXT:    [[OR:%.*]] = or i80 [[MASKED]], 302194561415509874573312
; CHECK-NEXT:    [[FP:%.*]] = bitcast i80 [[OR]] to x86_fp80
; CHECK-NEXT:    [[RES:%.*]] = fcmp uno x86_fp80 [[FP]], 0xK00000000000000000000
; CHECK-NEXT:    ret i1 [[RES]]
;
  %bits = bitcast x86_fp80 %x to i80
  %masked = and i80 %bits, -604444463063240877801473
  %or = or i80 %masked, 302194561415509874573312
  %fp = bitcast i80 %or to x86_fp80
  %res = fcmp uno x86_fp80 %fp, 0xK00000000000000000000
  ret i1 %res
}