72 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4declare <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16>)5declare <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16>)6 7;8; Vector Demanded Elts9;10 11; Only bottom 4 elements required.12define <4 x float> @demand_vcvtph2ps_128(<8 x i16> %A) {13; CHECK-LABEL: @demand_vcvtph2ps_128(14; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x i16> [[A:%.*]], <8 x i16> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>15; CHECK-NEXT: [[TMP2:%.*]] = bitcast <4 x i16> [[TMP1]] to <4 x half>16; CHECK-NEXT: [[CVTPH2PS:%.*]] = fpext <4 x half> [[TMP2]] to <4 x float>17; CHECK-NEXT: ret <4 x float> [[CVTPH2PS]]18;19 %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>20 %2 = tail call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %1)21 ret <4 x float> %222}23 24; All 8 elements required.25define <8 x float> @demand_vcvtph2ps_256(<8 x i16> %A) {26; CHECK-LABEL: @demand_vcvtph2ps_256(27; CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x i16> [[A:%.*]] to <8 x half>28; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <8 x half> [[TMP1]], <8 x half> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>29; CHECK-NEXT: [[CVTPH2PS:%.*]] = fpext <8 x half> [[TMP2]] to <8 x float>30; CHECK-NEXT: ret <8 x float> [[CVTPH2PS]]31;32 %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>33 %2 = tail call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> %1)34 ret <8 x float> %235}36 37;38; Constant Folding39;40 41define <4 x float> @fold_vcvtph2ps_128() {42; CHECK-LABEL: @fold_vcvtph2ps_128(43; CHECK-NEXT: ret <4 x float> <float 0.000000e+00, float 5.000000e-01, float 1.000000e+00, float -0.000000e+00>44;45 %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>)46 ret <4 x float> %147}48 49define <8 x float> @fold_vcvtph2ps_256() {50; CHECK-LABEL: @fold_vcvtph2ps_256(51; 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>52;53 %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>)54 ret <8 x float> %155}56 57define <4 x float> @fold_vcvtph2ps_128_zero() {58; CHECK-LABEL: @fold_vcvtph2ps_128_zero(59; CHECK-NEXT: ret <4 x float> zeroinitializer60;61 %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>)62 ret <4 x float> %163}64 65define <8 x float> @fold_vcvtph2ps_256_zero() {66; CHECK-LABEL: @fold_vcvtph2ps_256_zero(67; CHECK-NEXT: ret <8 x float> zeroinitializer68;69 %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>)70 ret <8 x float> %171}72