1; RUN: opt -S -simplifycfg -phi-node-folding-threshold=2 < %s | FileCheck %s 2 3declare float @llvm.sqrt.f32(float) nounwind readonly 4declare float @llvm.fma.f32(float, float, float) nounwind readonly 5declare float @llvm.fmuladd.f32(float, float, float) nounwind readonly 6declare float @llvm.fabs.f32(float) nounwind readonly 7declare float @llvm.minnum.f32(float, float) nounwind readonly 8declare float @llvm.maxnum.f32(float, float) nounwind readonly 9 10; CHECK-LABEL: @sqrt_test( 11; CHECK: select 12define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind { 13entry: 14 %cmp.i = fcmp olt float %a, 0.000000e+00 15 br i1 %cmp.i, label %test_sqrt.exit, label %cond.else.i 16 17cond.else.i: ; preds = %entry 18 %0 = tail call float @llvm.sqrt.f32(float %a) nounwind readnone 19 br label %test_sqrt.exit 20 21test_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 24 ret void 25} 26 27; CHECK-LABEL: @fabs_test( 28; CHECK: select 29define void @fabs_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind { 30entry: 31 %cmp.i = fcmp olt float %a, 0.000000e+00 32 br i1 %cmp.i, label %test_fabs.exit, label %cond.else.i 33 34cond.else.i: ; preds = %entry 35 %0 = tail call float @llvm.fabs.f32(float %a) nounwind readnone 36 br label %test_fabs.exit 37 38test_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 41 ret void 42} 43 44; CHECK-LABEL: @fma_test( 45; CHECK: select 46define void @fma_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind { 47entry: 48 %cmp.i = fcmp olt float %a, 0.000000e+00 49 br i1 %cmp.i, label %test_fma.exit, label %cond.else.i 50 51cond.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 54 55test_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 58 ret void 59} 60 61; CHECK-LABEL: @fmuladd_test( 62; CHECK: select 63define void @fmuladd_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind { 64entry: 65 %cmp.i = fcmp olt float %a, 0.000000e+00 66 br i1 %cmp.i, label %test_fmuladd.exit, label %cond.else.i 67 68cond.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 71 72test_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 75 ret void 76} 77 78; CHECK-LABEL: @minnum_test( 79; CHECK: select 80define void @minnum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind { 81entry: 82 %cmp.i = fcmp olt float %a, 0.000000e+00 83 br i1 %cmp.i, label %test_minnum.exit, label %cond.else.i 84 85cond.else.i: ; preds = %entry 86 %0 = tail call float @llvm.minnum.f32(float %a, float %b) nounwind readnone 87 br label %test_minnum.exit 88 89test_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 92 ret void 93} 94 95; CHECK-LABEL: @maxnum_test( 96; CHECK: select 97define void @maxnum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind { 98entry: 99 %cmp.i = fcmp olt float %a, 0.000000e+00 100 br i1 %cmp.i, label %test_maxnum.exit, label %cond.else.i 101 102cond.else.i: ; preds = %entry 103 %0 = tail call float @llvm.maxnum.f32(float %a, float %b) nounwind readnone 104 br label %test_maxnum.exit 105 106test_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 109 ret void 110} 111