1; RUN: llc < %s -mtriple=ve | FileCheck %s
2
3;;; Test all combination of input type and output type among following types.
4;;;
5;;; Types:
6;;;  i1/i8/u8/i16/u16/i32/u32/i64/u64/i128/u128/float/double/fp128
7
8; Function Attrs: norecurse nounwind readnone
9define zeroext i1 @setcc_i1(i1 zeroext %0, i1 zeroext %1) {
10; CHECK-LABEL: setcc_i1:
11; CHECK:       # %bb.0:
12; CHECK-NEXT:    xor %s0, %s0, %s1
13; CHECK-NEXT:    xor %s0, 1, %s0
14; CHECK-NEXT:    b.l.t (, %s10)
15  %3 = xor i1 %0, %1
16  %4 = xor i1 %3, true
17  ret i1 %4
18}
19
20; Function Attrs: norecurse nounwind readnone
21define zeroext i1 @setcc_i8(i8 signext %0, i8 signext %1) {
22; CHECK-LABEL: setcc_i8:
23; CHECK:       # %bb.0:
24; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
25; CHECK-NEXT:    or %s1, 0, (0)1
26; CHECK-NEXT:    cmov.w.eq %s1, (63)0, %s0
27; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
28; CHECK-NEXT:    b.l.t (, %s10)
29  %3 = icmp eq i8 %0, %1
30  ret i1 %3
31}
32
33; Function Attrs: norecurse nounwind readnone
34define zeroext i1 @setcc_u8(i8 zeroext %0, i8 zeroext %1) {
35; CHECK-LABEL: setcc_u8:
36; CHECK:       # %bb.0:
37; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
38; CHECK-NEXT:    or %s1, 0, (0)1
39; CHECK-NEXT:    cmov.w.eq %s1, (63)0, %s0
40; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
41; CHECK-NEXT:    b.l.t (, %s10)
42  %3 = icmp eq i8 %0, %1
43  ret i1 %3
44}
45
46; Function Attrs: norecurse nounwind readnone
47define zeroext i1 @setcc_i16(i16 signext %0, i16 signext %1) {
48; CHECK-LABEL: setcc_i16:
49; CHECK:       # %bb.0:
50; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
51; CHECK-NEXT:    or %s1, 0, (0)1
52; CHECK-NEXT:    cmov.w.eq %s1, (63)0, %s0
53; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
54; CHECK-NEXT:    b.l.t (, %s10)
55  %3 = icmp eq i16 %0, %1
56  ret i1 %3
57}
58
59; Function Attrs: norecurse nounwind readnone
60define zeroext i1 @setcc_u16(i16 zeroext %0, i16 zeroext %1) {
61; CHECK-LABEL: setcc_u16:
62; CHECK:       # %bb.0:
63; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
64; CHECK-NEXT:    or %s1, 0, (0)1
65; CHECK-NEXT:    cmov.w.eq %s1, (63)0, %s0
66; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
67; CHECK-NEXT:    b.l.t (, %s10)
68  %3 = icmp eq i16 %0, %1
69  ret i1 %3
70}
71
72; Function Attrs: norecurse nounwind readnone
73define zeroext i1 @setcc_i32(i32 signext %0, i32 signext %1) {
74; CHECK-LABEL: setcc_i32:
75; CHECK:       # %bb.0:
76; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
77; CHECK-NEXT:    or %s1, 0, (0)1
78; CHECK-NEXT:    cmov.w.eq %s1, (63)0, %s0
79; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
80; CHECK-NEXT:    b.l.t (, %s10)
81  %3 = icmp eq i32 %0, %1
82  ret i1 %3
83}
84
85; Function Attrs: norecurse nounwind readnone
86define zeroext i1 @setcc_u32(i32 zeroext %0, i32 zeroext %1) {
87; CHECK-LABEL: setcc_u32:
88; CHECK:       # %bb.0:
89; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
90; CHECK-NEXT:    or %s1, 0, (0)1
91; CHECK-NEXT:    cmov.w.eq %s1, (63)0, %s0
92; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
93; CHECK-NEXT:    b.l.t (, %s10)
94  %3 = icmp eq i32 %0, %1
95  ret i1 %3
96}
97
98; Function Attrs: norecurse nounwind readnone
99define zeroext i1 @setcc_i64(i64 %0, i64 %1) {
100; CHECK-LABEL: setcc_i64:
101; CHECK:       # %bb.0:
102; CHECK-NEXT:    cmps.l %s0, %s0, %s1
103; CHECK-NEXT:    or %s1, 0, (0)1
104; CHECK-NEXT:    cmov.l.eq %s1, (63)0, %s0
105; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
106; CHECK-NEXT:    b.l.t (, %s10)
107  %3 = icmp eq i64 %0, %1
108  ret i1 %3
109}
110
111; Function Attrs: norecurse nounwind readnone
112define zeroext i1 @setcc_u64(i64 %0, i64 %1) {
113; CHECK-LABEL: setcc_u64:
114; CHECK:       # %bb.0:
115; CHECK-NEXT:    cmps.l %s0, %s0, %s1
116; CHECK-NEXT:    or %s1, 0, (0)1
117; CHECK-NEXT:    cmov.l.eq %s1, (63)0, %s0
118; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
119; CHECK-NEXT:    b.l.t (, %s10)
120  %3 = icmp eq i64 %0, %1
121  ret i1 %3
122}
123
124; Function Attrs: norecurse nounwind readnone
125define zeroext i1 @setcc_i128(i128 %0, i128 %1) {
126; CHECK-LABEL: setcc_i128:
127; CHECK:       # %bb.0:
128; CHECK-NEXT:    xor %s1, %s1, %s3
129; CHECK-NEXT:    xor %s0, %s0, %s2
130; CHECK-NEXT:    or %s0, %s0, %s1
131; CHECK-NEXT:    or %s1, 0, (0)1
132; CHECK-NEXT:    cmps.l %s0, %s0, (0)1
133; CHECK-NEXT:    cmov.l.eq %s1, (63)0, %s0
134; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
135; CHECK-NEXT:    b.l.t (, %s10)
136  %3 = icmp eq i128 %0, %1
137  ret i1 %3
138}
139
140; Function Attrs: norecurse nounwind readnone
141define zeroext i1 @setcc_u128(i128 %0, i128 %1) {
142; CHECK-LABEL: setcc_u128:
143; CHECK:       # %bb.0:
144; CHECK-NEXT:    xor %s1, %s1, %s3
145; CHECK-NEXT:    xor %s0, %s0, %s2
146; CHECK-NEXT:    or %s0, %s0, %s1
147; CHECK-NEXT:    or %s1, 0, (0)1
148; CHECK-NEXT:    cmps.l %s0, %s0, (0)1
149; CHECK-NEXT:    cmov.l.eq %s1, (63)0, %s0
150; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
151; CHECK-NEXT:    b.l.t (, %s10)
152  %3 = icmp eq i128 %0, %1
153  ret i1 %3
154}
155
156; Function Attrs: norecurse nounwind readnone
157define zeroext i1 @setcc_float(float %0, float %1) {
158; CHECK-LABEL: setcc_float:
159; CHECK:       # %bb.0:
160; CHECK-NEXT:    fcmp.s %s0, %s0, %s1
161; CHECK-NEXT:    or %s1, 0, (0)1
162; CHECK-NEXT:    cmov.s.eq %s1, (63)0, %s0
163; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
164; CHECK-NEXT:    b.l.t (, %s10)
165  %3 = fcmp fast oeq float %0, %1
166  ret i1 %3
167}
168
169; Function Attrs: norecurse nounwind readnone
170define zeroext i1 @setcc_double(double %0, double %1) {
171; CHECK-LABEL: setcc_double:
172; CHECK:       # %bb.0:
173; CHECK-NEXT:    fcmp.d %s0, %s0, %s1
174; CHECK-NEXT:    or %s1, 0, (0)1
175; CHECK-NEXT:    cmov.d.eq %s1, (63)0, %s0
176; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
177; CHECK-NEXT:    b.l.t (, %s10)
178  %3 = fcmp fast oeq double %0, %1
179  ret i1 %3
180}
181
182; Function Attrs: norecurse nounwind readnone
183define zeroext i1 @setcc_quad(fp128 %0, fp128 %1) {
184; CHECK-LABEL: setcc_quad:
185; CHECK:       # %bb.0:
186; CHECK-NEXT:    fcmp.q %s0, %s0, %s2
187; CHECK-NEXT:    or %s1, 0, (0)1
188; CHECK-NEXT:    cmov.d.eq %s1, (63)0, %s0
189; CHECK-NEXT:    adds.w.zx %s0, %s1, (0)1
190; CHECK-NEXT:    b.l.t (, %s10)
191  %3 = fcmp fast oeq fp128 %0, %1
192  ret i1 %3
193}
194