1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=msp430-- < %s | FileCheck %s
3
4define i16 @select_to_shifts_i16(i16 %a, i16 %b) {
5; CHECK-LABEL: select_to_shifts_i16:
6; CHECK:       ; %bb.0:
7; CHECK-NEXT:    mov r12, r14
8; CHECK-NEXT:    clr r12
9; CHECK-NEXT:    bit #2, r14
10; CHECK-NEXT:    jeq .LBB0_2
11; CHECK-NEXT:  ; %bb.1:
12; CHECK-NEXT:    mov r13, r12
13; CHECK-NEXT:  .LBB0_2:
14; CHECK-NEXT:    ret
15  %and = and i16 %a, 2
16  %tobool = icmp eq i16 %and, 0
17  %select = select i1 %tobool, i16 0, i16 %b
18  ret i16 %select
19}
20
21define i32 @select_to_shifts_i32(i32 %a, i32 %b) {
22; CHECK-LABEL: select_to_shifts_i32:
23; CHECK:       ; %bb.0:
24; CHECK-NEXT:    mov r12, r11
25; CHECK-NEXT:    and #2, r11
26; CHECK-NEXT:    clr r13
27; CHECK-NEXT:    tst r11
28; CHECK-NEXT:    clr r12
29; CHECK-NEXT:    jne .LBB1_3
30; CHECK-NEXT:  ; %bb.1:
31; CHECK-NEXT:    tst r11
32; CHECK-NEXT:    jne .LBB1_4
33; CHECK-NEXT:  .LBB1_2:
34; CHECK-NEXT:    ret
35; CHECK-NEXT:  .LBB1_3:
36; CHECK-NEXT:    mov r14, r12
37; CHECK-NEXT:    tst r11
38; CHECK-NEXT:    jeq .LBB1_2
39; CHECK-NEXT:  .LBB1_4:
40; CHECK-NEXT:    mov r15, r13
41; CHECK-NEXT:    ret
42  %and = and i32 %a, 2
43  %tobool = icmp eq i32 %and, 0
44  %select = select i1 %tobool, i32 0, i32 %b
45  ret i32 %select
46}
47