1; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 < %s | FileCheck %s
2target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5; Function Attrs: nounwind
6define void @foo(float* noalias nocapture %x, float* noalias nocapture readonly %y) #0 {
7entry:
8  br label %vector.body
9
10vector.body:                                      ; preds = %vector.body, %entry
11; CHECK-LABEL: @foo
12; CHECK: lvsl
13; CHECK: blr
14  %index = phi i64 [ 0, %entry ], [ %index.next.15, %vector.body ]
15  %0 = getelementptr inbounds float, float* %y, i64 %index
16  %1 = bitcast float* %0 to <4 x float>*
17  %wide.load = load <4 x float>, <4 x float>* %1, align 4
18  %2 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load)
19  %3 = getelementptr inbounds float, float* %x, i64 %index
20  %4 = bitcast float* %3 to <4 x float>*
21  store <4 x float> %2, <4 x float>* %4, align 4
22  %index.next = add i64 %index, 4
23  %5 = getelementptr inbounds float, float* %y, i64 %index.next
24  %6 = bitcast float* %5 to <4 x float>*
25  %wide.load.1 = load <4 x float>, <4 x float>* %6, align 4
26  %7 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.1)
27  %8 = getelementptr inbounds float, float* %x, i64 %index.next
28  %9 = bitcast float* %8 to <4 x float>*
29  store <4 x float> %7, <4 x float>* %9, align 4
30  %index.next.1 = add i64 %index.next, 4
31  %10 = getelementptr inbounds float, float* %y, i64 %index.next.1
32  %11 = bitcast float* %10 to <4 x float>*
33  %wide.load.2 = load <4 x float>, <4 x float>* %11, align 4
34  %12 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.2)
35  %13 = getelementptr inbounds float, float* %x, i64 %index.next.1
36  %14 = bitcast float* %13 to <4 x float>*
37  store <4 x float> %12, <4 x float>* %14, align 4
38  %index.next.2 = add i64 %index.next.1, 4
39  %15 = getelementptr inbounds float, float* %y, i64 %index.next.2
40  %16 = bitcast float* %15 to <4 x float>*
41  %wide.load.3 = load <4 x float>, <4 x float>* %16, align 4
42  %17 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.3)
43  %18 = getelementptr inbounds float, float* %x, i64 %index.next.2
44  %19 = bitcast float* %18 to <4 x float>*
45  store <4 x float> %17, <4 x float>* %19, align 4
46  %index.next.3 = add i64 %index.next.2, 4
47  %20 = getelementptr inbounds float, float* %y, i64 %index.next.3
48  %21 = bitcast float* %20 to <4 x float>*
49  %wide.load.4 = load <4 x float>, <4 x float>* %21, align 4
50  %22 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.4)
51  %23 = getelementptr inbounds float, float* %x, i64 %index.next.3
52  %24 = bitcast float* %23 to <4 x float>*
53  store <4 x float> %22, <4 x float>* %24, align 4
54  %index.next.4 = add i64 %index.next.3, 4
55  %25 = getelementptr inbounds float, float* %y, i64 %index.next.4
56  %26 = bitcast float* %25 to <4 x float>*
57  %wide.load.5 = load <4 x float>, <4 x float>* %26, align 4
58  %27 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.5)
59  %28 = getelementptr inbounds float, float* %x, i64 %index.next.4
60  %29 = bitcast float* %28 to <4 x float>*
61  store <4 x float> %27, <4 x float>* %29, align 4
62  %index.next.5 = add i64 %index.next.4, 4
63  %30 = getelementptr inbounds float, float* %y, i64 %index.next.5
64  %31 = bitcast float* %30 to <4 x float>*
65  %wide.load.6 = load <4 x float>, <4 x float>* %31, align 4
66  %32 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.6)
67  %33 = getelementptr inbounds float, float* %x, i64 %index.next.5
68  %34 = bitcast float* %33 to <4 x float>*
69  store <4 x float> %32, <4 x float>* %34, align 4
70  %index.next.6 = add i64 %index.next.5, 4
71  %35 = getelementptr inbounds float, float* %y, i64 %index.next.6
72  %36 = bitcast float* %35 to <4 x float>*
73  %wide.load.7 = load <4 x float>, <4 x float>* %36, align 4
74  %37 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.7)
75  %38 = getelementptr inbounds float, float* %x, i64 %index.next.6
76  %39 = bitcast float* %38 to <4 x float>*
77  store <4 x float> %37, <4 x float>* %39, align 4
78  %index.next.7 = add i64 %index.next.6, 4
79  %40 = getelementptr inbounds float, float* %y, i64 %index.next.7
80  %41 = bitcast float* %40 to <4 x float>*
81  %wide.load.8 = load <4 x float>, <4 x float>* %41, align 4
82  %42 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.8)
83  %43 = getelementptr inbounds float, float* %x, i64 %index.next.7
84  %44 = bitcast float* %43 to <4 x float>*
85  store <4 x float> %42, <4 x float>* %44, align 4
86  %index.next.8 = add i64 %index.next.7, 4
87  %45 = getelementptr inbounds float, float* %y, i64 %index.next.8
88  %46 = bitcast float* %45 to <4 x float>*
89  %wide.load.9 = load <4 x float>, <4 x float>* %46, align 4
90  %47 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.9)
91  %48 = getelementptr inbounds float, float* %x, i64 %index.next.8
92  %49 = bitcast float* %48 to <4 x float>*
93  store <4 x float> %47, <4 x float>* %49, align 4
94  %index.next.9 = add i64 %index.next.8, 4
95  %50 = getelementptr inbounds float, float* %y, i64 %index.next.9
96  %51 = bitcast float* %50 to <4 x float>*
97  %wide.load.10 = load <4 x float>, <4 x float>* %51, align 4
98  %52 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.10)
99  %53 = getelementptr inbounds float, float* %x, i64 %index.next.9
100  %54 = bitcast float* %53 to <4 x float>*
101  store <4 x float> %52, <4 x float>* %54, align 4
102  %index.next.10 = add i64 %index.next.9, 4
103  %55 = getelementptr inbounds float, float* %y, i64 %index.next.10
104  %56 = bitcast float* %55 to <4 x float>*
105  %wide.load.11 = load <4 x float>, <4 x float>* %56, align 4
106  %57 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.11)
107  %58 = getelementptr inbounds float, float* %x, i64 %index.next.10
108  %59 = bitcast float* %58 to <4 x float>*
109  store <4 x float> %57, <4 x float>* %59, align 4
110  %index.next.11 = add i64 %index.next.10, 4
111  %60 = getelementptr inbounds float, float* %y, i64 %index.next.11
112  %61 = bitcast float* %60 to <4 x float>*
113  %wide.load.12 = load <4 x float>, <4 x float>* %61, align 4
114  %62 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.12)
115  %63 = getelementptr inbounds float, float* %x, i64 %index.next.11
116  %64 = bitcast float* %63 to <4 x float>*
117  store <4 x float> %62, <4 x float>* %64, align 4
118  %index.next.12 = add i64 %index.next.11, 4
119  %65 = getelementptr inbounds float, float* %y, i64 %index.next.12
120  %66 = bitcast float* %65 to <4 x float>*
121  %wide.load.13 = load <4 x float>, <4 x float>* %66, align 4
122  %67 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.13)
123  %68 = getelementptr inbounds float, float* %x, i64 %index.next.12
124  %69 = bitcast float* %68 to <4 x float>*
125  store <4 x float> %67, <4 x float>* %69, align 4
126  %index.next.13 = add i64 %index.next.12, 4
127  %70 = getelementptr inbounds float, float* %y, i64 %index.next.13
128  %71 = bitcast float* %70 to <4 x float>*
129  %wide.load.14 = load <4 x float>, <4 x float>* %71, align 4
130  %72 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.14)
131  %73 = getelementptr inbounds float, float* %x, i64 %index.next.13
132  %74 = bitcast float* %73 to <4 x float>*
133  store <4 x float> %72, <4 x float>* %74, align 4
134  %index.next.14 = add i64 %index.next.13, 4
135  %75 = getelementptr inbounds float, float* %y, i64 %index.next.14
136  %76 = bitcast float* %75 to <4 x float>*
137  %wide.load.15 = load <4 x float>, <4 x float>* %76, align 4
138  %77 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.15)
139  %78 = getelementptr inbounds float, float* %x, i64 %index.next.14
140  %79 = bitcast float* %78 to <4 x float>*
141  store <4 x float> %77, <4 x float>* %79, align 4
142  %index.next.15 = add i64 %index.next.14, 4
143  %80 = icmp eq i64 %index.next.15, 2048
144  br i1 %80, label %for.end, label %vector.body
145
146for.end:                                          ; preds = %vector.body
147  ret void
148}
149
150; Function Attrs: nounwind readonly
151declare <4 x float> @llvm_cos_v4f32(<4 x float>) #1
152
153define <2 x double> @bar(double* %x) {
154entry:
155  %p = bitcast double* %x to <2 x double>*
156  %r = load <2 x double>, <2 x double>* %p, align 8
157
158; CHECK-LABEL: @bar
159; CHECK-NOT: lvsl
160; CHECK: blr
161
162  ret <2 x double> %r
163}
164
165attributes #0 = { nounwind }
166attributes #1 = { nounwind readonly }
167