| OLD | NEW |
| 1 ; RUN: opt < %s -instcombine -S | FileCheck %s | 1 ; RUN: opt < %s -instcombine -S | FileCheck %s |
| 2 | 2 |
| 3 define i16 @test1(float %f) { | 3 define i16 @test1(float %f) { |
| 4 entry: | 4 entry: |
| 5 ; CHECK: @test1 | 5 ; CHECK: @test1 |
| 6 ; CHECK: fmul float | 6 ; CHECK: fmul float |
| 7 ; CHECK-NOT: insertelement {{.*}} 0.00 | 7 ; CHECK-NOT: insertelement {{.*}} 0.00 |
| 8 ; CHECK-NOT: call {{.*}} @llvm.x86.sse.mul | 8 ; CHECK-NOT: call {{.*}} @llvm.x86.sse.mul |
| 9 ; CHECK-NOT: call {{.*}} @llvm.x86.sse.sub | 9 ; CHECK-NOT: call {{.*}} @llvm.x86.sse.sub |
| 10 ; CHECK: ret | 10 ; CHECK: ret |
| 11 %tmp = insertelement <4 x float> undef, float %f, i32 0 ; <<4 x
float>> [#uses=1] | 11 %tmp = insertelement <4 x float> undef, float %f, i32 0 ; <<4 x
float>> [#uses=1] |
| 12 %tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, i32 1
; <<4 x float>> [#uses=1] | 12 %tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, i32 1
; <<4 x float>> [#uses=1] |
| 13 %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2
; <<4 x float>> [#uses=1] | 13 %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2
; <<4 x float>> [#uses=1] |
| 14 %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3
; <<4 x float>> [#uses=1] | 14 %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3
; <<4 x float>> [#uses=1] |
| 15 %tmp28 = tail call <4 x float> @llvm.x86.sse.sub.ss( <4 x float> %tmp12,
<4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float
0.000000e+00 > ) ; <<4 x float>> [#uses=1] | 15 %tmp28 = tail call <4 x float> @llvm.x86.sse.sub.ss( <4 x float> %tmp12,
<4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float
0.000000e+00 > ) ; <<4 x float>> [#uses=1] |
| 16 %tmp37 = tail call <4 x float> @llvm.x86.sse.mul.ss( <4 x float> %tmp28,
<4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float
0.000000e+00 > ) ; <<4 x float>> [#uses=1] | 16 %tmp37 = tail call <4 x float> @llvm.x86.sse.mul.ss( <4 x float> %tmp28,
<4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float
0.000000e+00 > ) ; <<4 x float>> [#uses=1] |
| 17 %tmp48 = tail call <4 x float> @llvm.x86.sse.min.ss( <4 x float> %tmp37,
<4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float
0.000000e+00 > ) ; <<4 x float>> [#uses=1] | 17 %tmp48 = tail call <4 x float> @llvm.x86.sse.min.ss( <4 x float> %tmp37,
<4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float
0.000000e+00 > ) ; <<4 x float>> [#uses=1] |
| 18 %tmp59 = tail call <4 x float> @llvm.x86.sse.max.ss( <4 x float> %tmp48,
<4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1] | 18 %tmp59 = tail call <4 x float> @llvm.x86.sse.max.ss( <4 x float> %tmp48,
<4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1] |
| 19 %tmp.upgrd.1 = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59
) ; <i32> [#uses=1] | 19 %tmp.upgrd.1 = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59
) ; <i32> [#uses=1] |
| 20 %tmp69 = trunc i32 %tmp.upgrd.1 to i16 ; <i16> [#uses=1] | 20 %tmp69 = trunc i32 %tmp.upgrd.1 to i16 ; <i16> [#uses=1] |
| 21 ret i16 %tmp69 | 21 ret i16 %tmp69 |
| 22 } | 22 } |
| 23 | 23 |
| 24 define i32 @test2(float %f) { | |
| 25 ; CHECK: @test2 | |
| 26 ; CHECK-NOT: insertelement | |
| 27 ; CHECK-NOT: extractelement | |
| 28 ; CHECK: ret | |
| 29 %tmp5 = fmul float %f, %f | |
| 30 %tmp9 = insertelement <4 x float> undef, float %tmp5, i32 0 | |
| 31 %tmp10 = insertelement <4 x float> %tmp9, float 0.000000e+00, i32 1 | |
| 32 %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2 | |
| 33 %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3 | |
| 34 %tmp19 = bitcast <4 x float> %tmp12 to <4 x i32> | |
| 35 %tmp21 = extractelement <4 x i32> %tmp19, i32 0 | |
| 36 ret i32 %tmp21 | |
| 37 } | |
| 38 | |
| 39 define i64 @test3(float %f, double %d) { | 24 define i64 @test3(float %f, double %d) { |
| 40 ; CHECK: @test3 | 25 ; CHECK: @test3 |
| 41 ; CHECK-NOT: insertelement {{.*}} 0.00 | 26 ; CHECK-NOT: insertelement {{.*}} 0.00 |
| 42 ; CHECK: ret | 27 ; CHECK: ret |
| 43 entry: | 28 entry: |
| 44 %v00 = insertelement <4 x float> undef, float %f, i32 0 | 29 %v00 = insertelement <4 x float> undef, float %f, i32 0 |
| 45 %v01 = insertelement <4 x float> %v00, float 0.000000e+00, i32 1 | 30 %v01 = insertelement <4 x float> %v00, float 0.000000e+00, i32 1 |
| 46 %v02 = insertelement <4 x float> %v01, float 0.000000e+00, i32 2 | 31 %v02 = insertelement <4 x float> %v01, float 0.000000e+00, i32 2 |
| 47 %v03 = insertelement <4 x float> %v02, float 0.000000e+00, i32 3 | 32 %v03 = insertelement <4 x float> %v02, float 0.000000e+00, i32 3 |
| 48 %tmp0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> %v03) | 33 %tmp0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> %v03) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 77 %tmp9 = add i32 %tmp4, %tmp6 | 62 %tmp9 = add i32 %tmp4, %tmp6 |
| 78 %tmp10 = add i32 %tmp8, %tmp9 | 63 %tmp10 = add i32 %tmp8, %tmp9 |
| 79 %tmp11 = sext i32 %tmp10 to i64 | 64 %tmp11 = sext i32 %tmp10 to i64 |
| 80 %tmp12 = add i64 %tmp1, %tmp3 | 65 %tmp12 = add i64 %tmp1, %tmp3 |
| 81 %tmp13 = add i64 %tmp5, %tmp7 | 66 %tmp13 = add i64 %tmp5, %tmp7 |
| 82 %tmp14 = add i64 %tmp12, %tmp13 | 67 %tmp14 = add i64 %tmp12, %tmp13 |
| 83 %tmp15 = add i64 %tmp11, %tmp14 | 68 %tmp15 = add i64 %tmp11, %tmp14 |
| 84 ret i64 %tmp15 | 69 ret i64 %tmp15 |
| 85 } | 70 } |
| 86 | 71 |
| 87 define void @get_image() nounwind { | |
| 88 ; CHECK: @get_image | |
| 89 ; CHECK-NOT: extractelement | |
| 90 ; CHECK: unreachable | |
| 91 entry: | |
| 92 %0 = call i32 @fgetc(i8* null) nounwind ; <i32> [#uses=1] | |
| 93 %1 = trunc i32 %0 to i8 ; <i8> [#uses=1] | |
| 94 %tmp2 = insertelement <100 x i8> zeroinitializer, i8 %1, i32 1 ; <<10
0 x i8>> [#uses=1] | |
| 95 %tmp1 = extractelement <100 x i8> %tmp2, i32 0 ; <i8> [#uses=1] | |
| 96 %2 = icmp eq i8 %tmp1, 80 ; <i1> [#uses=1] | |
| 97 br i1 %2, label %bb2, label %bb3 | |
| 98 | |
| 99 bb2: ; preds = %entry | |
| 100 br label %bb3 | |
| 101 | |
| 102 bb3: ; preds = %bb2, %entry | |
| 103 unreachable | |
| 104 } | |
| 105 | |
| 106 ; PR4340 | |
| 107 define void @vac(<4 x float>* nocapture %a) nounwind { | |
| 108 ; CHECK: @vac | |
| 109 ; CHECK-NOT: load | |
| 110 ; CHECK: ret | |
| 111 entry: | |
| 112 %tmp1 = load <4 x float>* %a ; <<4 x float>> [#uses=1] | |
| 113 %vecins = insertelement <4 x float> %tmp1, float 0.000000e+00, i32 0
; <<4 x float>> [#uses=1] | |
| 114 %vecins4 = insertelement <4 x float> %vecins, float 0.000000e+00, i32 1;
<<4 x float>> [#uses=1] | |
| 115 %vecins6 = insertelement <4 x float> %vecins4, float 0.000000e+00, i32 2
; <<4 x float>> [#uses=1] | |
| 116 %vecins8 = insertelement <4 x float> %vecins6, float 0.000000e+00, i32 3
; <<4 x float>> [#uses=1] | |
| 117 store <4 x float> %vecins8, <4 x float>* %a | |
| 118 ret void | |
| 119 } | |
| 120 | |
| 121 declare i32 @fgetc(i8*) | |
| 122 | |
| 123 declare <4 x float> @llvm.x86.sse.sub.ss(<4 x float>, <4 x float>) | 72 declare <4 x float> @llvm.x86.sse.sub.ss(<4 x float>, <4 x float>) |
| 124 | 73 |
| 125 declare <4 x float> @llvm.x86.sse.mul.ss(<4 x float>, <4 x float>) | 74 declare <4 x float> @llvm.x86.sse.mul.ss(<4 x float>, <4 x float>) |
| 126 | 75 |
| 127 declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>) | 76 declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>) |
| 128 | 77 |
| 129 declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>) | 78 declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>) |
| 130 | 79 |
| 131 declare i32 @llvm.x86.sse.cvtss2si(<4 x float>) | 80 declare i32 @llvm.x86.sse.cvtss2si(<4 x float>) |
| 132 declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>) | 81 declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 145 ; CHECK: %tmp2 = shufflevector | 94 ; CHECK: %tmp2 = shufflevector |
| 146 %tmp2 = shufflevector <4 x i16> %tmp, <4 x i16> undef, <8 x i32> <i32 0,
i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef> | 95 %tmp2 = shufflevector <4 x i16> %tmp, <4 x i16> undef, <8 x i32> <i32 0,
i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef> |
| 147 ; pmovzxwd ignores the upper 64-bits of its input; -instcombine should remove th
is shuffle: | 96 ; pmovzxwd ignores the upper 64-bits of its input; -instcombine should remove th
is shuffle: |
| 148 ; CHECK-NOT: shufflevector | 97 ; CHECK-NOT: shufflevector |
| 149 %tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> <i32 8
, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7> | 98 %tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> <i32 8
, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7> |
| 150 ; CHECK-NEXT: pmovzxwd | 99 ; CHECK-NEXT: pmovzxwd |
| 151 %0 = call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> %tmp3) | 100 %0 = call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> %tmp3) |
| 152 ret <4 x i32> %0 | 101 ret <4 x i32> %0 |
| 153 } | 102 } |
| 154 declare <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16>) nounwind readnone | 103 declare <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16>) nounwind readnone |
| OLD | NEW |