1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
2
3define signext i8 @func1(i8 signext %0, i8 signext %1) {
4; CHECK-LABEL: func1:
5; CHECK:       # %bb.0:
6; CHECK-NEXT:    sla.w.sx %s0, %s0, %s1
7; CHECK-NEXT:    sll %s0, %s0, 56
8; CHECK-NEXT:    sra.l %s0, %s0, 56
9; CHECK-NEXT:    b.l.t (, %s10)
10  %3 = sext i8 %0 to i32
11  %4 = sext i8 %1 to i32
12  %5 = shl i32 %3, %4
13  %6 = trunc i32 %5 to i8
14  ret i8 %6
15}
16
17define signext i16 @func2(i16 signext %0, i16 signext %1) {
18; CHECK-LABEL: func2:
19; CHECK:       # %bb.0:
20; CHECK-NEXT:    sla.w.sx %s0, %s0, %s1
21; CHECK-NEXT:    sll %s0, %s0, 48
22; CHECK-NEXT:    sra.l %s0, %s0, 48
23; CHECK-NEXT:    b.l.t (, %s10)
24  %3 = sext i16 %0 to i32
25  %4 = sext i16 %1 to i32
26  %5 = shl i32 %3, %4
27  %6 = trunc i32 %5 to i16
28  ret i16 %6
29}
30
31define i32 @func3(i32 %0, i32 %1) {
32; CHECK-LABEL: func3:
33; CHECK:       # %bb.0:
34; CHECK-NEXT:    sla.w.sx %s0, %s0, %s1
35; CHECK-NEXT:    b.l.t (, %s10)
36  %3 = shl i32 %0, %1
37  ret i32 %3
38}
39
40define i64 @func4(i64 %0, i64 %1) {
41; CHECK-LABEL: func4:
42; CHECK:       # %bb.0:
43; CHECK-NEXT:    sll %s0, %s0, %s1
44; CHECK-NEXT:    b.l.t (, %s10)
45  %3 = shl i64 %0, %1
46  ret i64 %3
47}
48
49define zeroext i8 @func6(i8 zeroext %0, i8 zeroext %1) {
50; CHECK-LABEL: func6:
51; CHECK:       # %bb.0:
52; CHECK-NEXT:    sla.w.sx %s0, %s0, %s1
53; CHECK-NEXT:    and %s0, %s0, (56)0
54; CHECK-NEXT:    b.l.t (, %s10)
55  %3 = zext i8 %0 to i32
56  %4 = zext i8 %1 to i32
57  %5 = shl i32 %3, %4
58  %6 = trunc i32 %5 to i8
59  ret i8 %6
60}
61
62define zeroext i16 @func7(i16 zeroext %0, i16 zeroext %1) {
63; CHECK-LABEL: func7:
64; CHECK:       # %bb.0:
65; CHECK-NEXT:    sla.w.sx %s0, %s0, %s1
66; CHECK-NEXT:    and %s0, %s0, (48)0
67; CHECK-NEXT:    b.l.t (, %s10)
68  %3 = zext i16 %0 to i32
69  %4 = zext i16 %1 to i32
70  %5 = shl i32 %3, %4
71  %6 = trunc i32 %5 to i16
72  ret i16 %6
73}
74
75define i32 @func8(i32 %0, i32 %1) {
76; CHECK-LABEL: func8:
77; CHECK:       # %bb.0:
78; CHECK-NEXT:    sla.w.sx %s0, %s0, %s1
79; CHECK-NEXT:    b.l.t (, %s10)
80  %3 = shl i32 %0, %1
81  ret i32 %3
82}
83
84define i64 @func9(i64 %0, i64 %1) {
85; CHECK-LABEL: func9:
86; CHECK:       # %bb.0:
87; CHECK-NEXT:    sll %s0, %s0, %s1
88; CHECK-NEXT:    b.l.t (, %s10)
89  %3 = shl i64 %0, %1
90  ret i64 %3
91}
92
93define signext i8 @func11(i8 signext %0) {
94; CHECK-LABEL: func11:
95; CHECK:       # %bb.0:
96; CHECK-NEXT:    sla.w.sx %s0, %s0, 5
97; CHECK-NEXT:    sll %s0, %s0, 56
98; CHECK-NEXT:    sra.l %s0, %s0, 56
99; CHECK-NEXT:    b.l.t (, %s10)
100  %2 = shl i8 %0, 5
101  ret i8 %2
102}
103
104define signext i16 @func12(i16 signext %0) {
105; CHECK-LABEL: func12:
106; CHECK:       # %bb.0:
107; CHECK-NEXT:    sla.w.sx %s0, %s0, 5
108; CHECK-NEXT:    sll %s0, %s0, 48
109; CHECK-NEXT:    sra.l %s0, %s0, 48
110; CHECK-NEXT:    b.l.t (, %s10)
111  %2 = shl i16 %0, 5
112  ret i16 %2
113}
114
115define i32 @func13(i32 %0) {
116; CHECK-LABEL: func13:
117; CHECK:       # %bb.0:
118; CHECK-NEXT:    sla.w.sx %s0, %s0, 5
119; CHECK-NEXT:    b.l.t (, %s10)
120  %2 = shl i32 %0, 5
121  ret i32 %2
122}
123
124define i64 @func14(i64 %0) {
125; CHECK-LABEL: func14:
126; CHECK:       # %bb.0:
127; CHECK-NEXT:    sll %s0, %s0, 5
128; CHECK-NEXT:    b.l.t (, %s10)
129  %2 = shl i64 %0, 5
130  ret i64 %2
131}
132
133define zeroext i8 @func16(i8 zeroext %0) {
134; CHECK-LABEL: func16:
135; CHECK:       # %bb.0:
136; CHECK-NEXT:    sla.w.sx %s0, %s0, 5
137; CHECK-NEXT:    lea %s1, 224
138; CHECK-NEXT:    and %s0, %s0, %s1
139; CHECK-NEXT:    b.l.t (, %s10)
140  %2 = shl i8 %0, 5
141  ret i8 %2
142}
143
144define zeroext i16 @func17(i16 zeroext %0) {
145; CHECK-LABEL: func17:
146; CHECK:       # %bb.0:
147; CHECK-NEXT:    sla.w.sx %s0, %s0, 5
148; CHECK-NEXT:    lea %s1, 65504
149; CHECK-NEXT:    and %s0, %s0, %s1
150; CHECK-NEXT:    b.l.t (, %s10)
151  %2 = shl i16 %0, 5
152  ret i16 %2
153}
154
155define i32 @func18(i32 %0) {
156; CHECK-LABEL: func18:
157; CHECK:       # %bb.0:
158; CHECK-NEXT:    sla.w.sx %s0, %s0, 5
159; CHECK-NEXT:    b.l.t (, %s10)
160  %2 = shl i32 %0, 5
161  ret i32 %2
162}
163
164define i64 @func19(i64 %0) {
165; CHECK-LABEL: func19:
166; CHECK:       # %bb.0:
167; CHECK-NEXT:    sll %s0, %s0, 5
168; CHECK-NEXT:    b.l.t (, %s10)
169  %2 = shl i64 %0, 5
170  ret i64 %2
171}
172
173