1 ; RUN: opt < %s -O3 | \
2 ; RUN: llc -mtriple=thumbv7-apple-darwin10 -mattr=+neon | FileCheck %s
4 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32"
6 define void @fred(i32 %three_by_three, ptr %in, double %dt1, i32 %x_size, i32 %y_size, ptr %bp) nounwind {
8 ; -- The loop following the load should only use a single add-literation
12 ; CHECK: subsections_via_symbols
15 %three_by_three_addr = alloca i32 ; <ptr> [#uses=2]
16 %in_addr = alloca ptr ; <ptr> [#uses=2]
17 %dt_addr = alloca float ; <ptr> [#uses=4]
18 %x_size_addr = alloca i32 ; <ptr> [#uses=2]
19 %y_size_addr = alloca i32 ; <ptr> [#uses=1]
20 %bp_addr = alloca ptr ; <ptr> [#uses=1]
21 %tmp_image = alloca ptr ; <ptr> [#uses=0]
22 %out = alloca ptr ; <ptr> [#uses=1]
23 %cp = alloca ptr ; <ptr> [#uses=0]
24 %dpt = alloca ptr ; <ptr> [#uses=4]
25 %dp = alloca ptr ; <ptr> [#uses=2]
26 %ip = alloca ptr ; <ptr> [#uses=0]
27 %centre = alloca i32 ; <ptr> [#uses=0]
28 %tmp = alloca i32 ; <ptr> [#uses=0]
29 %brightness = alloca i32 ; <ptr> [#uses=0]
30 %area = alloca i32 ; <ptr> [#uses=0]
31 %y = alloca i32 ; <ptr> [#uses=0]
32 %x = alloca i32 ; <ptr> [#uses=2]
33 %j = alloca i32 ; <ptr> [#uses=6]
34 %i = alloca i32 ; <ptr> [#uses=1]
35 %mask_size = alloca i32 ; <ptr> [#uses=5]
36 %increment = alloca i32 ; <ptr> [#uses=1]
37 %n_max = alloca i32 ; <ptr> [#uses=4]
38 %temp = alloca float ; <ptr> [#uses=1]
39 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
40 store i32 %three_by_three, ptr %three_by_three_addr
41 store ptr %in, ptr %in_addr
42 %dt = fptrunc double %dt1 to float ; <float> [#uses=1]
43 store float %dt, ptr %dt_addr
44 store i32 %x_size, ptr %x_size_addr
45 store i32 %y_size, ptr %y_size_addr
46 store ptr %bp, ptr %bp_addr
47 %0 = load ptr, ptr %in_addr, align 4 ; <ptr> [#uses=1]
48 store ptr %0, ptr %out, align 4
49 %1 = call i32 (...) @foo() nounwind ; <i32> [#uses=1]
50 store i32 %1, ptr %i, align 4
51 %2 = load i32, ptr %three_by_three_addr, align 4 ; <i32> [#uses=1]
52 %3 = icmp eq i32 %2, 0 ; <i1> [#uses=1]
53 br i1 %3, label %bb, label %bb2
56 %4 = load float, ptr %dt_addr, align 4 ; <float> [#uses=1]
57 %5 = fpext float %4 to double ; <double> [#uses=1]
58 %6 = fmul double %5, 1.500000e+00 ; <double> [#uses=1]
59 %7 = fptosi double %6 to i32 ; <i32> [#uses=1]
60 %8 = add nsw i32 %7, 1 ; <i32> [#uses=1]
61 store i32 %8, ptr %mask_size, align 4
65 store i32 1, ptr %mask_size, align 4
68 bb3: ; preds = %bb2, %bb
69 %9 = load i32, ptr %mask_size, align 4 ; <i32> [#uses=1]
70 %10 = mul i32 %9, 2 ; <i32> [#uses=1]
71 %11 = add nsw i32 %10, 1 ; <i32> [#uses=1]
72 store i32 %11, ptr %n_max, align 4
73 %12 = load i32, ptr %x_size_addr, align 4 ; <i32> [#uses=1]
74 %13 = load i32, ptr %n_max, align 4 ; <i32> [#uses=1]
75 %14 = sub i32 %12, %13 ; <i32> [#uses=1]
76 store i32 %14, ptr %increment, align 4
77 %15 = load i32, ptr %n_max, align 4 ; <i32> [#uses=1]
78 %16 = load i32, ptr %n_max, align 4 ; <i32> [#uses=1]
79 %17 = mul i32 %15, %16 ; <i32> [#uses=1]
80 %18 = call noalias ptr @malloc(i32 %17) nounwind ; <ptr> [#uses=1]
81 store ptr %18, ptr %dp, align 4
82 %19 = load ptr, ptr %dp, align 4 ; <ptr> [#uses=1]
83 store ptr %19, ptr %dpt, align 4
84 %20 = load float, ptr %dt_addr, align 4 ; <float> [#uses=1]
85 %21 = load float, ptr %dt_addr, align 4 ; <float> [#uses=1]
86 %22 = fmul float %20, %21 ; <float> [#uses=1]
87 %23 = fsub float -0.000000e+00, %22 ; <float> [#uses=1]
88 store float %23, ptr %temp, align 4
89 %24 = load i32, ptr %mask_size, align 4 ; <i32> [#uses=1]
90 %25 = sub i32 0, %24 ; <i32> [#uses=1]
91 store i32 %25, ptr %j, align 4
95 %26 = load i32, ptr %j, align 4 ; <i32> [#uses=1]
96 %27 = load i32, ptr %j, align 4 ; <i32> [#uses=1]
97 %28 = mul i32 %26, %27 ; <i32> [#uses=1]
98 %29 = sitofp i32 %28 to double ; <double> [#uses=1]
99 %30 = fmul double %29, 1.234000e+00 ; <double> [#uses=1]
100 %31 = fptosi double %30 to i32 ; <i32> [#uses=1]
101 store i32 %31, ptr %x, align 4
102 %32 = load i32, ptr %x, align 4 ; <i32> [#uses=1]
103 %33 = trunc i32 %32 to i8 ; <i8> [#uses=1]
104 %34 = load ptr, ptr %dpt, align 4 ; <ptr> [#uses=1]
105 store i8 %33, ptr %34, align 1
106 %35 = load ptr, ptr %dpt, align 4 ; <ptr> [#uses=1]
107 %36 = getelementptr inbounds i8, ptr %35, i64 1 ; <ptr> [#uses=1]
108 store ptr %36, ptr %dpt, align 4
109 %37 = load i32, ptr %j, align 4 ; <i32> [#uses=1]
110 %38 = add nsw i32 %37, 1 ; <i32> [#uses=1]
111 store i32 %38, ptr %j, align 4
114 bb5: ; preds = %bb4, %bb3
115 %39 = load i32, ptr %j, align 4 ; <i32> [#uses=1]
116 %40 = load i32, ptr %mask_size, align 4 ; <i32> [#uses=1]
117 %41 = icmp sle i32 %39, %40 ; <i1> [#uses=1]
118 br i1 %41, label %bb4, label %bb6
123 return: ; preds = %bb6
127 declare i32 @foo(...)
129 declare noalias ptr @malloc(i32) nounwind