|
1 | 1 | ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
2 | 2 | ; RUN: llc < %s -mtriple=m68k-freestanding -verify-machineinstrs | FileCheck %s |
3 | 3 |
|
4 | | -define fastcc i16 @test1(i16 %a) nounwind { |
5 | | -; CHECK-LABEL: test1: |
| 4 | +define fastcc i16 @switch_to_btst(i16 %a) nounwind { |
| 5 | +; CHECK-LABEL: switch_to_btst: |
6 | 6 | ; CHECK: ; %bb.0: ; %entry |
7 | 7 | ; CHECK-NEXT: move.l %d0, %d1 |
8 | 8 | ; CHECK-NEXT: and.l #65535, %d1 |
@@ -35,3 +35,28 @@ define fastcc i16 @test1(i16 %a) nounwind { |
35 | 35 | no_match: |
36 | 36 | ret i16 0 |
37 | 37 | } |
| 38 | + |
| 39 | +define fastcc i16 @and_mask_to_btst(i8 %a, i8 %b) nounwind { |
| 40 | +; CHECK-LABEL: and_mask_to_btst: |
| 41 | +; CHECK: ; %bb.0: |
| 42 | +; CHECK-NEXT: and.l #7, %d1 |
| 43 | +; CHECK-NEXT: btst %d1, %d0 |
| 44 | +; CHECK-NEXT: beq .LBB1_1 |
| 45 | +; CHECK-NEXT: ; %bb.2: ; %cond_false |
| 46 | +; CHECK-NEXT: moveq #0, %d0 |
| 47 | +; CHECK-NEXT: rts |
| 48 | +; CHECK-NEXT: .LBB1_1: ; %cond_true |
| 49 | +; CHECK-NEXT: moveq #1, %d0 |
| 50 | +; CHECK-NEXT: rts |
| 51 | + %33 = and i8 %b, 7 |
| 52 | + %34 = shl nuw i8 1, %33 |
| 53 | + %35 = and i8 %34, %a |
| 54 | + %.not = icmp eq i8 %35, 0 |
| 55 | + br i1 %.not, label %cond_true, label %cond_false |
| 56 | + |
| 57 | + cond_true: |
| 58 | + ret i16 1 |
| 59 | + |
| 60 | + cond_false: |
| 61 | + ret i16 0 |
| 62 | +} |
0 commit comments