Matt Arsenault | ee364ee | 2014-01-31 00:09:00 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -simplifycfg -phi-node-folding-threshold=2 < %s | FileCheck %s |
| 2 | |
| 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 |
Matt Arsenault | 85cbc7e | 2014-08-29 16:01:17 +0000 | [diff] [blame] | 6 | declare float @llvm.fabs.f32(float) nounwind readonly |
Matt Arsenault | ee364ee | 2014-01-31 00:09:00 +0000 | [diff] [blame] | 7 | |
| 8 | ; CHECK-LABEL: @sqrt_test( |
| 9 | ; CHECK: select |
| 10 | define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind { |
| 11 | entry: |
| 12 | %cmp.i = fcmp olt float %a, 0.000000e+00 |
| 13 | br i1 %cmp.i, label %test_sqrt.exit, label %cond.else.i |
| 14 | |
| 15 | cond.else.i: ; preds = %entry |
| 16 | %0 = tail call float @llvm.sqrt.f32(float %a) nounwind readnone |
| 17 | br label %test_sqrt.exit |
| 18 | |
| 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 |
| 22 | ret void |
| 23 | } |
| 24 | |
Matt Arsenault | 85cbc7e | 2014-08-29 16:01:17 +0000 | [diff] [blame] | 25 | ; CHECK-LABEL: @fabs_test( |
| 26 | ; CHECK: select |
| 27 | define void @fabs_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind { |
| 28 | entry: |
| 29 | %cmp.i = fcmp olt float %a, 0.000000e+00 |
| 30 | br i1 %cmp.i, label %test_fabs.exit, label %cond.else.i |
| 31 | |
| 32 | cond.else.i: ; preds = %entry |
| 33 | %0 = tail call float @llvm.fabs.f32(float %a) nounwind readnone |
| 34 | br label %test_fabs.exit |
| 35 | |
| 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 |
| 39 | ret void |
| 40 | } |
Matt Arsenault | ee364ee | 2014-01-31 00:09:00 +0000 | [diff] [blame] | 41 | |
| 42 | ; CHECK-LABEL: @fma_test( |
| 43 | ; CHECK: select |
| 44 | define void @fma_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind { |
| 45 | entry: |
| 46 | %cmp.i = fcmp olt float %a, 0.000000e+00 |
| 47 | br i1 %cmp.i, label %test_fma.exit, label %cond.else.i |
| 48 | |
| 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 |
| 52 | |
| 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 |
| 56 | ret void |
| 57 | } |
| 58 | |
| 59 | ; CHECK-LABEL: @fmuladd_test( |
| 60 | ; CHECK: select |
| 61 | define void @fmuladd_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind { |
| 62 | entry: |
| 63 | %cmp.i = fcmp olt float %a, 0.000000e+00 |
| 64 | br i1 %cmp.i, label %test_fmuladd.exit, label %cond.else.i |
| 65 | |
| 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 |
| 69 | |
| 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 |
| 73 | ret void |
| 74 | } |
| 75 | |