1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
4 ; Test for assert that fired after
5 ; ddb3f12c428bc4bd5a98913d74dfd7f2402bdfd8. simplifyFCmpInst is called
6 ; with a literal negative nan without a context instruction.
9 ; simplifyFCmpInst gets called without a context instruction and
10 ; expects to simplify an ordered compare with a negative nan.
11 define i1 @simplify_fcmp_negative_nan_oeq(i1 %cond, float %arg) {
12 ; CHECK-LABEL: define i1 @simplify_fcmp_negative_nan_oeq(
13 ; CHECK-SAME: i1 [[COND:%.*]], float [[ARG:%.*]]) {
15 ; CHECK-NEXT: br i1 [[COND]], label [[BB2:%.*]], label [[BB5:%.*]]
17 ; CHECK-NEXT: [[I3:%.*]] = fcmp oeq float 0.000000e+00, [[ARG]]
18 ; CHECK-NEXT: br i1 [[I3]], label [[BB5]], label [[BB5]]
20 ; CHECK-NEXT: [[I33:%.*]] = phi i1 [ [[I3]], [[BB2]] ], [ [[I3]], [[BB2]] ], [ false, [[BB:%.*]] ]
21 ; CHECK-NEXT: ret i1 [[I33]]
24 br i1 %cond, label %bb1, label %bb2
29 bb2: ; preds = %bb1, %bb
30 %i = phi float [ 0xFFFFFFFFE0000000, %bb ], [ 0.000000e+00, %bb1 ]
31 %i3 = fcmp oeq float %i, %arg
32 br i1 %i3, label %bb4, label %bb5
37 bb5: ; preds = %bb4, %bb2
41 ; simplifyFCmpInst gets called without a context instruction and
42 ; expects to simplify an unordered compare with a negative nan.
43 define i1 @simplify_fcmp_negative_nan_ueq(i1 %cond, float %arg) {
44 ; CHECK-LABEL: define i1 @simplify_fcmp_negative_nan_ueq(
45 ; CHECK-SAME: i1 [[COND:%.*]], float [[ARG:%.*]]) {
47 ; CHECK-NEXT: br i1 [[COND]], label [[BB2:%.*]], label [[BB5:%.*]]
49 ; CHECK-NEXT: [[I3:%.*]] = fcmp ueq float 0.000000e+00, [[ARG]]
50 ; CHECK-NEXT: br i1 [[I3]], label [[BB5]], label [[BB5]]
52 ; CHECK-NEXT: [[I33:%.*]] = phi i1 [ [[I3]], [[BB2]] ], [ [[I3]], [[BB2]] ], [ true, [[BB:%.*]] ]
53 ; CHECK-NEXT: ret i1 [[I33]]
56 br i1 %cond, label %bb1, label %bb2
61 bb2: ; preds = %bb1, %bb
62 %i = phi float [ 0xFFFFFFFFE0000000, %bb ], [ 0.000000e+00, %bb1 ]
63 %i3 = fcmp ueq float %i, %arg
64 br i1 %i3, label %bb4, label %bb5
69 bb5: ; preds = %bb4, %bb2
73 define i1 @simplify_fcmp_positive_nan_oeq(i1 %cond, float %arg) {
74 ; CHECK-LABEL: define i1 @simplify_fcmp_positive_nan_oeq(
75 ; CHECK-SAME: i1 [[COND:%.*]], float [[ARG:%.*]]) {
77 ; CHECK-NEXT: br i1 [[COND]], label [[BB2:%.*]], label [[BB5:%.*]]
79 ; CHECK-NEXT: [[I3:%.*]] = fcmp oeq float 0.000000e+00, [[ARG]]
80 ; CHECK-NEXT: br i1 [[I3]], label [[BB5]], label [[BB5]]
82 ; CHECK-NEXT: [[I33:%.*]] = phi i1 [ [[I3]], [[BB2]] ], [ [[I3]], [[BB2]] ], [ false, [[BB:%.*]] ]
83 ; CHECK-NEXT: ret i1 [[I33]]
86 br i1 %cond, label %bb1, label %bb2
91 bb2: ; preds = %bb1, %bb
92 %i = phi float [ 0x7FFFFFFFE0000000, %bb ], [ 0.000000e+00, %bb1 ]
93 %i3 = fcmp oeq float %i, %arg
94 br i1 %i3, label %bb4, label %bb5
99 bb5: ; preds = %bb4, %bb2