xref: /llvm-project/llvm/test/CodeGen/PowerPC/unal-altivec2.ll (revision 5403c59c608c08c8ecd4303763f08eb046eb5e4d)
1; RUN: llc -verify-machineinstrs -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(ptr noalias nocapture %x, ptr 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, ptr %y, i64 %index
16  %wide.load = load <4 x float>, ptr %0, align 4
17  %1 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load)
18  %2 = getelementptr inbounds float, ptr %x, i64 %index
19  store <4 x float> %1, ptr %2, align 4
20  %index.next = add i64 %index, 4
21  %3 = getelementptr inbounds float, ptr %y, i64 %index.next
22  %wide.load.1 = load <4 x float>, ptr %3, align 4
23  %4 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.1)
24  %5 = getelementptr inbounds float, ptr %x, i64 %index.next
25  store <4 x float> %4, ptr %5, align 4
26  %index.next.1 = add i64 %index.next, 4
27  %6 = getelementptr inbounds float, ptr %y, i64 %index.next.1
28  %wide.load.2 = load <4 x float>, ptr %6, align 4
29  %7 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.2)
30  %8 = getelementptr inbounds float, ptr %x, i64 %index.next.1
31  store <4 x float> %7, ptr %8, align 4
32  %index.next.2 = add i64 %index.next.1, 4
33  %9 = getelementptr inbounds float, ptr %y, i64 %index.next.2
34  %wide.load.3 = load <4 x float>, ptr %9, align 4
35  %10 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.3)
36  %11 = getelementptr inbounds float, ptr %x, i64 %index.next.2
37  store <4 x float> %10, ptr %11, align 4
38  %index.next.3 = add i64 %index.next.2, 4
39  %12 = getelementptr inbounds float, ptr %y, i64 %index.next.3
40  %wide.load.4 = load <4 x float>, ptr %12, align 4
41  %13 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.4)
42  %14 = getelementptr inbounds float, ptr %x, i64 %index.next.3
43  store <4 x float> %13, ptr %14, align 4
44  %index.next.4 = add i64 %index.next.3, 4
45  %15 = getelementptr inbounds float, ptr %y, i64 %index.next.4
46  %wide.load.5 = load <4 x float>, ptr %15, align 4
47  %16 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.5)
48  %17 = getelementptr inbounds float, ptr %x, i64 %index.next.4
49  store <4 x float> %16, ptr %17, align 4
50  %index.next.5 = add i64 %index.next.4, 4
51  %18 = getelementptr inbounds float, ptr %y, i64 %index.next.5
52  %wide.load.6 = load <4 x float>, ptr %18, align 4
53  %19 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.6)
54  %20 = getelementptr inbounds float, ptr %x, i64 %index.next.5
55  store <4 x float> %19, ptr %20, align 4
56  %index.next.6 = add i64 %index.next.5, 4
57  %21 = getelementptr inbounds float, ptr %y, i64 %index.next.6
58  %wide.load.7 = load <4 x float>, ptr %21, align 4
59  %22 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.7)
60  %23 = getelementptr inbounds float, ptr %x, i64 %index.next.6
61  store <4 x float> %22, ptr %23, align 4
62  %index.next.7 = add i64 %index.next.6, 4
63  %24 = getelementptr inbounds float, ptr %y, i64 %index.next.7
64  %wide.load.8 = load <4 x float>, ptr %24, align 4
65  %25 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.8)
66  %26 = getelementptr inbounds float, ptr %x, i64 %index.next.7
67  store <4 x float> %25, ptr %26, align 4
68  %index.next.8 = add i64 %index.next.7, 4
69  %27 = getelementptr inbounds float, ptr %y, i64 %index.next.8
70  %wide.load.9 = load <4 x float>, ptr %27, align 4
71  %28 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.9)
72  %29 = getelementptr inbounds float, ptr %x, i64 %index.next.8
73  store <4 x float> %28, ptr %29, align 4
74  %index.next.9 = add i64 %index.next.8, 4
75  %30 = getelementptr inbounds float, ptr %y, i64 %index.next.9
76  %wide.load.10 = load <4 x float>, ptr %30, align 4
77  %31 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.10)
78  %32 = getelementptr inbounds float, ptr %x, i64 %index.next.9
79  store <4 x float> %31, ptr %32, align 4
80  %index.next.10 = add i64 %index.next.9, 4
81  %33 = getelementptr inbounds float, ptr %y, i64 %index.next.10
82  %wide.load.11 = load <4 x float>, ptr %33, align 4
83  %34 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.11)
84  %35 = getelementptr inbounds float, ptr %x, i64 %index.next.10
85  store <4 x float> %34, ptr %35, align 4
86  %index.next.11 = add i64 %index.next.10, 4
87  %36 = getelementptr inbounds float, ptr %y, i64 %index.next.11
88  %wide.load.12 = load <4 x float>, ptr %36, align 4
89  %37 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.12)
90  %38 = getelementptr inbounds float, ptr %x, i64 %index.next.11
91  store <4 x float> %37, ptr %38, align 4
92  %index.next.12 = add i64 %index.next.11, 4
93  %39 = getelementptr inbounds float, ptr %y, i64 %index.next.12
94  %wide.load.13 = load <4 x float>, ptr %39, align 4
95  %40 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.13)
96  %41 = getelementptr inbounds float, ptr %x, i64 %index.next.12
97  store <4 x float> %40, ptr %41, align 4
98  %index.next.13 = add i64 %index.next.12, 4
99  %42 = getelementptr inbounds float, ptr %y, i64 %index.next.13
100  %wide.load.14 = load <4 x float>, ptr %42, align 4
101  %43 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.14)
102  %44 = getelementptr inbounds float, ptr %x, i64 %index.next.13
103  store <4 x float> %43, ptr %44, align 4
104  %index.next.14 = add i64 %index.next.13, 4
105  %45 = getelementptr inbounds float, ptr %y, i64 %index.next.14
106  %wide.load.15 = load <4 x float>, ptr %45, align 4
107  %46 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.15)
108  %47 = getelementptr inbounds float, ptr %x, i64 %index.next.14
109  store <4 x float> %46, ptr %47, align 4
110  %index.next.15 = add i64 %index.next.14, 4
111  %48 = icmp eq i64 %index.next.15, 2048
112  br i1 %48, label %for.end, label %vector.body
113
114for.end:                                          ; preds = %vector.body
115  ret void
116}
117
118; Function Attrs: nounwind readonly
119declare <4 x float> @llvm_cos_v4f32(<4 x float>) #1
120
121define <2 x double> @bar(ptr %x) {
122entry:
123  %r = load <2 x double>, ptr %x, align 8
124
125; CHECK-LABEL: @bar
126; CHECK-NOT: lvsl
127; CHECK: blr
128
129  ret <2 x double> %r
130}
131
132attributes #0 = { nounwind }
133attributes #1 = { nounwind readonly }
134