Home | History | Annotate | Download | only in InstCombine
      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"
      4 
      5 declare <4 x double> @llvm.ppc.qpx.qvlfs(i8*) #1
      6 
      7 define <4 x double> @test1(<4 x float>* %h) #0 {
      8 entry:
      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 
     23 define <4 x double> @test1a(<4 x float>* align 16 %h) #0 {
     24 entry:
     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 
     40 declare void @llvm.ppc.qpx.qvstfs(<4 x double>, i8*) #0
     41 
     42 define <4 x float> @test2(<4 x float>* %h, <4 x double> %d) #0 {
     43 entry:
     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 
     56 define <4 x float> @test2a(<4 x float>* align 16 %h, <4 x double> %d) #0 {
     57 entry:
     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 
     72 declare <4 x double> @llvm.ppc.qpx.qvlfd(i8*) #1
     73 
     74 define <4 x double> @test1l(<4 x double>* %h) #0 {
     75 entry:
     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 
     89 define <4 x double> @test1ln(<4 x double>* align 16 %h) #0 {
     90 entry:
     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 
    104 define <4 x double> @test1la(<4 x double>* align 32 %h) #0 {
    105 entry:
    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 
    119 declare void @llvm.ppc.qpx.qvstfd(<4 x double>, i8*) #0
    120 
    121 define <4 x double> @test2l(<4 x double>* %h, <4 x double> %d) #0 {
    122 entry:
    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 
    135 define <4 x double> @test2ln(<4 x double>* align 16 %h, <4 x double> %d) #0 {
    136 entry:
    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 
    149 define <4 x double> @test2la(<4 x double>* align 32 %h, <4 x double> %d) #0 {
    150 entry:
    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 
    163 attributes #0 = { nounwind }
    164 attributes #1 = { nounwind readonly }
    165 
    166