Home | History | Annotate | Download | only in InstCombine
      1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
      2 ; RUN: opt < %s -instcombine -S | FileCheck %s
      3 
      4 declare <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16>)
      5 declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>)
      6 
      7 ;
      8 ; Vector Demanded Bits
      9 ;
     10 
     11 ; Only bottom 4 elements required.
     12 define <4 x float> @demand_vcvtph2ps_128(<8 x i16> %A) {
     13 ; CHECK-LABEL: @demand_vcvtph2ps_128(
     14 ; CHECK-NEXT:    [[TMP1:%.*]] = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %A)
     15 ; CHECK-NEXT:    ret <4 x float> [[TMP1]]
     16 ;
     17   %1 = shufflevector <8 x i16> %A, <8 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
     18   %2 = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %1)
     19   ret <4 x float> %2
     20 }
     21 
     22 ; All 8 elements required.
     23 define <8 x float> @demand_vcvtph2ps_256(<8 x i16> %A) {
     24 ; CHECK-LABEL: @demand_vcvtph2ps_256(
     25 ; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <8 x i16> %A, <8 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
     26 ; CHECK-NEXT:    [[TMP2:%.*]] = tail call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> [[TMP1]])
     27 ; CHECK-NEXT:    ret <8 x float> [[TMP2]]
     28 ;
     29   %1 = shufflevector <8 x i16> %A, <8 x i16> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
     30   %2 = tail call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> %1)
     31   ret <8 x float> %2
     32 }
     33 
     34 ;
     35 ; Constant Folding
     36 ;
     37 
     38 define <4 x float> @fold_vcvtph2ps_128() {
     39 ; CHECK-LABEL: @fold_vcvtph2ps_128(
     40 ; CHECK-NEXT:    ret <4 x float> <float 0.000000e+00, float 5.000000e-01, float 1.000000e+00, float -0.000000e+00>
     41 ;
     42   %1 = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> <i16 0, i16 14336, i16 15360, i16 32768, i16 16384, i16 31743, i16 48128, i16 49152>)
     43   ret <4 x float> %1
     44 }
     45 
     46 define <8 x float> @fold_vcvtph2ps_256() {
     47 ; CHECK-LABEL: @fold_vcvtph2ps_256(
     48 ; CHECK-NEXT:    ret <8 x float> <float 0.000000e+00, float 5.000000e-01, float 1.000000e+00, float -0.000000e+00, float 2.000000e+00, float 6.550400e+04, float -1.000000e+00, float -2.000000e+00>
     49 ;
     50   %1 = tail call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> <i16 0, i16 14336, i16 15360, i16 32768, i16 16384, i16 31743, i16 48128, i16 49152>)
     51   ret <8 x float> %1
     52 }
     53 
     54 define <4 x float> @fold_vcvtph2ps_128_zero() {
     55 ; CHECK-LABEL: @fold_vcvtph2ps_128_zero(
     56 ; CHECK-NEXT:    ret <4 x float> zeroinitializer
     57 ;
     58   %1 = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>)
     59   ret <4 x float> %1
     60 }
     61 
     62 define <8 x float> @fold_vcvtph2ps_256_zero() {
     63 ; CHECK-LABEL: @fold_vcvtph2ps_256_zero(
     64 ; CHECK-NEXT:    ret <8 x float> zeroinitializer
     65 ;
     66   %1 = tail call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>)
     67   ret <8 x float> %1
     68 }
     69