@@ -9,7 +9,7 @@ declare i32 @strcmp(ptr, ptr)
9
9
@s3 = constant [4 x i8 ] c "012\00 "
10
10
@s4 = constant [5 x i8 ] c "0123\00 "
11
11
12
- ; Expand strcmp(C, "x").
12
+ ; Expand strcmp(C, "x"), strcmp(C, "xy") .
13
13
14
14
define i1 @expand_strcmp_s0 (ptr %C ) {
15
15
; CHECK-LABEL: @expand_strcmp_s0(
@@ -207,8 +207,8 @@ define i32 @expand_strcmp_s1_fail_3(ptr %C) {
207
207
ret i32 %call
208
208
}
209
209
210
- define i1 @expand_strcmp_s2 (ptr %C ) {
211
- ; CHECK-LABEL: @expand_strcmp_s2 (
210
+ define i1 @expand_strcmp_eq_s2 (ptr %C ) {
211
+ ; CHECK-LABEL: @expand_strcmp_eq_s2 (
212
212
; CHECK-NEXT: [[CALL:%.*]] = call i32 @strcmp(ptr [[C:%.*]], ptr @s2)
213
213
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[CALL]], 0
214
214
; CHECK-NEXT: ret i1 [[CMP]]
@@ -218,6 +218,61 @@ define i1 @expand_strcmp_s2(ptr %C) {
218
218
ret i1 %cmp
219
219
}
220
220
221
+ define i1 @expand_strcmp_ne_s2 (ptr %C ) {
222
+ ; CHECK-LABEL: @expand_strcmp_ne_s2(
223
+ ; CHECK-NEXT: [[CALL:%.*]] = call i32 @strcmp(ptr [[C:%.*]], ptr @s2)
224
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[CALL]], 0
225
+ ; CHECK-NEXT: ret i1 [[CMP]]
226
+ ;
227
+ %call = call i32 @strcmp (ptr %C , ptr @s2 )
228
+ %cmp = icmp ne i32 %call , 0
229
+ ret i1 %cmp
230
+ }
231
+
232
+ define i1 @expand_strcmp_sgt_s2 (ptr %C ) {
233
+ ; CHECK-LABEL: @expand_strcmp_sgt_s2(
234
+ ; CHECK-NEXT: [[CALL:%.*]] = call i32 @strcmp(ptr [[C:%.*]], ptr @s2)
235
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[CALL]], 0
236
+ ; CHECK-NEXT: ret i1 [[CMP]]
237
+ ;
238
+ %call = call i32 @strcmp (ptr %C , ptr @s2 )
239
+ %cmp = icmp sgt i32 %call , 0
240
+ ret i1 %cmp
241
+ }
242
+
243
+ define i1 @expand_strcmp_sge_s2 (ptr %C ) {
244
+ ; CHECK-LABEL: @expand_strcmp_sge_s2(
245
+ ; CHECK-NEXT: [[CALL:%.*]] = call i32 @strcmp(ptr [[C:%.*]], ptr @s2)
246
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[CALL]], 0
247
+ ; CHECK-NEXT: ret i1 [[CMP]]
248
+ ;
249
+ %call = call i32 @strcmp (ptr %C , ptr @s2 )
250
+ %cmp = icmp sge i32 %call , 0
251
+ ret i1 %cmp
252
+ }
253
+
254
+ define i1 @expand_strcmp_slt_s2 (ptr %C ) {
255
+ ; CHECK-LABEL: @expand_strcmp_slt_s2(
256
+ ; CHECK-NEXT: [[CALL:%.*]] = call i32 @strcmp(ptr [[C:%.*]], ptr @s2)
257
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[CALL]], 0
258
+ ; CHECK-NEXT: ret i1 [[CMP]]
259
+ ;
260
+ %call = call i32 @strcmp (ptr %C , ptr @s2 )
261
+ %cmp = icmp slt i32 %call , 0
262
+ ret i1 %cmp
263
+ }
264
+
265
+ define i1 @expand_strcmp_sle_s2 (ptr %C ) {
266
+ ; CHECK-LABEL: @expand_strcmp_sle_s2(
267
+ ; CHECK-NEXT: [[CALL:%.*]] = call i32 @strcmp(ptr [[C:%.*]], ptr @s2)
268
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp sle i32 [[CALL]], 0
269
+ ; CHECK-NEXT: ret i1 [[CMP]]
270
+ ;
271
+ %call = call i32 @strcmp (ptr %C , ptr @s2 )
272
+ %cmp = icmp sle i32 %call , 0
273
+ ret i1 %cmp
274
+ }
275
+
221
276
define i1 @expand_strcmp_s3 (ptr %C ) {
222
277
; CHECK-LABEL: @expand_strcmp_s3(
223
278
; CHECK-NEXT: [[CALL:%.*]] = call i32 @strcmp(ptr [[C:%.*]], ptr @s3)
0 commit comments