1; RUN: opt -S -instcombine < %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 5declare <4 x double> @llvm.ppc.qpx.qvlfs(i8*) #1 6 7define <4 x double> @test1(<4 x float>* %h) #0 { 8entry: 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) 12 13; CHECK-LABEL: @test1 14; CHECK: @llvm.ppc.qpx.qvlfs 15; CHECK: ret <4 x double> 16 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 20 ret <4 x double> %a 21} 22 23define <4 x double> @test1a(<4 x float>* align 16 %h) #0 { 24entry: 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) 28 29; CHECK-LABEL: @test1a 30; CHECK-NOT: @llvm.ppc.qpx.qvlfs 31; CHECK-NOT: load <4 x double> 32; CHECK: ret <4 x double> 33 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 37 ret <4 x double> %a 38} 39 40declare void @llvm.ppc.qpx.qvstfs(<4 x double>, i8*) #0 41 42define <4 x float> @test2(<4 x float>* %h, <4 x double> %d) #0 { 43entry: 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) 47 48 %v0 = load <4 x float>, <4 x float>* %h, align 8 49 ret <4 x float> %v0 50 51; CHECK-LABEL: @test2 52; CHECK: @llvm.ppc.qpx.qvstfs 53; CHECK: ret <4 x float> 54} 55 56define <4 x float> @test2a(<4 x float>* align 16 %h, <4 x double> %d) #0 { 57entry: 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) 61 62 %v0 = load <4 x float>, <4 x float>* %h, align 8 63 ret <4 x float> %v0 64 65; CHECK-LABEL: @test2 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> 70} 71 72declare <4 x double> @llvm.ppc.qpx.qvlfd(i8*) #1 73 74define <4 x double> @test1l(<4 x double>* %h) #0 { 75entry: 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) 79 80; CHECK-LABEL: @test1l 81; CHECK: @llvm.ppc.qpx.qvlfd 82; CHECK: ret <4 x double> 83 84 %v0 = load <4 x double>, <4 x double>* %h, align 8 85 %a = fadd <4 x double> %v0, %vl 86 ret <4 x double> %a 87} 88 89define <4 x double> @test1ln(<4 x double>* align 16 %h) #0 { 90entry: 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) 94 95; CHECK-LABEL: @test1ln 96; CHECK: @llvm.ppc.qpx.qvlfd 97; CHECK: ret <4 x double> 98 99 %v0 = load <4 x double>, <4 x double>* %h, align 8 100 %a = fadd <4 x double> %v0, %vl 101 ret <4 x double> %a 102} 103 104define <4 x double> @test1la(<4 x double>* align 32 %h) #0 { 105entry: 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) 109 110; CHECK-LABEL: @test1la 111; CHECK-NOT: @llvm.ppc.qpx.qvlfd 112; CHECK: ret <4 x double> 113 114 %v0 = load <4 x double>, <4 x double>* %h, align 8 115 %a = fadd <4 x double> %v0, %vl 116 ret <4 x double> %a 117} 118 119declare void @llvm.ppc.qpx.qvstfd(<4 x double>, i8*) #0 120 121define <4 x double> @test2l(<4 x double>* %h, <4 x double> %d) #0 { 122entry: 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) 126 127 %v0 = load <4 x double>, <4 x double>* %h, align 8 128 ret <4 x double> %v0 129 130; CHECK-LABEL: @test2l 131; CHECK: @llvm.ppc.qpx.qvstfd 132; CHECK: ret <4 x double> 133} 134 135define <4 x double> @test2ln(<4 x double>* align 16 %h, <4 x double> %d) #0 { 136entry: 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) 140 141 %v0 = load <4 x double>, <4 x double>* %h, align 8 142 ret <4 x double> %v0 143 144; CHECK-LABEL: @test2ln 145; CHECK: @llvm.ppc.qpx.qvstfd 146; CHECK: ret <4 x double> 147} 148 149define <4 x double> @test2la(<4 x double>* align 32 %h, <4 x double> %d) #0 { 150entry: 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) 154 155 %v0 = load <4 x double>, <4 x double>* %h, align 8 156 ret <4 x double> %v0 157 158; CHECK-LABEL: @test2l 159; CHECK-NOT: @llvm.ppc.qpx.qvstfd 160; CHECK: ret <4 x double> 161} 162 163attributes #0 = { nounwind } 164attributes #1 = { nounwind readonly } 165 166