annotate test/Transforms/InstCombine/vec_demanded_elts.ll @ 121:803732b1fca8

LLVM 5.0
author kono
date Fri, 27 Oct 2017 17:07:41 +0900
parents 1172e4bd9c6f
children 3a76565eade5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 define i32 @test2(float %f) {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 ; CHECK-LABEL: @test2(
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
7 ; CHECK-NEXT: [[TMP5:%.*]] = fmul float %f, %f
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
8 ; CHECK-NEXT: [[TMP21:%.*]] = bitcast float [[TMP5]] to i32
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
9 ; CHECK-NEXT: ret i32 [[TMP21]]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
10 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 %tmp5 = fmul float %f, %f
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 %tmp9 = insertelement <4 x float> undef, float %tmp5, i32 0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 %tmp10 = insertelement <4 x float> %tmp9, float 0.000000e+00, i32 1
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 %tmp19 = bitcast <4 x float> %tmp12 to <4 x i32>
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 %tmp21 = extractelement <4 x i32> %tmp19, i32 0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 ret i32 %tmp21
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 define void @get_image() nounwind {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 ; CHECK-LABEL: @get_image(
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
23 ; CHECK-NEXT: entry:
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
24 ; CHECK-NEXT: [[TMP0:%.*]] = call i32 @fgetc(i8* null) #0
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
25 ; CHECK-NEXT: br i1 false, label %bb2, label %bb3
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
26 ; CHECK: bb2:
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
27 ; CHECK-NEXT: br label %bb3
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
28 ; CHECK: bb3:
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
29 ; CHECK-NEXT: unreachable
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
30 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 entry:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 %0 = call i32 @fgetc(i8* null) nounwind ; <i32> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 %1 = trunc i32 %0 to i8 ; <i8> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 %tmp2 = insertelement <100 x i8> zeroinitializer, i8 %1, i32 1 ; <<100 x i8>> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 %tmp1 = extractelement <100 x i8> %tmp2, i32 0 ; <i8> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 %2 = icmp eq i8 %tmp1, 80 ; <i1> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 br i1 %2, label %bb2, label %bb3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 bb2: ; preds = %entry
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 br label %bb3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 bb3: ; preds = %bb2, %entry
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 unreachable
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 ; PR4340
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 define void @vac(<4 x float>* nocapture %a) nounwind {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 ; CHECK-LABEL: @vac(
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
49 ; CHECK-NEXT: entry:
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
50 ; CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* %a, align 16
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
51 ; CHECK-NEXT: ret void
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
52 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 entry:
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
54 %tmp1 = load <4 x float>, <4 x float>* %a ; <<4 x float>> [#uses=1]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
55 %vecins = insertelement <4 x float> %tmp1, float 0.000000e+00, i32 0 ; <<4 x float>> [#uses=1]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
56 %vecins4 = insertelement <4 x float> %vecins, float 0.000000e+00, i32 1; <<4 x float>> [#uses=1]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
57 %vecins6 = insertelement <4 x float> %vecins4, float 0.000000e+00, i32 2; <<4 x float>> [#uses=1]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
58 %vecins8 = insertelement <4 x float> %vecins6, float 0.000000e+00, i32 3; <<4 x float>> [#uses=1]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
59 store <4 x float> %vecins8, <4 x float>* %a
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
60 ret void
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 declare i32 @fgetc(i8*)
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 define <4 x float> @dead_shuffle_elt(<4 x float> %x, <2 x float> %y) nounwind {
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
66 ; CHECK-LABEL: @dead_shuffle_elt(
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
67 ; CHECK-NEXT: [[SHUFFLE_I:%.*]] = shufflevector <2 x float> %y, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
68 ; CHECK-NEXT: [[SHUFFLE9_I:%.*]] = shufflevector <4 x float> %x, <4 x float> [[SHUFFLE_I]], <4 x i32> <i32 4, i32 5, i32 2, i32 3>
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
69 ; CHECK-NEXT: ret <4 x float> [[SHUFFLE9_I]]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
70 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 %shuffle.i = shufflevector <2 x float> %y, <2 x float> %y, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 %shuffle9.i = shufflevector <4 x float> %x, <4 x float> %shuffle.i, <4 x i32> <i32 4, i32 5, i32 2, i32 3>
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 ret <4 x float> %shuffle9.i
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 define <2 x float> @test_fptrunc(double %f) {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 ; CHECK-LABEL: @test_fptrunc(
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
78 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> <double undef, double 0.000000e+00>, double %f, i32 0
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
79 ; CHECK-NEXT: [[TMP2:%.*]] = fptrunc <2 x double> [[TMP1]] to <2 x float>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
80 ; CHECK-NEXT: ret <2 x float> [[TMP2]]
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
81 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 %tmp9 = insertelement <4 x double> undef, double %f, i32 0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 %tmp10 = insertelement <4 x double> %tmp9, double 0.000000e+00, i32 1
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 %tmp11 = insertelement <4 x double> %tmp10, double 0.000000e+00, i32 2
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 %tmp12 = insertelement <4 x double> %tmp11, double 0.000000e+00, i32 3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 %tmp5 = fptrunc <4 x double> %tmp12 to <4 x float>
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 %ret = shufflevector <4 x float> %tmp5, <4 x float> undef, <2 x i32> <i32 0, i32 1>
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 ret <2 x float> %ret
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 define <2 x double> @test_fpext(float %f) {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 ; CHECK-LABEL: @test_fpext(
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
93 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x float> <float undef, float 0.000000e+00>, float %f, i32 0
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
94 ; CHECK-NEXT: [[TMP2:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
95 ; CHECK-NEXT: ret <2 x double> [[TMP2]]
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
96 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 %tmp9 = insertelement <4 x float> undef, float %f, i32 0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 %tmp10 = insertelement <4 x float> %tmp9, float 0.000000e+00, i32 1
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, i32 2
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 %tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, i32 3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 %tmp5 = fpext <4 x float> %tmp12 to <4 x double>
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 %ret = shufflevector <4 x double> %tmp5, <4 x double> undef, <2 x i32> <i32 0, i32 1>
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 ret <2 x double> %ret
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
106 define <4 x double> @test_shuffle(<4 x double> %f) {
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
107 ; CHECK-LABEL: @test_shuffle(
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
108 ; CHECK-NEXT: [[RET1:%.*]] = insertelement <4 x double> %f, double 1.000000e+00, i32 3
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
109 ; CHECK-NEXT: ret <4 x double> [[RET1]]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
110 ;
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
111 %ret = shufflevector <4 x double> %f, <4 x double> <double undef, double 1.0, double undef, double undef>, <4 x i32> <i32 0, i32 1, i32 2, i32 5>
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
112 ret <4 x double> %ret
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
113 }
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
114
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 define <4 x float> @test_select(float %f, float %g) {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 ; CHECK-LABEL: @test_select(
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
117 ; CHECK-NEXT: [[A3:%.*]] = insertelement <4 x float> <float undef, float undef, float undef, float 3.000000e+00>, float %f, i32 0
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
118 ; CHECK-NEXT: [[RET:%.*]] = shufflevector <4 x float> [[A3]], <4 x float> <float undef, float 4.000000e+00, float 5.000000e+00, float undef>, <4 x i32> <i32 0, i32 5, i32 6, i32 3>
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
119 ; CHECK-NEXT: ret <4 x float> [[RET]]
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
120 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 %a0 = insertelement <4 x float> undef, float %f, i32 0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 %a1 = insertelement <4 x float> %a0, float 1.000000e+00, i32 1
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 %a2 = insertelement <4 x float> %a1, float 2.000000e+00, i32 2
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 %a3 = insertelement <4 x float> %a2, float 3.000000e+00, i32 3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 %b0 = insertelement <4 x float> undef, float %g, i32 0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 %b1 = insertelement <4 x float> %b0, float 4.000000e+00, i32 1
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 %b2 = insertelement <4 x float> %b1, float 5.000000e+00, i32 2
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 %b3 = insertelement <4 x float> %b2, float 6.000000e+00, i32 3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 %ret = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x float> %a3, <4 x float> %b3
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 ret <4 x float> %ret
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
133 ; Check that instcombine doesn't wrongly fold away the select completely.
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
134 ; TODO: Should this be an insertelement rather than a shuffle?
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
135
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
136 define <2 x i64> @PR24922(<2 x i64> %v) {
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
137 ; CHECK-LABEL: @PR24922(
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
138 ; CHECK-NEXT: [[RESULT1:%.*]] = insertelement <2 x i64> %v, i64 0, i32 0
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
139 ; CHECK-NEXT: ret <2 x i64> [[RESULT1]]
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
140 ;
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
141 %result = select <2 x i1> <i1 icmp eq (i64 extractelement (<2 x i64> bitcast (<4 x i32> <i32 15, i32 15, i32 15, i32 15> to <2 x i64>), i64 0), i64 0), i1 true>, <2 x i64> %v, <2 x i64> zeroinitializer
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
142 ret <2 x i64> %result
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
143 }
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 95
diff changeset
144
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
145 ; The shuffle only demands the 0th (undef) element of 'out123', so everything should fold away.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
146
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
147 define <4 x float> @inselt_shuf_no_demand(float %a1, float %a2, float %a3) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
148 ; CHECK-LABEL: @inselt_shuf_no_demand(
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
149 ; CHECK-NEXT: ret <4 x float> undef
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
150 ;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
151 %out1 = insertelement <4 x float> undef, float %a1, i32 1
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
152 %out12 = insertelement <4 x float> %out1, float %a2, i32 2
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
153 %out123 = insertelement <4 x float> %out12, float %a3, i32 3
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
154 %shuffle = shufflevector <4 x float> %out123, <4 x float> undef, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
155 ret <4 x float> %shuffle
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
156 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
157
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
158 ; The shuffle only demands the 0th (undef) element of 'out123', so everything should fold away.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
159
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
160 define <4 x float> @inselt_shuf_no_demand_commute(float %a1, float %a2, float %a3) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
161 ; CHECK-LABEL: @inselt_shuf_no_demand_commute(
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
162 ; CHECK-NEXT: ret <4 x float> undef
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
163 ;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
164 %out1 = insertelement <4 x float> undef, float %a1, i32 1
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
165 %out12 = insertelement <4 x float> %out1, float %a2, i32 2
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
166 %out123 = insertelement <4 x float> %out12, float %a3, i32 3
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
167 %shuffle = shufflevector <4 x float> undef, <4 x float> %out123, <4 x i32> <i32 4, i32 undef, i32 undef, i32 undef>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
168 ret <4 x float> %shuffle
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
169 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
170
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
171 ; The add uses 'out012' giving it multiple uses after the shuffle is transformed to also
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
172 ; use 'out012'. The analysis should be able to see past that.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
173
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
174 define <4 x i32> @inselt_shuf_no_demand_multiuse(i32 %a0, i32 %a1, <4 x i32> %b) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
175 ; CHECK-LABEL: @inselt_shuf_no_demand_multiuse(
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
176 ; CHECK-NEXT: [[OUT0:%.*]] = insertelement <4 x i32> undef, i32 %a0, i32 0
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
177 ; CHECK-NEXT: [[OUT01:%.*]] = insertelement <4 x i32> [[OUT0]], i32 %a1, i32 1
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
178 ; CHECK-NEXT: [[FOO:%.*]] = add <4 x i32> [[OUT01]], %b
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
179 ; CHECK-NEXT: ret <4 x i32> [[FOO]]
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
180 ;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
181 %out0 = insertelement <4 x i32> undef, i32 %a0, i32 0
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
182 %out01 = insertelement <4 x i32> %out0, i32 %a1, i32 1
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
183 %out012 = insertelement <4 x i32> %out01, i32 %a0, i32 2
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
184 %foo = add <4 x i32> %out012, %b
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
185 %out0123 = insertelement <4 x i32> %foo, i32 %a1, i32 3
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
186 %shuffle = shufflevector <4 x i32> %out0123, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
187 ret <4 x i32> %shuffle
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
188 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
189
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
190 ; FIXME: We should be able to look past the bogus use of 'out12' and kill 'out1'.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
191
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
192 define <4 x float> @inselt_shuf_no_demand_bogus_insert_index_in_chain(float %a1, float %a2, float %a3, i32 %variable_index) {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
193 ; CHECK-LABEL: @inselt_shuf_no_demand_bogus_insert_index_in_chain(
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
194 ; CHECK-NEXT: [[OUT1:%.*]] = insertelement <4 x float> undef, float %a1, i32 1
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
195 ; CHECK-NEXT: ret <4 x float> [[OUT1]]
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
196 ;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
197 %out1 = insertelement <4 x float> undef, float %a1, i32 1
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
198 %out12 = insertelement <4 x float> %out1, float %a2, i32 undef ; something unexpected
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
199 %out123 = insertelement <4 x float> %out12, float %a3, i32 3
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
200 %shuffle = shufflevector <4 x float> %out123, <4 x float> undef, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
201 ret <4 x float> %shuffle
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
202 }
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
203