@@ -20,16 +20,6 @@ struct S test_select_infer_struct(bool cond0, struct S tVal, struct S fVal) {
2020 return select (cond0, tVal, fVal);
2121}
2222
23- // CHECK-LABEL: test_select_infer_array
24- // CHECK: [[TRUE_VAL:%.*]] = load [3 x i32], ptr {{%.*}}, align 4
25- // CHECK: [[FALSE_VAL:%.*]] = load [3 x i32], ptr {{%.*}}, align 4
26- // CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, [3 x i32] [[TRUE_VAL]], [3 x i32] [[FALSE_VAL]]
27- // CHECK: store [3 x i32] [[SELECT]], ptr {{%.*}}, align 4
28- // CHECK: ret void
29- int test_select_infer_array (bool cond, int tVal[3 ], int fVal[3 ])[3 ] {
30- return select (cond, tVal, fVal);
31- }
32-
3323// CHECK-LABEL: test_select_bool_vector
3424// CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> {{%.*}}
3525// CHECK: ret <2 x i32> [[SELECT]]
@@ -38,24 +28,24 @@ int2 test_select_bool_vector(bool cond0, int2 tVal, int2 fVal) {
3828}
3929
4030// CHECK-LABEL: test_select_vector_1
41- // CHECK: [[SELECT:%.*]] = select <1 x i1> {{%.*}}, <1 x i32> {{%.*}}, <1 x i32> {{%.*}}
31+ // CHECK: [[SELECT:%.*]] = select i1 {{%.*}}, <1 x i32> {{%.*}}, <1 x i32> {{%.*}}
4232// CHECK: ret <1 x i32> [[SELECT]]
4333int1 test_select_vector_1 (bool1 cond0, int1 tVals, int1 fVals) {
44- return select< int , 1 > (cond0, tVals, fVals);
34+ return select (cond0, tVals, fVals);
4535}
4636
4737// CHECK-LABEL: test_select_vector_2
4838// CHECK: [[SELECT:%.*]] = select <2 x i1> {{%.*}}, <2 x i32> {{%.*}}, <2 x i32> {{%.*}}
4939// CHECK: ret <2 x i32> [[SELECT]]
5040int2 test_select_vector_2 (bool2 cond0, int2 tVals, int2 fVals) {
51- return select< int , 2 > (cond0, tVals, fVals);
41+ return select (cond0, tVals, fVals);
5242}
5343
5444// CHECK-LABEL: test_select_vector_3
5545// CHECK: [[SELECT:%.*]] = select <3 x i1> {{%.*}}, <3 x i32> {{%.*}}, <3 x i32> {{%.*}}
5646// CHECK: ret <3 x i32> [[SELECT]]
5747int3 test_select_vector_3 (bool3 cond0, int3 tVals, int3 fVals) {
58- return select< int , 3 > (cond0, tVals, fVals);
48+ return select (cond0, tVals, fVals);
5949}
6050
6151// CHECK-LABEL: test_select_vector_4
@@ -86,10 +76,54 @@ int4 test_select_vector_vector_scalar(bool4 cond0, int4 tVals, int fVal) {
8676// CHECK-LABEL: test_select_vector_scalar_scalar
8777// CHECK: [[SPLAT_SRC1:%.*]] = insertelement <4 x i32> poison, i32 {{%.*}}, i64 0
8878// CHECK: [[SPLAT1:%.*]] = shufflevector <4 x i32> [[SPLAT_SRC1]], <4 x i32> poison, <4 x i32> zeroinitializer
89- // CHECK: [[SPLAT_SRC2:%.*]] = insertelement <4 x i32> poison, i32 %3 , i64 0
79+ // CHECK: [[SPLAT_SRC2:%.*]] = insertelement <4 x i32> poison, i32 {{%.*}} , i64 0
9080// CHECK: [[SPLAT2:%.*]] = shufflevector <4 x i32> [[SPLAT_SRC2]], <4 x i32> poison, <4 x i32> zeroinitializer
9181// CHECK: [[SELECT:%.*]] = select <4 x i1> {{%.*}}, <4 x i32> [[SPLAT1]], <4 x i32> [[SPLAT2]]
9282// CHECK: ret <4 x i32> [[SELECT]]
9383int4 test_select_vector_scalar_scalar (bool4 cond0, int tVal, int fVal) {
9484 return select (cond0, tVal, fVal);
9585}
86+
87+ // CHECK-LABEL: test_select_nonbool_cond_vector_4
88+ // CHECK: [[TMP0:%.*]] = load <4 x i32>, ptr %cond0.addr, align 16
89+ // CHECK: [[TOBOOL:%.*]] = icmp ne <4 x i32> [[TMP0]], zeroinitializer
90+ // CHECK: [[SELECT:%.*]] = select <4 x i1> [[TOBOOL]], <4 x i1> {{%.*}}, <4 x i1> {{%.*}}
91+ // CHECK: ret <4 x i1> [[SELECT]]
92+ bool4 test_select_nonbool_cond_vector_4 (int4 cond0, bool4 tVal, bool4 fVal) {
93+ return select (cond0, tVal, fVal);
94+ }
95+
96+ // CHECK-LABEL: test_select_nonbool_cond_vector_scalar_vector
97+ // CHECK: [[TMP0:%.*]] = load <3 x i32>, ptr %cond0.addr, align 16
98+ // CHECK: [[TOBOOL:%.*]] = icmp ne <3 x i32> [[TMP0]], zeroinitializer
99+ // CHECK: [[SPLAT_SRC1:%.*]] = insertelement <3 x i32> poison, i32 {{%.*}}, i64 0
100+ // CHECK: [[SPLAT1:%.*]] = shufflevector <3 x i32> [[SPLAT_SRC1]], <3 x i32> poison, <3 x i32> zeroinitializer
101+ // CHECK: [[SELECT:%.*]] = select <3 x i1> [[TOBOOL]], <3 x i32> [[SPLAT1]], <3 x i32> {{%.*}}
102+ // CHECK: ret <3 x i32> [[SELECT]]
103+ int3 test_select_nonbool_cond_vector_scalar_vector (int3 cond0, int tVal, int3 fVal) {
104+ return select (cond0, tVal, fVal);
105+ }
106+
107+ // CHECK-LABEL: test_select_nonbool_cond_vector_vector_scalar
108+ // CHECK: [[TMP0:%.*]] = load <2 x i32>, ptr %cond0.addr, align 8
109+ // CHECK: [[TOBOOL:%.*]] = icmp ne <2 x i32> [[TMP0]], zeroinitializer
110+ // CHECK: [[SPLAT_SRC1:%.*]] = insertelement <2 x i32> poison, i32 {{%.*}}, i64 0
111+ // CHECK: [[SPLAT1:%.*]] = shufflevector <2 x i32> [[SPLAT_SRC1]], <2 x i32> poison, <2 x i32> zeroinitializer
112+ // CHECK: [[SELECT:%.*]] = select <2 x i1> [[TOBOOL]], <2 x i32> {{%.*}}, <2 x i32> [[SPLAT1]]
113+ // CHECK: ret <2 x i32> [[SELECT]]
114+ int2 test_select_nonbool_cond_vector_vector_scalar (int2 cond0, int2 tVal, int fVal) {
115+ return select (cond0, tVal, fVal);
116+ }
117+
118+ // CHECK-LABEL: test_select_nonbool_cond_vector_scalar_scalar
119+ // CHECK: [[TMP0:%.*]] = load <4 x i32>, ptr %cond0.addr, align 16
120+ // CHECK: [[TOBOOL:%.*]] = icmp ne <4 x i32> [[TMP0]], zeroinitializer
121+ // CHECK: [[SPLAT_SRC1:%.*]] = insertelement <4 x i32> poison, i32 {{%.*}}, i64 0
122+ // CHECK: [[SPLAT1:%.*]] = shufflevector <4 x i32> [[SPLAT_SRC1]], <4 x i32> poison, <4 x i32> zeroinitializer
123+ // CHECK: [[SPLAT_SRC2:%.*]] = insertelement <4 x i32> poison, i32 {{%.*}}, i64 0
124+ // CHECK: [[SPLAT2:%.*]] = shufflevector <4 x i32> [[SPLAT_SRC2]], <4 x i32> poison, <4 x i32> zeroinitializer
125+ // CHECK: [[SELECT:%.*]] = select <4 x i1> [[TOBOOL]], <4 x i32> [[SPLAT1]], <4 x i32> [[SPLAT2]]
126+ // CHECK: ret <4 x i32> [[SELECT]]
127+ int4 test_select_nonbool_cond_vector_scalar_scalar (int4 cond0, int tVal, int fVal) {
128+ return select (cond0, tVal, fVal);
129+ }
0 commit comments