@@ -379,219 +379,3 @@ body: |
379
379
CMP64ri32 %0, 24, implicit-def $eflags
380
380
$cl = SETCCr 3, implicit $eflags
381
381
...
382
- ---
383
- name : opt_redundant_flags_adjusted_imm_0
384
- body : |
385
- bb.0:
386
- ; CHECK-LABEL: name: opt_redundant_flags_adjusted_imm_0
387
- ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rsi
388
- ; CHECK-NEXT: CMP64ri8 [[COPY]], 1, implicit-def $eflags
389
- ; CHECK-NEXT: $cl = SETCCr 4, implicit $eflags
390
- ; CHECK-NEXT: $bl = SETCCr 15, implicit $eflags
391
- ; CHECK-NEXT: $bl = SETCCr 7, implicit $eflags
392
- ; CHECK-NEXT: $bl = SETCCr 14, implicit $eflags
393
- ; CHECK-NEXT: $bl = SETCCr 6, implicit $eflags
394
- %0:gr64 = COPY $rsi
395
- ; CMP+SETCC %0 == 1
396
- CMP64ri8 %0, 1, implicit-def $eflags
397
- $cl = SETCCr 4, implicit $eflags
398
- ; CMP+SETCC %0 >= 2; CMP can be removed.
399
- CMP64ri8 %0, 2, implicit-def $eflags
400
- ; %0 >=s 2 --> %0 >s 1
401
- $bl = SETCCr 13, implicit $eflags
402
- ; %0 >=u 2 --> %0 >u 1
403
- $bl = SETCCr 3, implicit $eflags
404
- ; %0 <s 2 --> %0 <=s 1
405
- $bl = SETCCr 12, implicit $eflags
406
- ; %0 <u 2 --> %0 <=u 1
407
- $bl = SETCCr 2, implicit $eflags
408
- ...
409
- ---
410
- name : opt_redundant_flags_adjusted_imm_1
411
- body : |
412
- bb.0:
413
- ; CHECK-LABEL: name: opt_redundant_flags_adjusted_imm_1
414
- ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rsi
415
- ; CHECK-NEXT: CMP64ri8 [[COPY]], 42, implicit-def $eflags
416
- ; CHECK-NEXT: $cl = SETCCr 5, implicit $eflags
417
- ; CHECK-NEXT: $bl = SETCCr 13, implicit $eflags
418
- ; CHECK-NEXT: $bl = SETCCr 3, implicit $eflags
419
- ; CHECK-NEXT: $bl = SETCCr 12, implicit $eflags
420
- ; CHECK-NEXT: $bl = SETCCr 2, implicit $eflags
421
- %0:gr64 = COPY $rsi
422
- ; CMP+SETCC %0 != 42
423
- CMP64ri8 %0, 42, implicit-def $eflags
424
- $cl = SETCCr 5, implicit $eflags
425
- ; CMP+SETCC %0 >= 2; CMP can be removed.
426
- CMP64ri8 %0, 41, implicit-def $eflags
427
- ; %0 >s 41 --> %0 >=s 42
428
- $bl = SETCCr 15, implicit $eflags
429
- ; %0 >u 41 --> %0 >=u 42
430
- $bl = SETCCr 7, implicit $eflags
431
- ; %0 <=s 41 --> %0 <s 42
432
- $bl = SETCCr 14, implicit $eflags
433
- ; %0 <=u 41 --> %0 <u 42
434
- $bl = SETCCr 6, implicit $eflags
435
- ...
436
- ---
437
- name : opt_redundant_flags_adjusted_imm_test_cmp
438
- body : |
439
- bb.0:
440
- ; CHECK-LABEL: name: opt_redundant_flags_adjusted_imm_test_cmp
441
- ; CHECK: [[COPY:%[0-9]+]]:gr8 = COPY $bl
442
- ; CHECK-NEXT: TEST8rr [[COPY]], [[COPY]], implicit-def $eflags
443
- ; CHECK-NEXT: $cl = SETCCr 14, implicit $eflags
444
- ; CHECK-NEXT: $cl = SETCCr 7, implicit $eflags
445
- ; CHECK-NEXT: $cl = SETCCr 12, implicit $eflags
446
- %0:gr8 = COPY $bl
447
- TEST8rr %0, %0, implicit-def $eflags
448
- ; SET %0 <=s 0
449
- $cl = SETCCr 14, implicit $eflags
450
- ; CMP should be removed (%0 >=u 1)
451
- CMP8ri %0, 1, implicit-def $eflags
452
- $cl = SETCCr 3, implicit $eflags
453
-
454
- ; CMP should be removed (%0 <=s -1)
455
- CMP8ri %0, -1, implicit-def $eflags
456
- $cl = SETCCr 14, implicit $eflags
457
- ...
458
- ---
459
- name : opt_redundant_flags_adjusted_imm_cmp_test
460
- body : |
461
- bb.0:
462
- ; CHECK-LABEL: name: opt_redundant_flags_adjusted_imm_cmp_test
463
- ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rsi
464
- ; CHECK-NEXT: CMP64ri32 [[COPY]], 1, implicit-def $eflags
465
- ; CHECK-NEXT: $cl = SETCCr 13, implicit $eflags
466
- ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr64 = COPY $edi
467
- ; CHECK-NEXT: CMP64ri32 [[COPY1]], -1, implicit-def $eflags
468
- ; CHECK-NEXT: $cl = SETCCr 14, implicit $eflags
469
- %0:gr64 = COPY $rsi
470
- CMP64ri32 %0, 1, implicit-def $eflags
471
- ; TEST should be removed
472
- TEST64rr %0, %0, implicit-def $eflags
473
- $cl = SETCCr 15, implicit $eflags
474
-
475
- %1:gr64 = COPY $edi
476
- CMP64ri32 %1, -1, implicit-def $eflags
477
- ; TEST should be removed
478
- TEST64rr %1, %1, implicit-def $eflags
479
- $cl = SETCCr 12, implicit $eflags
480
- ...
481
- ---
482
- name : opt_redundant_flags_adjusted_imm_noopt_0
483
- body : |
484
- bb.0:
485
- ; CHECK-LABEL: name: opt_redundant_flags_adjusted_imm_noopt_0
486
- ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rsi
487
- ; CHECK-NEXT: CMP64ri8 [[COPY]], 42, implicit-def $eflags
488
- ; CHECK-NEXT: $cl = SETCCr 4, implicit $eflags
489
- ; CHECK-NEXT: CMP64ri8 [[COPY]], 41, implicit-def $eflags
490
- ; CHECK-NEXT: $bl = SETCCr 4, implicit $eflags
491
- %0:gr64 = COPY $rsi
492
- ; CMP+SETCC %0 <s 1
493
- CMP64ri8 %0, 42, implicit-def $eflags
494
- $cl = SETCCr 4, implicit $eflags
495
- ; CMP should not be removed.
496
- CMP64ri8 %0, 41, implicit-def $eflags
497
- ; %0 == 41
498
- $bl = SETCCr 4, implicit $eflags
499
- ...
500
- ---
501
- name : opt_redundant_flags_adjusted_imm_noopt_1
502
- body : |
503
- bb.0:
504
- ; CHECK-LABEL: name: opt_redundant_flags_adjusted_imm_noopt_1
505
- ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $esi
506
- ; CHECK-NEXT: CMP32ri [[COPY]], 2147483647, implicit-def $eflags
507
- ; CHECK-NEXT: CMP32ri [[COPY]], -2147483648, implicit-def $eflags
508
- ; CHECK-NEXT: $bl = SETCCr 12, implicit $eflags
509
- ; CHECK-NEXT: CMP32ri [[COPY]], 4294967295, implicit-def $eflags
510
- ; CHECK-NEXT: CMP32ri [[COPY]], -2147483648, implicit-def $eflags
511
- ; CHECK-NEXT: $bl = SETCCr 12, implicit $eflags
512
- ; CHECK-NEXT: CMP32ri [[COPY]], 2147483647, implicit-def $eflags
513
- ; CHECK-NEXT: CMP32ri [[COPY]], -2147483648, implicit-def $eflags
514
- ; CHECK-NEXT: $bl = SETCCr 13, implicit $eflags
515
- ; CHECK-NEXT: CMP32ri [[COPY]], 4294967295, implicit-def $eflags
516
- ; CHECK-NEXT: CMP32ri [[COPY]], 0, implicit-def $eflags
517
- ; CHECK-NEXT: $bl = SETCCr 2, implicit $eflags
518
- ; CHECK-NEXT: CMP32ri [[COPY]], 4294967295, implicit-def $eflags
519
- ; CHECK-NEXT: CMP32ri [[COPY]], 0, implicit-def $eflags
520
- ; CHECK-NEXT: $bl = SETCCr 3, implicit $eflags
521
- %0:gr32 = COPY $esi
522
- ; CMP+SETCC %0 == INT32_MAX
523
- CMP32ri %0, 2147483647, implicit-def $eflags
524
- ; CMP should not be removed.
525
- CMP32ri %0, -2147483648, implicit-def $eflags
526
- ; %0 <s INT32_MIN
527
- $bl = SETCCr 12, implicit $eflags
528
-
529
- CMP32ri %0, 4294967295, implicit-def $eflags
530
- ; CMP should not be removed.
531
- CMP32ri %0, -2147483648, implicit-def $eflags
532
- $bl = SETCCr 12, implicit $eflags
533
-
534
- CMP32ri %0, 2147483647, implicit-def $eflags
535
- ; CMP should not be removed.
536
- CMP32ri %0, -2147483648, implicit-def $eflags
537
- $bl = SETCCr 13, implicit $eflags
538
-
539
- CMP32ri %0, 4294967295, implicit-def $eflags
540
- ; should not be removed
541
- CMP32ri %0, 0, implicit-def $eflags
542
- $bl = SETCCr 2, implicit $eflags
543
-
544
- CMP32ri %0, 4294967295, implicit-def $eflags
545
- ; should not be removed
546
- CMP32ri %0, 0, implicit-def $eflags
547
- $bl = SETCCr 3, implicit $eflags
548
- ...
549
- ---
550
- name : opt_redundant_flags_adjusted_imm_noopt_2
551
- body : |
552
- bb.0:
553
- ; CHECK-LABEL: name: opt_redundant_flags_adjusted_imm_noopt_2
554
- ; CHECK: [[COPY:%[0-9]+]]:gr16 = COPY $cx
555
- ; CHECK-NEXT: CMP16ri [[COPY]], -32768, implicit-def $eflags
556
- ; CHECK-NEXT: CMP16ri [[COPY]], 32767, implicit-def $eflags
557
- ; CHECK-NEXT: $bl = SETCCr 15, implicit $eflags
558
- ; CHECK-NEXT: CMP16ri [[COPY]], 65535, implicit-def $eflags
559
- ; CHECK-NEXT: CMP16ri [[COPY]], 32767, implicit-def $eflags
560
- ; CHECK-NEXT: $bl = SETCCr 15, implicit $eflags
561
- ; CHECK-NEXT: CMP16ri [[COPY]], -32768, implicit-def $eflags
562
- ; CHECK-NEXT: CMP16ri [[COPY]], 32767, implicit-def $eflags
563
- ; CHECK-NEXT: $bl = SETCCr 14, implicit $eflags
564
- ; CHECK-NEXT: CMP16ri [[COPY]], 0, implicit-def $eflags
565
- ; CHECK-NEXT: CMP16ri [[COPY]], 65535, implicit-def $eflags
566
- ; CHECK-NEXT: $bl = SETCCr 4, implicit $eflags
567
- ; CHECK-NEXT: CMP16ri [[COPY]], 0, implicit-def $eflags
568
- ; CHECK-NEXT: CMP16ri [[COPY]], 65535, implicit-def $eflags
569
- ; CHECK-NEXT: $bl = SETCCr 6, implicit $eflags
570
- %0:gr16 = COPY $cx
571
- ; CMP+SETCC %0 == INT16_MIN
572
- CMP16ri %0, -32768, implicit-def $eflags
573
- ; CMP should not be removed.
574
- CMP16ri %0, 32767, implicit-def $eflags
575
- ; %0 >s INT16_MAX
576
- $bl = SETCCr 15, implicit $eflags
577
-
578
- CMP16ri %0, 65535, implicit-def $eflags
579
- ; CMP should not be removed.
580
- CMP16ri %0, 32767, implicit-def $eflags
581
- $bl = SETCCr 15, implicit $eflags
582
-
583
- CMP16ri %0, -32768, implicit-def $eflags
584
- ; CMP should not be removed.
585
- CMP16ri %0, 32767, implicit-def $eflags
586
- $bl = SETCCr 14, implicit $eflags
587
-
588
- CMP16ri %0, 0, implicit-def $eflags
589
- ; should not be removed
590
- CMP16ri %0, 65535, implicit-def $eflags
591
- $bl = SETCCr 4, implicit $eflags
592
-
593
- CMP16ri %0, 0, implicit-def $eflags
594
- ; should not be removed
595
- CMP16ri %0, 65535, implicit-def $eflags
596
- $bl = SETCCr 6, implicit $eflags
597
- ...
0 commit comments