1 ; RUN: opt -S -simplifycfg -phi-node-folding-threshold=2 < %s | FileCheck %s
3 declare float @llvm.sqrt.f32(float) nounwind readonly
4 declare float @llvm.fma.f32(float, float, float) nounwind readonly
5 declare float @llvm.fmuladd.f32(float, float, float) nounwind readonly
6 declare float @llvm.fabs.f32(float) nounwind readonly
7 declare float @llvm.minnum.f32(float, float) nounwind readonly
8 declare float @llvm.maxnum.f32(float, float) nounwind readonly
10 ; CHECK-LABEL: @sqrt_test(
12 define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
14 %cmp.i = fcmp olt float %a, 0.000000e+00
15 br i1 %cmp.i, label %test_sqrt.exit, label %cond.else.i
17 cond.else.i: ; preds = %entry
18 %0 = tail call float @llvm.sqrt.f32(float %a) nounwind readnone
19 br label %test_sqrt.exit
21 test_sqrt.exit: ; preds = %cond.else.i, %entry
22 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
23 store float %cond.i, float addrspace(1)* %out, align 4
27 ; CHECK-LABEL: @fabs_test(
29 define void @fabs_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
31 %cmp.i = fcmp olt float %a, 0.000000e+00
32 br i1 %cmp.i, label %test_fabs.exit, label %cond.else.i
34 cond.else.i: ; preds = %entry
35 %0 = tail call float @llvm.fabs.f32(float %a) nounwind readnone
36 br label %test_fabs.exit
38 test_fabs.exit: ; preds = %cond.else.i, %entry
39 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
40 store float %cond.i, float addrspace(1)* %out, align 4
44 ; CHECK-LABEL: @fma_test(
46 define void @fma_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind {
48 %cmp.i = fcmp olt float %a, 0.000000e+00
49 br i1 %cmp.i, label %test_fma.exit, label %cond.else.i
51 cond.else.i: ; preds = %entry
52 %0 = tail call float @llvm.fma.f32(float %a, float %b, float %c) nounwind readnone
53 br label %test_fma.exit
55 test_fma.exit: ; preds = %cond.else.i, %entry
56 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
57 store float %cond.i, float addrspace(1)* %out, align 4
61 ; CHECK-LABEL: @fmuladd_test(
63 define void @fmuladd_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind {
65 %cmp.i = fcmp olt float %a, 0.000000e+00
66 br i1 %cmp.i, label %test_fmuladd.exit, label %cond.else.i
68 cond.else.i: ; preds = %entry
69 %0 = tail call float @llvm.fmuladd.f32(float %a, float %b, float %c) nounwind readnone
70 br label %test_fmuladd.exit
72 test_fmuladd.exit: ; preds = %cond.else.i, %entry
73 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
74 store float %cond.i, float addrspace(1)* %out, align 4
78 ; CHECK-LABEL: @minnum_test(
80 define void @minnum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind {
82 %cmp.i = fcmp olt float %a, 0.000000e+00
83 br i1 %cmp.i, label %test_minnum.exit, label %cond.else.i
85 cond.else.i: ; preds = %entry
86 %0 = tail call float @llvm.minnum.f32(float %a, float %b) nounwind readnone
87 br label %test_minnum.exit
89 test_minnum.exit: ; preds = %cond.else.i, %entry
90 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
91 store float %cond.i, float addrspace(1)* %out, align 4
95 ; CHECK-LABEL: @maxnum_test(
97 define void @maxnum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind {
99 %cmp.i = fcmp olt float %a, 0.000000e+00
100 br i1 %cmp.i, label %test_maxnum.exit, label %cond.else.i
102 cond.else.i: ; preds = %entry
103 %0 = tail call float @llvm.maxnum.f32(float %a, float %b) nounwind readnone
104 br label %test_maxnum.exit
106 test_maxnum.exit: ; preds = %cond.else.i, %entry
107 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
108 store float %cond.i, float addrspace(1)* %out, align 4