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 double> @llvm.ppc.qpx.qvlfs(i8*) #1
7 define <4 x double> @test1(<4 x float>* %h) #0 {
9 %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
10 %hv = bitcast <4 x float>* %h1 to i8*
11 %vl = call <4 x double> @llvm.ppc.qpx.qvlfs(i8* %hv)
14 ; CHECK: @llvm.ppc.qpx.qvlfs
15 ; CHECK: ret <4 x double>
17 %v0 = load <4 x float>, <4 x float>* %h, align 8
18 %v0e = fpext <4 x float> %v0 to <4 x double>
19 %a = fadd <4 x double> %v0e, %vl
23 define <4 x double> @test1a(<4 x float>* align 16 %h) #0 {
25 %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
26 %hv = bitcast <4 x float>* %h1 to i8*
27 %vl = call <4 x double> @llvm.ppc.qpx.qvlfs(i8* %hv)
29 ; CHECK-LABEL: @test1a
30 ; CHECK-NOT: @llvm.ppc.qpx.qvlfs
31 ; CHECK-NOT: load <4 x double>
32 ; CHECK: ret <4 x double>
34 %v0 = load <4 x float>, <4 x float>* %h, align 8
35 %v0e = fpext <4 x float> %v0 to <4 x double>
36 %a = fadd <4 x double> %v0e, %vl
40 declare void @llvm.ppc.qpx.qvstfs(<4 x double>, i8*) #0
42 define <4 x float> @test2(<4 x float>* %h, <4 x double> %d) #0 {
44 %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
45 %hv = bitcast <4 x float>* %h1 to i8*
46 call void @llvm.ppc.qpx.qvstfs(<4 x double> %d, i8* %hv)
48 %v0 = load <4 x float>, <4 x float>* %h, align 8
52 ; CHECK: @llvm.ppc.qpx.qvstfs
53 ; CHECK: ret <4 x float>
56 define <4 x float> @test2a(<4 x float>* align 16 %h, <4 x double> %d) #0 {
58 %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1
59 %hv = bitcast <4 x float>* %h1 to i8*
60 call void @llvm.ppc.qpx.qvstfs(<4 x double> %d, i8* %hv)
62 %v0 = load <4 x float>, <4 x float>* %h, align 8
66 ; CHECK: fptrunc <4 x double> %d to <4 x float>
67 ; CHECK-NOT: @llvm.ppc.qpx.qvstfs
68 ; CHECK-NOT: store <4 x double>
69 ; CHECK: ret <4 x float>
72 declare <4 x double> @llvm.ppc.qpx.qvlfd(i8*) #1
74 define <4 x double> @test1l(<4 x double>* %h) #0 {
76 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
77 %hv = bitcast <4 x double>* %h1 to i8*
78 %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv)
80 ; CHECK-LABEL: @test1l
81 ; CHECK: @llvm.ppc.qpx.qvlfd
82 ; CHECK: ret <4 x double>
84 %v0 = load <4 x double>, <4 x double>* %h, align 8
85 %a = fadd <4 x double> %v0, %vl
89 define <4 x double> @test1ln(<4 x double>* align 16 %h) #0 {
91 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
92 %hv = bitcast <4 x double>* %h1 to i8*
93 %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv)
95 ; CHECK-LABEL: @test1ln
96 ; CHECK: @llvm.ppc.qpx.qvlfd
97 ; CHECK: ret <4 x double>
99 %v0 = load <4 x double>, <4 x double>* %h, align 8
100 %a = fadd <4 x double> %v0, %vl
104 define <4 x double> @test1la(<4 x double>* align 32 %h) #0 {
106 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
107 %hv = bitcast <4 x double>* %h1 to i8*
108 %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv)
110 ; CHECK-LABEL: @test1la
111 ; CHECK-NOT: @llvm.ppc.qpx.qvlfd
112 ; CHECK: ret <4 x double>
114 %v0 = load <4 x double>, <4 x double>* %h, align 8
115 %a = fadd <4 x double> %v0, %vl
119 declare void @llvm.ppc.qpx.qvstfd(<4 x double>, i8*) #0
121 define <4 x double> @test2l(<4 x double>* %h, <4 x double> %d) #0 {
123 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
124 %hv = bitcast <4 x double>* %h1 to i8*
125 call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv)
127 %v0 = load <4 x double>, <4 x double>* %h, align 8
130 ; CHECK-LABEL: @test2l
131 ; CHECK: @llvm.ppc.qpx.qvstfd
132 ; CHECK: ret <4 x double>
135 define <4 x double> @test2ln(<4 x double>* align 16 %h, <4 x double> %d) #0 {
137 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
138 %hv = bitcast <4 x double>* %h1 to i8*
139 call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv)
141 %v0 = load <4 x double>, <4 x double>* %h, align 8
144 ; CHECK-LABEL: @test2ln
145 ; CHECK: @llvm.ppc.qpx.qvstfd
146 ; CHECK: ret <4 x double>
149 define <4 x double> @test2la(<4 x double>* align 32 %h, <4 x double> %d) #0 {
151 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1
152 %hv = bitcast <4 x double>* %h1 to i8*
153 call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv)
155 %v0 = load <4 x double>, <4 x double>* %h, align 8
158 ; CHECK-LABEL: @test2l
159 ; CHECK-NOT: @llvm.ppc.qpx.qvstfd
160 ; CHECK: ret <4 x double>
163 attributes #0 = { nounwind }
164 attributes #1 = { nounwind readonly }