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: ret <4 x double> 32 33 %v0 = load <4 x float>, <4 x float>* %h, align 8 34 %v0e = fpext <4 x float> %v0 to <4 x double> 35 %a = fadd <4 x double> %v0e, %vl 36 ret <4 x double> %a 37} 38 39declare void @llvm.ppc.qpx.qvstfs(<4 x double>, i8*) #0 40 41define <4 x float> @test2(<4 x float>* %h, <4 x double> %d) #0 { 42entry: 43 %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1 44 %hv = bitcast <4 x float>* %h1 to i8* 45 call void @llvm.ppc.qpx.qvstfs(<4 x double> %d, i8* %hv) 46 47 %v0 = load <4 x float>, <4 x float>* %h, align 8 48 ret <4 x float> %v0 49 50; CHECK-LABEL: @test2 51; CHECK: @llvm.ppc.qpx.qvstfs 52; CHECK: ret <4 x float> 53} 54 55define <4 x float> @test2a(<4 x float>* align 16 %h, <4 x double> %d) #0 { 56entry: 57 %h1 = getelementptr <4 x float>, <4 x float>* %h, i64 1 58 %hv = bitcast <4 x float>* %h1 to i8* 59 call void @llvm.ppc.qpx.qvstfs(<4 x double> %d, i8* %hv) 60 61 %v0 = load <4 x float>, <4 x float>* %h, align 8 62 ret <4 x float> %v0 63 64; CHECK-LABEL: @test2 65; CHECK-NOT: @llvm.ppc.qpx.qvstfs 66; CHECK: ret <4 x float> 67} 68 69declare <4 x double> @llvm.ppc.qpx.qvlfd(i8*) #1 70 71define <4 x double> @test1l(<4 x double>* %h) #0 { 72entry: 73 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1 74 %hv = bitcast <4 x double>* %h1 to i8* 75 %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv) 76 77; CHECK-LABEL: @test1l 78; CHECK: @llvm.ppc.qpx.qvlfd 79; CHECK: ret <4 x double> 80 81 %v0 = load <4 x double>, <4 x double>* %h, align 8 82 %a = fadd <4 x double> %v0, %vl 83 ret <4 x double> %a 84} 85 86define <4 x double> @test1ln(<4 x double>* align 16 %h) #0 { 87entry: 88 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1 89 %hv = bitcast <4 x double>* %h1 to i8* 90 %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv) 91 92; CHECK-LABEL: @test1ln 93; CHECK: @llvm.ppc.qpx.qvlfd 94; CHECK: ret <4 x double> 95 96 %v0 = load <4 x double>, <4 x double>* %h, align 8 97 %a = fadd <4 x double> %v0, %vl 98 ret <4 x double> %a 99} 100 101define <4 x double> @test1la(<4 x double>* align 32 %h) #0 { 102entry: 103 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1 104 %hv = bitcast <4 x double>* %h1 to i8* 105 %vl = call <4 x double> @llvm.ppc.qpx.qvlfd(i8* %hv) 106 107; CHECK-LABEL: @test1la 108; CHECK-NOT: @llvm.ppc.qpx.qvlfd 109; CHECK: ret <4 x double> 110 111 %v0 = load <4 x double>, <4 x double>* %h, align 8 112 %a = fadd <4 x double> %v0, %vl 113 ret <4 x double> %a 114} 115 116declare void @llvm.ppc.qpx.qvstfd(<4 x double>, i8*) #0 117 118define <4 x double> @test2l(<4 x double>* %h, <4 x double> %d) #0 { 119entry: 120 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1 121 %hv = bitcast <4 x double>* %h1 to i8* 122 call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv) 123 124 %v0 = load <4 x double>, <4 x double>* %h, align 8 125 ret <4 x double> %v0 126 127; CHECK-LABEL: @test2l 128; CHECK: @llvm.ppc.qpx.qvstfd 129; CHECK: ret <4 x double> 130} 131 132define <4 x double> @test2ln(<4 x double>* align 16 %h, <4 x double> %d) #0 { 133entry: 134 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1 135 %hv = bitcast <4 x double>* %h1 to i8* 136 call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv) 137 138 %v0 = load <4 x double>, <4 x double>* %h, align 8 139 ret <4 x double> %v0 140 141; CHECK-LABEL: @test2ln 142; CHECK: @llvm.ppc.qpx.qvstfd 143; CHECK: ret <4 x double> 144} 145 146define <4 x double> @test2la(<4 x double>* align 32 %h, <4 x double> %d) #0 { 147entry: 148 %h1 = getelementptr <4 x double>, <4 x double>* %h, i64 1 149 %hv = bitcast <4 x double>* %h1 to i8* 150 call void @llvm.ppc.qpx.qvstfd(<4 x double> %d, i8* %hv) 151 152 %v0 = load <4 x double>, <4 x double>* %h, align 8 153 ret <4 x double> %v0 154 155; CHECK-LABEL: @test2l 156; CHECK-NOT: @llvm.ppc.qpx.qvstfd 157; CHECK: ret <4 x double> 158} 159 160attributes #0 = { nounwind } 161attributes #1 = { nounwind readonly } 162 163