blob: 7e0bb5810971b0383e79ba9ad418b44d12426a61 [file] [log] [blame]
Ehsan Amiria538b0f2016-08-03 18:17:35 +00001; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 < %s | FileCheck %s
Hal Finkel40c34782013-09-15 22:09:58 +00002target 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 ]
David Blaikie79e6c742015-02-27 19:29:02 +000015 %0 = getelementptr inbounds float, float* %y, i64 %index
Hal Finkel40c34782013-09-15 22:09:58 +000016 %1 = bitcast float* %0 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000017 %wide.load = load <4 x float>, <4 x float>* %1, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000018 %2 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load)
David Blaikie79e6c742015-02-27 19:29:02 +000019 %3 = getelementptr inbounds float, float* %x, i64 %index
Hal Finkel40c34782013-09-15 22:09:58 +000020 %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
David Blaikie79e6c742015-02-27 19:29:02 +000023 %5 = getelementptr inbounds float, float* %y, i64 %index.next
Hal Finkel40c34782013-09-15 22:09:58 +000024 %6 = bitcast float* %5 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000025 %wide.load.1 = load <4 x float>, <4 x float>* %6, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000026 %7 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.1)
David Blaikie79e6c742015-02-27 19:29:02 +000027 %8 = getelementptr inbounds float, float* %x, i64 %index.next
Hal Finkel40c34782013-09-15 22:09:58 +000028 %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
David Blaikie79e6c742015-02-27 19:29:02 +000031 %10 = getelementptr inbounds float, float* %y, i64 %index.next.1
Hal Finkel40c34782013-09-15 22:09:58 +000032 %11 = bitcast float* %10 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000033 %wide.load.2 = load <4 x float>, <4 x float>* %11, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000034 %12 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.2)
David Blaikie79e6c742015-02-27 19:29:02 +000035 %13 = getelementptr inbounds float, float* %x, i64 %index.next.1
Hal Finkel40c34782013-09-15 22:09:58 +000036 %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
David Blaikie79e6c742015-02-27 19:29:02 +000039 %15 = getelementptr inbounds float, float* %y, i64 %index.next.2
Hal Finkel40c34782013-09-15 22:09:58 +000040 %16 = bitcast float* %15 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000041 %wide.load.3 = load <4 x float>, <4 x float>* %16, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000042 %17 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.3)
David Blaikie79e6c742015-02-27 19:29:02 +000043 %18 = getelementptr inbounds float, float* %x, i64 %index.next.2
Hal Finkel40c34782013-09-15 22:09:58 +000044 %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
David Blaikie79e6c742015-02-27 19:29:02 +000047 %20 = getelementptr inbounds float, float* %y, i64 %index.next.3
Hal Finkel40c34782013-09-15 22:09:58 +000048 %21 = bitcast float* %20 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000049 %wide.load.4 = load <4 x float>, <4 x float>* %21, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000050 %22 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.4)
David Blaikie79e6c742015-02-27 19:29:02 +000051 %23 = getelementptr inbounds float, float* %x, i64 %index.next.3
Hal Finkel40c34782013-09-15 22:09:58 +000052 %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
David Blaikie79e6c742015-02-27 19:29:02 +000055 %25 = getelementptr inbounds float, float* %y, i64 %index.next.4
Hal Finkel40c34782013-09-15 22:09:58 +000056 %26 = bitcast float* %25 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000057 %wide.load.5 = load <4 x float>, <4 x float>* %26, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000058 %27 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.5)
David Blaikie79e6c742015-02-27 19:29:02 +000059 %28 = getelementptr inbounds float, float* %x, i64 %index.next.4
Hal Finkel40c34782013-09-15 22:09:58 +000060 %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
David Blaikie79e6c742015-02-27 19:29:02 +000063 %30 = getelementptr inbounds float, float* %y, i64 %index.next.5
Hal Finkel40c34782013-09-15 22:09:58 +000064 %31 = bitcast float* %30 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000065 %wide.load.6 = load <4 x float>, <4 x float>* %31, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000066 %32 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.6)
David Blaikie79e6c742015-02-27 19:29:02 +000067 %33 = getelementptr inbounds float, float* %x, i64 %index.next.5
Hal Finkel40c34782013-09-15 22:09:58 +000068 %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
David Blaikie79e6c742015-02-27 19:29:02 +000071 %35 = getelementptr inbounds float, float* %y, i64 %index.next.6
Hal Finkel40c34782013-09-15 22:09:58 +000072 %36 = bitcast float* %35 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000073 %wide.load.7 = load <4 x float>, <4 x float>* %36, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000074 %37 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.7)
David Blaikie79e6c742015-02-27 19:29:02 +000075 %38 = getelementptr inbounds float, float* %x, i64 %index.next.6
Hal Finkel40c34782013-09-15 22:09:58 +000076 %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
David Blaikie79e6c742015-02-27 19:29:02 +000079 %40 = getelementptr inbounds float, float* %y, i64 %index.next.7
Hal Finkel40c34782013-09-15 22:09:58 +000080 %41 = bitcast float* %40 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000081 %wide.load.8 = load <4 x float>, <4 x float>* %41, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000082 %42 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.8)
David Blaikie79e6c742015-02-27 19:29:02 +000083 %43 = getelementptr inbounds float, float* %x, i64 %index.next.7
Hal Finkel40c34782013-09-15 22:09:58 +000084 %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
David Blaikie79e6c742015-02-27 19:29:02 +000087 %45 = getelementptr inbounds float, float* %y, i64 %index.next.8
Hal Finkel40c34782013-09-15 22:09:58 +000088 %46 = bitcast float* %45 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000089 %wide.load.9 = load <4 x float>, <4 x float>* %46, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000090 %47 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.9)
David Blaikie79e6c742015-02-27 19:29:02 +000091 %48 = getelementptr inbounds float, float* %x, i64 %index.next.8
Hal Finkel40c34782013-09-15 22:09:58 +000092 %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
David Blaikie79e6c742015-02-27 19:29:02 +000095 %50 = getelementptr inbounds float, float* %y, i64 %index.next.9
Hal Finkel40c34782013-09-15 22:09:58 +000096 %51 = bitcast float* %50 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +000097 %wide.load.10 = load <4 x float>, <4 x float>* %51, align 4
Hal Finkel40c34782013-09-15 22:09:58 +000098 %52 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.10)
David Blaikie79e6c742015-02-27 19:29:02 +000099 %53 = getelementptr inbounds float, float* %x, i64 %index.next.9
Hal Finkel40c34782013-09-15 22:09:58 +0000100 %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
David Blaikie79e6c742015-02-27 19:29:02 +0000103 %55 = getelementptr inbounds float, float* %y, i64 %index.next.10
Hal Finkel40c34782013-09-15 22:09:58 +0000104 %56 = bitcast float* %55 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +0000105 %wide.load.11 = load <4 x float>, <4 x float>* %56, align 4
Hal Finkel40c34782013-09-15 22:09:58 +0000106 %57 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.11)
David Blaikie79e6c742015-02-27 19:29:02 +0000107 %58 = getelementptr inbounds float, float* %x, i64 %index.next.10
Hal Finkel40c34782013-09-15 22:09:58 +0000108 %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
David Blaikie79e6c742015-02-27 19:29:02 +0000111 %60 = getelementptr inbounds float, float* %y, i64 %index.next.11
Hal Finkel40c34782013-09-15 22:09:58 +0000112 %61 = bitcast float* %60 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +0000113 %wide.load.12 = load <4 x float>, <4 x float>* %61, align 4
Hal Finkel40c34782013-09-15 22:09:58 +0000114 %62 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.12)
David Blaikie79e6c742015-02-27 19:29:02 +0000115 %63 = getelementptr inbounds float, float* %x, i64 %index.next.11
Hal Finkel40c34782013-09-15 22:09:58 +0000116 %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
David Blaikie79e6c742015-02-27 19:29:02 +0000119 %65 = getelementptr inbounds float, float* %y, i64 %index.next.12
Hal Finkel40c34782013-09-15 22:09:58 +0000120 %66 = bitcast float* %65 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +0000121 %wide.load.13 = load <4 x float>, <4 x float>* %66, align 4
Hal Finkel40c34782013-09-15 22:09:58 +0000122 %67 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.13)
David Blaikie79e6c742015-02-27 19:29:02 +0000123 %68 = getelementptr inbounds float, float* %x, i64 %index.next.12
Hal Finkel40c34782013-09-15 22:09:58 +0000124 %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
David Blaikie79e6c742015-02-27 19:29:02 +0000127 %70 = getelementptr inbounds float, float* %y, i64 %index.next.13
Hal Finkel40c34782013-09-15 22:09:58 +0000128 %71 = bitcast float* %70 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +0000129 %wide.load.14 = load <4 x float>, <4 x float>* %71, align 4
Hal Finkel40c34782013-09-15 22:09:58 +0000130 %72 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.14)
David Blaikie79e6c742015-02-27 19:29:02 +0000131 %73 = getelementptr inbounds float, float* %x, i64 %index.next.13
Hal Finkel40c34782013-09-15 22:09:58 +0000132 %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
David Blaikie79e6c742015-02-27 19:29:02 +0000135 %75 = getelementptr inbounds float, float* %y, i64 %index.next.14
Hal Finkel40c34782013-09-15 22:09:58 +0000136 %76 = bitcast float* %75 to <4 x float>*
David Blaikiea79ac142015-02-27 21:17:42 +0000137 %wide.load.15 = load <4 x float>, <4 x float>* %76, align 4
Hal Finkel40c34782013-09-15 22:09:58 +0000138 %77 = call <4 x float> @llvm_cos_v4f32(<4 x float> %wide.load.15)
David Blaikie79e6c742015-02-27 19:29:02 +0000139 %78 = getelementptr inbounds float, float* %x, i64 %index.next.14
Hal Finkel40c34782013-09-15 22:09:58 +0000140 %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>*
David Blaikiea79ac142015-02-27 21:17:42 +0000156 %r = load <2 x double>, <2 x double>* %p, align 8
Hal Finkel40c34782013-09-15 22:09:58 +0000157
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 }