1 ; RUN: opt -S -passes=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(ptr) #1
7 define <4 x i32> @test1(ptr %h) #0 {
9 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
10 %vl = call <4 x i32> @llvm.ppc.altivec.lvx(ptr %h1)
13 ; CHECK: @llvm.ppc.altivec.lvx
14 ; CHECK: ret <4 x i32>
16 %v0 = load <4 x i32>, ptr %h, align 8
17 %a = add <4 x i32> %v0, %vl
21 define <4 x i32> @test1a(ptr align 16 %h) #0 {
23 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
24 %vl = call <4 x i32> @llvm.ppc.altivec.lvx(ptr %h1)
26 ; CHECK-LABEL: @test1a
27 ; CHECK-NOT: @llvm.ppc.altivec.lvx
28 ; CHECK: ret <4 x i32>
30 %v0 = load <4 x i32>, ptr %h, align 8
31 %a = add <4 x i32> %v0, %vl
35 declare void @llvm.ppc.altivec.stvx(<4 x i32>, ptr) #0
37 define <4 x i32> @test2(ptr %h, <4 x i32> %d) #0 {
39 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
40 call void @llvm.ppc.altivec.stvx(<4 x i32> %d, ptr %h1)
42 %v0 = load <4 x i32>, ptr %h, align 8
46 ; CHECK: @llvm.ppc.altivec.stvx
47 ; CHECK: ret <4 x i32>
50 define <4 x i32> @test2a(ptr align 16 %h, <4 x i32> %d) #0 {
52 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
53 call void @llvm.ppc.altivec.stvx(<4 x i32> %d, ptr %h1)
55 %v0 = load <4 x i32>, ptr %h, align 8
59 ; CHECK-NOT: @llvm.ppc.altivec.stvx
60 ; CHECK: ret <4 x i32>
63 declare <4 x i32> @llvm.ppc.altivec.lvxl(ptr) #1
65 define <4 x i32> @test1l(ptr %h) #0 {
67 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
68 %vl = call <4 x i32> @llvm.ppc.altivec.lvxl(ptr %h1)
70 ; CHECK-LABEL: @test1l
71 ; CHECK: @llvm.ppc.altivec.lvxl
72 ; CHECK: ret <4 x i32>
74 %v0 = load <4 x i32>, ptr %h, align 8
75 %a = add <4 x i32> %v0, %vl
79 define <4 x i32> @test1la(ptr align 16 %h) #0 {
81 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
82 %vl = call <4 x i32> @llvm.ppc.altivec.lvxl(ptr %h1)
84 ; CHECK-LABEL: @test1la
85 ; CHECK-NOT: @llvm.ppc.altivec.lvxl
86 ; CHECK: ret <4 x i32>
88 %v0 = load <4 x i32>, ptr %h, align 8
89 %a = add <4 x i32> %v0, %vl
93 declare void @llvm.ppc.altivec.stvxl(<4 x i32>, ptr) #0
95 define <4 x i32> @test2l(ptr %h, <4 x i32> %d) #0 {
97 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
98 call void @llvm.ppc.altivec.stvxl(<4 x i32> %d, ptr %h1)
100 %v0 = load <4 x i32>, ptr %h, align 8
103 ; CHECK-LABEL: @test2l
104 ; CHECK: @llvm.ppc.altivec.stvxl
105 ; CHECK: ret <4 x i32>
108 define <4 x i32> @test2la(ptr align 16 %h, <4 x i32> %d) #0 {
110 %h1 = getelementptr <4 x i32>, ptr %h, i64 1
111 call void @llvm.ppc.altivec.stvxl(<4 x i32> %d, ptr %h1)
113 %v0 = load <4 x i32>, ptr %h, align 8
116 ; CHECK-LABEL: @test2l
117 ; CHECK-NOT: @llvm.ppc.altivec.stvxl
118 ; CHECK: ret <4 x i32>
121 attributes #0 = { nounwind }
122 attributes #1 = { nounwind readonly }