1 ; RUN: opt -S -instcombine < %s | FileCheck %s
2 target 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"
3 target triple = "powerpc64-unknown-linux-gnu"
5 declare <4 x i32> @llvm.ppc.altivec.lvx(i8*) #1
7 define <4 x i32> @test1(<4 x i32>* %h) #0 {
9 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
10 %hv = bitcast <4 x i32>* %h1 to i8*
11 %vl = call <4 x i32> @llvm.ppc.altivec.lvx(i8* %hv)
14 ; CHECK: @llvm.ppc.altivec.lvx
15 ; CHECK: ret <4 x i32>
17 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
18 %a = add <4 x i32> %v0, %vl
22 define <4 x i32> @test1a(<4 x i32>* align 16 %h) #0 {
24 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
25 %hv = bitcast <4 x i32>* %h1 to i8*
26 %vl = call <4 x i32> @llvm.ppc.altivec.lvx(i8* %hv)
28 ; CHECK-LABEL: @test1a
29 ; CHECK-NOT: @llvm.ppc.altivec.lvx
30 ; CHECK: ret <4 x i32>
32 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
33 %a = add <4 x i32> %v0, %vl
37 declare void @llvm.ppc.altivec.stvx(<4 x i32>, i8*) #0
39 define <4 x i32> @test2(<4 x i32>* %h, <4 x i32> %d) #0 {
41 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
42 %hv = bitcast <4 x i32>* %h1 to i8*
43 call void @llvm.ppc.altivec.stvx(<4 x i32> %d, i8* %hv)
45 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
49 ; CHECK: @llvm.ppc.altivec.stvx
50 ; CHECK: ret <4 x i32>
53 define <4 x i32> @test2a(<4 x i32>* align 16 %h, <4 x i32> %d) #0 {
55 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
56 %hv = bitcast <4 x i32>* %h1 to i8*
57 call void @llvm.ppc.altivec.stvx(<4 x i32> %d, i8* %hv)
59 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
63 ; CHECK-NOT: @llvm.ppc.altivec.stvx
64 ; CHECK: ret <4 x i32>
67 declare <4 x i32> @llvm.ppc.altivec.lvxl(i8*) #1
69 define <4 x i32> @test1l(<4 x i32>* %h) #0 {
71 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
72 %hv = bitcast <4 x i32>* %h1 to i8*
73 %vl = call <4 x i32> @llvm.ppc.altivec.lvxl(i8* %hv)
75 ; CHECK-LABEL: @test1l
76 ; CHECK: @llvm.ppc.altivec.lvxl
77 ; CHECK: ret <4 x i32>
79 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
80 %a = add <4 x i32> %v0, %vl
84 define <4 x i32> @test1la(<4 x i32>* align 16 %h) #0 {
86 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
87 %hv = bitcast <4 x i32>* %h1 to i8*
88 %vl = call <4 x i32> @llvm.ppc.altivec.lvxl(i8* %hv)
90 ; CHECK-LABEL: @test1la
91 ; CHECK-NOT: @llvm.ppc.altivec.lvxl
92 ; CHECK: ret <4 x i32>
94 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
95 %a = add <4 x i32> %v0, %vl
99 declare void @llvm.ppc.altivec.stvxl(<4 x i32>, i8*) #0
101 define <4 x i32> @test2l(<4 x i32>* %h, <4 x i32> %d) #0 {
103 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
104 %hv = bitcast <4 x i32>* %h1 to i8*
105 call void @llvm.ppc.altivec.stvxl(<4 x i32> %d, i8* %hv)
107 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
110 ; CHECK-LABEL: @test2l
111 ; CHECK: @llvm.ppc.altivec.stvxl
112 ; CHECK: ret <4 x i32>
115 define <4 x i32> @test2la(<4 x i32>* align 16 %h, <4 x i32> %d) #0 {
117 %h1 = getelementptr <4 x i32>, <4 x i32>* %h, i64 1
118 %hv = bitcast <4 x i32>* %h1 to i8*
119 call void @llvm.ppc.altivec.stvxl(<4 x i32> %d, i8* %hv)
121 %v0 = load <4 x i32>, <4 x i32>* %h, align 8
124 ; CHECK-LABEL: @test2l
125 ; CHECK-NOT: @llvm.ppc.altivec.stvxl
126 ; CHECK: ret <4 x i32>
129 attributes #0 = { nounwind }
130 attributes #1 = { nounwind readonly }