1; RUN: llc < %s | FileCheck %s
2target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-n8:16"
3target triple = "msp430-elf"
4
5define zeroext i8 @lshr8(i8 zeroext %a, i8 zeroext %cnt) nounwind readnone {
6entry:
7; CHECK-LABEL: lshr8:
8; CHECK: clrc
9; CHECK: rrc.b
10  %shr = lshr i8 %a, %cnt
11  ret i8 %shr
12}
13
14define signext i8 @ashr8(i8 signext %a, i8 zeroext %cnt) nounwind readnone {
15entry:
16; CHECK-LABEL: ashr8:
17; CHECK: rra.b
18  %shr = ashr i8 %a, %cnt
19  ret i8 %shr
20}
21
22define zeroext i8 @shl8(i8 zeroext %a, i8 zeroext %cnt) nounwind readnone {
23entry:
24; CHECK: shl8
25; CHECK: add.b
26  %shl = shl i8 %a, %cnt
27  ret i8 %shl
28}
29
30define zeroext i16 @lshr16(i16 zeroext %a, i16 zeroext %cnt) nounwind readnone {
31entry:
32; CHECK-LABEL: lshr16:
33; CHECK: clrc
34; CHECK: rrc
35  %shr = lshr i16 %a, %cnt
36  ret i16 %shr
37}
38
39define signext i16 @ashr16(i16 signext %a, i16 zeroext %cnt) nounwind readnone {
40entry:
41; CHECK-LABEL: ashr16:
42; CHECK: rra
43  %shr = ashr i16 %a, %cnt
44  ret i16 %shr
45}
46
47define zeroext i16 @shl16(i16 zeroext %a, i16 zeroext %cnt) nounwind readnone {
48entry:
49; CHECK-LABEL: shl16:
50; CHECK: add
51  %shl = shl i16 %a, %cnt
52  ret i16 %shl
53}
54
55define i16 @ashr10_i16(i16 %a) #0 {
56entry:
57; CHECK-LABEL: ashr10_i16:
58; CHECK:      swpb	r12
59; CHECK-NEXT: sxt	r12
60; CHECK-NEXT: rra	r12
61; CHECK-NEXT: rra	r12
62  %shr = ashr i16 %a, 10
63  ret i16 %shr
64}
65
66define i16 @lshr10_i16(i16 %a) #0 {
67entry:
68; CHECK-LABEL: lshr10_i16:
69; CHECK:      swpb	r12
70; CHECK-NEXT: mov.b	r12, r12
71; CHECK-NEXT: clrc
72; CHECK-NEXT: rrc	r12
73; CHECK-NEXT: rra	r12
74  %shr = lshr i16 %a, 10
75  ret i16 %shr
76}
77
78define i16 @lshl10_i16(i16 %a) #0 {
79entry:
80; CHECK-LABEL: lshl10_i16:
81; CHECK:      mov.b r12, r12
82; CHECK-NEXT: swpb r12
83; CHECK-NEXT: add r12, r12
84; CHECK-NEXT: add r12, r12
85  %shl = shl i16 %a, 10
86  ret i16 %shl
87}
88