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
8 ; CHECK-LABEL: @sqrt_test(
10 define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
12 %cmp.i = fcmp olt float %a, 0.000000e+00
13 br i1 %cmp.i, label %test_sqrt.exit, label %cond.else.i
15 cond.else.i: ; preds = %entry
16 %0 = tail call float @llvm.sqrt.f32(float %a) nounwind readnone
17 br label %test_sqrt.exit
19 test_sqrt.exit: ; preds = %cond.else.i, %entry
20 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
21 store float %cond.i, float addrspace(1)* %out, align 4
25 ; CHECK-LABEL: @fabs_test(
27 define void @fabs_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
29 %cmp.i = fcmp olt float %a, 0.000000e+00
30 br i1 %cmp.i, label %test_fabs.exit, label %cond.else.i
32 cond.else.i: ; preds = %entry
33 %0 = tail call float @llvm.fabs.f32(float %a) nounwind readnone
34 br label %test_fabs.exit
36 test_fabs.exit: ; preds = %cond.else.i, %entry
37 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
38 store float %cond.i, float addrspace(1)* %out, align 4
42 ; CHECK-LABEL: @fma_test(
44 define void @fma_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind {
46 %cmp.i = fcmp olt float %a, 0.000000e+00
47 br i1 %cmp.i, label %test_fma.exit, label %cond.else.i
49 cond.else.i: ; preds = %entry
50 %0 = tail call float @llvm.fma.f32(float %a, float %b, float %c) nounwind readnone
51 br label %test_fma.exit
53 test_fma.exit: ; preds = %cond.else.i, %entry
54 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
55 store float %cond.i, float addrspace(1)* %out, align 4
59 ; CHECK-LABEL: @fmuladd_test(
61 define void @fmuladd_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind {
63 %cmp.i = fcmp olt float %a, 0.000000e+00
64 br i1 %cmp.i, label %test_fmuladd.exit, label %cond.else.i
66 cond.else.i: ; preds = %entry
67 %0 = tail call float @llvm.fmuladd.f32(float %a, float %b, float %c) nounwind readnone
68 br label %test_fmuladd.exit
70 test_fmuladd.exit: ; preds = %cond.else.i, %entry
71 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ]
72 store float %cond.i, float addrspace(1)* %out, align 4