1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=msp430-- < %s | FileCheck %s
4 define i16 @testSimplifySetCC_0(i16 %a) {
5 ; CHECK-LABEL: testSimplifySetCC_0:
6 ; CHECK: ; %bb.0: ; %entry
7 ; CHECK-NEXT: bit #32, r12
8 ; CHECK-NEXT: mov r2, r12
9 ; CHECK-NEXT: and #1, r12
13 %cmp = icmp ne i16 %and, 0
14 %conv = zext i1 %cmp to i16
18 define i16 @testSimplifySetCC_1(i16 %a) {
19 ; CHECK-LABEL: testSimplifySetCC_1:
20 ; CHECK: ; %bb.0: ; %entry
21 ; CHECK-NEXT: bit #32, r12
22 ; CHECK-NEXT: mov r2, r12
23 ; CHECK-NEXT: and #1, r12
27 %cmp = icmp eq i16 %and, 32
28 %conv = zext i1 %cmp to i16
32 define i16 @testSiymplifySelect(i16 %a) {
33 ; CHECK-LABEL: testSiymplifySelect:
34 ; CHECK: ; %bb.0: ; %entry
35 ; CHECK-NEXT: mov r12, r13
37 ; CHECK-NEXT: bit #2048, r13
38 ; CHECK-NEXT: jeq .LBB2_2
39 ; CHECK-NEXT: ; %bb.1: ; %entry
40 ; CHECK-NEXT: mov #3, r12
41 ; CHECK-NEXT: .LBB2_2: ; %entry
44 %and = and i16 %a, 2048
45 %cmp = icmp eq i16 %and, 0
46 %cond = select i1 %cmp, i16 0, i16 3
50 define i16 @testExtendSignBit(i16 %a) {
51 ; CHECK-LABEL: testExtendSignBit:
52 ; CHECK: ; %bb.0: ; %entry
54 ; CHECK-NEXT: swpb r12
55 ; CHECK-NEXT: mov.b r12, r12
66 %cmp = icmp sgt i16 %a, -1
67 %cond = select i1 %cmp, i16 1, i16 0
71 define i16 @testShiftAnd_0(i16 %a) {
72 ; CHECK-LABEL: testShiftAnd_0:
73 ; CHECK: ; %bb.0: ; %entry
74 ; CHECK-NEXT: swpb r12
85 %cmp = icmp slt i16 %a, 0
86 %cond = select i1 %cmp, i16 -1, i16 0
90 define i16 @testShiftAnd_1(i16 %a) {
91 ; CHECK-LABEL: testShiftAnd_1:
92 ; CHECK: ; %bb.0: ; %entry
93 ; CHECK-NEXT: swpb r12
94 ; CHECK-NEXT: mov.b r12, r12
100 ; CHECK-NEXT: rra r12
101 ; CHECK-NEXT: rra r12
102 ; CHECK-NEXT: rra r12
105 %cmp = icmp slt i16 %a, 0
106 %cond = select i1 %cmp, i16 1, i16 0
110 define i16 @testShiftAnd_2(i16 %a) {
111 ; CHECK-LABEL: testShiftAnd_2:
112 ; CHECK: ; %bb.0: ; %entry
113 ; CHECK-NEXT: swpb r12
114 ; CHECK-NEXT: mov.b r12, r12
116 ; CHECK-NEXT: rrc r12
117 ; CHECK-NEXT: rra r12
118 ; CHECK-NEXT: rra r12
119 ; CHECK-NEXT: rra r12
120 ; CHECK-NEXT: rra r12
121 ; CHECK-NEXT: rra r12
122 ; CHECK-NEXT: and #2, r12
125 %cmp = icmp slt i16 %a, 0
126 %cond = select i1 %cmp, i16 2, i16 0
130 define i16 @testShiftAnd_3(i16 %a) {
131 ; CHECK-LABEL: testShiftAnd_3:
132 ; CHECK: ; %bb.0: ; %entry
133 ; CHECK-NEXT: swpb r12
134 ; CHECK-NEXT: sxt r12
135 ; CHECK-NEXT: rra r12
136 ; CHECK-NEXT: rra r12
137 ; CHECK-NEXT: rra r12
138 ; CHECK-NEXT: rra r12
139 ; CHECK-NEXT: rra r12
140 ; CHECK-NEXT: rra r12
141 ; CHECK-NEXT: rra r12
142 ; CHECK-NEXT: and #3, r12
145 %cmp = icmp slt i16 %a, 0
146 %cond = select i1 %cmp, i16 3, i16 0
150 define i16 @testShiftAnd_4(i16 %a, i16 %b) {
151 ; CHECK-LABEL: testShiftAnd_4:
152 ; CHECK: ; %bb.0: ; %entry
153 ; CHECK-NEXT: mov r12, r14
154 ; CHECK-NEXT: mov #1, r12
155 ; CHECK-NEXT: cmp r14, r13
156 ; CHECK-NEXT: jl .LBB8_2
157 ; CHECK-NEXT: ; %bb.1: ; %entry
158 ; CHECK-NEXT: clr r12
159 ; CHECK-NEXT: .LBB8_2: ; %entry
160 ; CHECK-NEXT: add r12, r12
161 ; CHECK-NEXT: add r12, r12
162 ; CHECK-NEXT: add r12, r12
163 ; CHECK-NEXT: add r12, r12
164 ; CHECK-NEXT: add r12, r12
167 %cmp = icmp sgt i16 %a, %b
168 %cond = select i1 %cmp, i16 32, i16 0