blob: 29583b6d6a0959bf5d75f6ae928cf6789da2b4de [file] [log] [blame]
Matt Arsenaultee364ee2014-01-31 00:09:00 +00001; 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
Matt Arsenault85cbc7e2014-08-29 16:01:17 +00006declare float @llvm.fabs.f32(float) nounwind readonly
Matt Arsenaultee364ee2014-01-31 00:09:00 +00007
8; CHECK-LABEL: @sqrt_test(
9; CHECK: select
10define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
11entry:
12 %cmp.i = fcmp olt float %a, 0.000000e+00
13 br i1 %cmp.i, label %test_sqrt.exit, label %cond.else.i
14
15cond.else.i: ; preds = %entry
16 %0 = tail call float @llvm.sqrt.f32(float %a) nounwind readnone
17 br label %test_sqrt.exit
18
19test_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 Arsenault85cbc7e2014-08-29 16:01:17 +000025; CHECK-LABEL: @fabs_test(
26; CHECK: select
27define void @fabs_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
28entry:
29 %cmp.i = fcmp olt float %a, 0.000000e+00
30 br i1 %cmp.i, label %test_fabs.exit, label %cond.else.i
31
32cond.else.i: ; preds = %entry
33 %0 = tail call float @llvm.fabs.f32(float %a) nounwind readnone
34 br label %test_fabs.exit
35
36test_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 Arsenaultee364ee2014-01-31 00:09:00 +000041
42; CHECK-LABEL: @fma_test(
43; CHECK: select
44define void @fma_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_fma.exit, label %cond.else.i
48
49cond.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
53test_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
61define void @fmuladd_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind {
62entry:
63 %cmp.i = fcmp olt float %a, 0.000000e+00
64 br i1 %cmp.i, label %test_fmuladd.exit, label %cond.else.i
65
66cond.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
70test_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