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, i8* %in, double %dt1, i32 %x_size, i32 %y_size, i8* %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 ; <i32*> [#uses=2]
16 %in_addr = alloca i8* ; <i8**> [#uses=2]
17 %dt_addr = alloca float ; <float*> [#uses=4]
18 %x_size_addr = alloca i32 ; <i32*> [#uses=2]
19 %y_size_addr = alloca i32 ; <i32*> [#uses=1]
20 %bp_addr = alloca i8* ; <i8**> [#uses=1]
21 %tmp_image = alloca i8* ; <i8**> [#uses=0]
22 %out = alloca i8* ; <i8**> [#uses=1]
23 %cp = alloca i8* ; <i8**> [#uses=0]
24 %dpt = alloca i8* ; <i8**> [#uses=4]
25 %dp = alloca i8* ; <i8**> [#uses=2]
26 %ip = alloca i8* ; <i8**> [#uses=0]
27 %centre = alloca i32 ; <i32*> [#uses=0]
28 %tmp = alloca i32 ; <i32*> [#uses=0]
29 %brightness = alloca i32 ; <i32*> [#uses=0]
30 %area = alloca i32 ; <i32*> [#uses=0]
31 %y = alloca i32 ; <i32*> [#uses=0]
32 %x = alloca i32 ; <i32*> [#uses=2]
33 %j = alloca i32 ; <i32*> [#uses=6]
34 %i = alloca i32 ; <i32*> [#uses=1]
35 %mask_size = alloca i32 ; <i32*> [#uses=5]
36 %increment = alloca i32 ; <i32*> [#uses=1]
37 %n_max = alloca i32 ; <i32*> [#uses=4]
38 %temp = alloca float ; <float*> [#uses=1]
39 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
40 store i32 %three_by_three, i32* %three_by_three_addr
41 store i8* %in, i8** %in_addr
42 %dt = fptrunc double %dt1 to float ; <float> [#uses=1]
43 store float %dt, float* %dt_addr
44 store i32 %x_size, i32* %x_size_addr
45 store i32 %y_size, i32* %y_size_addr
46 store i8* %bp, i8** %bp_addr
47 %0 = load i8*, i8** %in_addr, align 4 ; <i8*> [#uses=1]
48 store i8* %0, i8** %out, align 4
49 %1 = call i32 (...) @foo() nounwind ; <i32> [#uses=1]
50 store i32 %1, i32* %i, align 4
51 %2 = load i32, i32* %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, float* %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, i32* %mask_size, align 4
65 store i32 1, i32* %mask_size, align 4
68 bb3: ; preds = %bb2, %bb
69 %9 = load i32, i32* %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, i32* %n_max, align 4
73 %12 = load i32, i32* %x_size_addr, align 4 ; <i32> [#uses=1]
74 %13 = load i32, i32* %n_max, align 4 ; <i32> [#uses=1]
75 %14 = sub i32 %12, %13 ; <i32> [#uses=1]
76 store i32 %14, i32* %increment, align 4
77 %15 = load i32, i32* %n_max, align 4 ; <i32> [#uses=1]
78 %16 = load i32, i32* %n_max, align 4 ; <i32> [#uses=1]
79 %17 = mul i32 %15, %16 ; <i32> [#uses=1]
80 %18 = call noalias i8* @malloc(i32 %17) nounwind ; <i8*> [#uses=1]
81 store i8* %18, i8** %dp, align 4
82 %19 = load i8*, i8** %dp, align 4 ; <i8*> [#uses=1]
83 store i8* %19, i8** %dpt, align 4
84 %20 = load float, float* %dt_addr, align 4 ; <float> [#uses=1]
85 %21 = load float, float* %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, float* %temp, align 4
89 %24 = load i32, i32* %mask_size, align 4 ; <i32> [#uses=1]
90 %25 = sub i32 0, %24 ; <i32> [#uses=1]
91 store i32 %25, i32* %j, align 4
95 %26 = load i32, i32* %j, align 4 ; <i32> [#uses=1]
96 %27 = load i32, i32* %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, i32* %x, align 4
102 %32 = load i32, i32* %x, align 4 ; <i32> [#uses=1]
103 %33 = trunc i32 %32 to i8 ; <i8> [#uses=1]
104 %34 = load i8*, i8** %dpt, align 4 ; <i8*> [#uses=1]
105 store i8 %33, i8* %34, align 1
106 %35 = load i8*, i8** %dpt, align 4 ; <i8*> [#uses=1]
107 %36 = getelementptr inbounds i8, i8* %35, i64 1 ; <i8*> [#uses=1]
108 store i8* %36, i8** %dpt, align 4
109 %37 = load i32, i32* %j, align 4 ; <i32> [#uses=1]
110 %38 = add nsw i32 %37, 1 ; <i32> [#uses=1]
111 store i32 %38, i32* %j, align 4
114 bb5: ; preds = %bb4, %bb3
115 %39 = load i32, i32* %j, align 4 ; <i32> [#uses=1]
116 %40 = load i32, i32* %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 i8* @malloc(i32) nounwind