1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
2
3define i64 @selectccsgti8(i8, i8, i64, i64) {
4; CHECK-LABEL: selectccsgti8:
5; CHECK:       # %bb.0:
6; CHECK-NEXT:    sll %s1, %s1, 56
7; CHECK-NEXT:    sra.l %s1, %s1, 56
8; CHECK-NEXT:    sll %s0, %s0, 56
9; CHECK-NEXT:    sra.l %s0, %s0, 56
10; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
11; CHECK-NEXT:    cmov.w.gt %s3, %s2, %s0
12; CHECK-NEXT:    or %s0, 0, %s3
13; CHECK-NEXT:    b.l.t (, %s10)
14  %5 = icmp sgt i8 %0, %1
15  %6 = select i1 %5, i64 %2, i64 %3
16  ret i64 %6
17}
18
19define i64 @selectccsgti16(i16, i16, i64, i64) {
20; CHECK-LABEL: selectccsgti16:
21; CHECK:       # %bb.0:
22; CHECK-NEXT:    sll %s1, %s1, 48
23; CHECK-NEXT:    sra.l %s1, %s1, 48
24; CHECK-NEXT:    sll %s0, %s0, 48
25; CHECK-NEXT:    sra.l %s0, %s0, 48
26; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
27; CHECK-NEXT:    cmov.w.gt %s3, %s2, %s0
28; CHECK-NEXT:    or %s0, 0, %s3
29; CHECK-NEXT:    b.l.t (, %s10)
30  %5 = icmp sgt i16 %0, %1
31  %6 = select i1 %5, i64 %2, i64 %3
32  ret i64 %6
33}
34
35define i64 @selectccsgti32(i32, i32, i64, i64) {
36; CHECK-LABEL: selectccsgti32:
37; CHECK:       # %bb.0:
38; CHECK-NEXT:    cmps.w.sx %s0, %s0, %s1
39; CHECK-NEXT:    cmov.w.gt %s3, %s2, %s0
40; CHECK-NEXT:    or %s0, 0, %s3
41; CHECK-NEXT:    b.l.t (, %s10)
42  %5 = icmp sgt i32 %0, %1
43  %6 = select i1 %5, i64 %2, i64 %3
44  ret i64 %6
45}
46
47define i64 @selectccsgti64(i64, i64, i64, i64) {
48; CHECK-LABEL: selectccsgti64:
49; CHECK:       # %bb.0:
50; CHECK-NEXT:    cmps.l %s0, %s0, %s1
51; CHECK-NEXT:    cmov.l.gt %s3, %s2, %s0
52; CHECK-NEXT:    or %s0, 0, %s3
53; CHECK-NEXT:    b.l.t (, %s10)
54  %5 = icmp sgt i64 %0, %1
55  %6 = select i1 %5, i64 %2, i64 %3
56  ret i64 %6
57}
58
59define i64 @selectccsgti128(i128, i128, i64, i64) {
60; CHECK-LABEL: selectccsgti128:
61; CHECK:       # %bb.0:
62; CHECK-NEXT:    cmps.l %s1, %s1, %s3
63; CHECK-NEXT:    or %s3, 0, (0)1
64; CHECK-NEXT:    or %s6, 0, (0)1
65; CHECK-NEXT:    cmov.l.gt %s6, (63)0, %s1
66; CHECK-NEXT:    cmpu.l %s0, %s0, %s2
67; CHECK-NEXT:    or %s2, 0, (0)1
68; CHECK-NEXT:    cmov.l.gt %s2, (63)0, %s0
69; CHECK-NEXT:    cmov.l.eq %s6, %s2, %s1
70; CHECK-NEXT:    cmps.w.sx %s0, %s6, %s3
71; CHECK-NEXT:    cmov.w.ne %s5, %s4, %s0
72; CHECK-NEXT:    or %s0, 0, %s5
73; CHECK-NEXT:    b.l.t (, %s10)
74  %5 = icmp sgt i128 %0, %1
75  %6 = select i1 %5, i64 %2, i64 %3
76  ret i64 %6
77}
78
79define i64 @selectccogtf32(float, float, i64, i64) {
80; CHECK-LABEL: selectccogtf32:
81; CHECK:       # %bb.0:
82; CHECK-NEXT:    fcmp.s %s0, %s0, %s1
83; CHECK-NEXT:    cmov.s.gt %s3, %s2, %s0
84; CHECK-NEXT:    or %s0, 0, %s3
85; CHECK-NEXT:    b.l.t (, %s10)
86  %5 = fcmp ogt float %0, %1
87  %6 = select i1 %5, i64 %2, i64 %3
88  ret i64 %6
89}
90
91define i64 @selectccogtf64(double, double, i64, i64) {
92; CHECK-LABEL: selectccogtf64:
93; CHECK:       # %bb.0:
94; CHECK-NEXT:    fcmp.d %s0, %s0, %s1
95; CHECK-NEXT:    cmov.d.gt %s3, %s2, %s0
96; CHECK-NEXT:    or %s0, 0, %s3
97; CHECK-NEXT:    b.l.t (, %s10)
98  %5 = fcmp ogt double %0, %1
99  %6 = select i1 %5, i64 %2, i64 %3
100  ret i64 %6
101}
102