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 6 7; CHECK-LABEL: @sqrt_test( 8; CHECK: select 9define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind { 10entry: 11 %cmp.i = fcmp olt float %a, 0.000000e+00 12 br i1 %cmp.i, label %test_sqrt.exit, label %cond.else.i 13 14cond.else.i: ; preds = %entry 15 %0 = tail call float @llvm.sqrt.f32(float %a) nounwind readnone 16 br label %test_sqrt.exit 17 18test_sqrt.exit: ; preds = %cond.else.i, %entry 19 %cond.i = phi float [ %0, %cond.else.i ], [ 0x7FF8000000000000, %entry ] 20 store float %cond.i, float addrspace(1)* %out, align 4 21 ret void 22} 23 24 25; CHECK-LABEL: @fma_test( 26; CHECK: select 27define void @fma_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind { 28entry: 29 %cmp.i = fcmp olt float %a, 0.000000e+00 30 br i1 %cmp.i, label %test_fma.exit, label %cond.else.i 31 32cond.else.i: ; preds = %entry 33 %0 = tail call float @llvm.fma.f32(float %a, float %b, float %c) nounwind readnone 34 br label %test_fma.exit 35 36test_fma.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 39 ret void 40} 41 42; CHECK-LABEL: @fmuladd_test( 43; CHECK: select 44define void @fmuladd_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind { 45entry: 46 %cmp.i = fcmp olt float %a, 0.000000e+00 47 br i1 %cmp.i, label %test_fmuladd.exit, label %cond.else.i 48 49cond.else.i: ; preds = %entry 50 %0 = tail call float @llvm.fmuladd.f32(float %a, float %b, float %c) nounwind readnone 51 br label %test_fmuladd.exit 52 53test_fmuladd.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 56 ret void 57} 58 59