1 ; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
3 define double @maxf64(double, double) {
6 ; CHECK-NEXT: fmax.d %s0, %s0, %s1
7 ; CHECK-NEXT: b.l.t (, %s10)
8 %3 = fcmp ogt double %0, %1
9 %4 = select i1 %3, double %0, double %1
13 define double @max2f64(double, double) {
14 ; CHECK-LABEL: max2f64:
16 ; CHECK-NEXT: fmax.d %s0, %s0, %s1
17 ; CHECK-NEXT: b.l.t (, %s10)
18 %3 = fcmp oge double %0, %1
19 %4 = select i1 %3, double %0, double %1
23 ; VE has no max for unordered comparison
24 define double @maxuf64(double, double) {
25 ; CHECK-LABEL: maxuf64:
27 ; CHECK-NEXT: fcmp.d %s2, %s0, %s1
28 ; CHECK-NEXT: cmov.d.gtnan %s1, %s0, %s2
29 ; CHECK-NEXT: or %s0, 0, %s1
30 ; CHECK-NEXT: b.l.t (, %s10)
31 %3 = fcmp ugt double %0, %1
32 %4 = select i1 %3, double %0, double %1
36 ; VE has no max for unordered comparison
37 define double @max2uf64(double, double) {
38 ; CHECK-LABEL: max2uf64:
40 ; CHECK-NEXT: fcmp.d %s2, %s0, %s1
41 ; CHECK-NEXT: cmov.d.genan %s1, %s0, %s2
42 ; CHECK-NEXT: or %s0, 0, %s1
43 ; CHECK-NEXT: b.l.t (, %s10)
44 %3 = fcmp uge double %0, %1
45 %4 = select i1 %3, double %0, double %1
49 define float @maxf32(float, float) {
50 ; CHECK-LABEL: maxf32:
52 ; CHECK-NEXT: fmax.s %s0, %s0, %s1
53 ; CHECK-NEXT: b.l.t (, %s10)
54 %3 = fcmp ogt float %0, %1
55 %4 = select i1 %3, float %0, float %1
59 define float @max2f32(float, float) {
60 ; CHECK-LABEL: max2f32:
62 ; CHECK-NEXT: fmax.s %s0, %s0, %s1
63 ; CHECK-NEXT: b.l.t (, %s10)
64 %3 = fcmp oge float %0, %1
65 %4 = select i1 %3, float %0, float %1
69 define float @maxuf32(float, float) {
70 ; CHECK-LABEL: maxuf32:
72 ; CHECK-NEXT: fcmp.s %s2, %s0, %s1
73 ; CHECK-NEXT: cmov.s.gtnan %s1, %s0, %s2
74 ; CHECK-NEXT: or %s0, 0, %s1
75 ; CHECK-NEXT: b.l.t (, %s10)
76 %3 = fcmp ugt float %0, %1
77 %4 = select i1 %3, float %0, float %1
81 define float @max2uf32(float, float) {
82 ; CHECK-LABEL: max2uf32:
84 ; CHECK-NEXT: fcmp.s %s2, %s0, %s1
85 ; CHECK-NEXT: cmov.s.genan %s1, %s0, %s2
86 ; CHECK-NEXT: or %s0, 0, %s1
87 ; CHECK-NEXT: b.l.t (, %s10)
88 %3 = fcmp uge float %0, %1
89 %4 = select i1 %3, float %0, float %1
93 define i64 @maxi64(i64, i64) {
94 ; CHECK-LABEL: maxi64:
96 ; CHECK-NEXT: maxs.l %s0, %s0, %s1
97 ; CHECK-NEXT: b.l.t (, %s10)
98 %3 = icmp sgt i64 %0, %1
99 %4 = select i1 %3, i64 %0, i64 %1
103 define i64 @max2i64(i64, i64) {
104 ; CHECK-LABEL: max2i64:
106 ; CHECK-NEXT: maxs.l %s0, %s0, %s1
107 ; CHECK-NEXT: b.l.t (, %s10)
108 %3 = icmp sge i64 %0, %1
109 %4 = select i1 %3, i64 %0, i64 %1
113 define i64 @maxu64(i64, i64) {
114 ; CHECK-LABEL: maxu64:
116 ; CHECK-NEXT: cmpu.l %s2, %s0, %s1
117 ; CHECK-NEXT: cmov.l.gt %s1, %s0, %s2
118 ; CHECK-NEXT: or %s0, 0, %s1
119 ; CHECK-NEXT: b.l.t (, %s10)
120 %3 = icmp ugt i64 %0, %1
121 %4 = select i1 %3, i64 %0, i64 %1
125 define i64 @max2u64(i64, i64) {
126 ; CHECK-LABEL: max2u64:
128 ; CHECK-NEXT: cmpu.l %s2, %s0, %s1
129 ; CHECK-NEXT: cmov.l.ge %s1, %s0, %s2
130 ; CHECK-NEXT: or %s0, 0, %s1
131 ; CHECK-NEXT: b.l.t (, %s10)
132 %3 = icmp uge i64 %0, %1
133 %4 = select i1 %3, i64 %0, i64 %1
137 define i32 @maxi32(i32, i32) {
138 ; CHECK-LABEL: maxi32:
140 ; CHECK-NEXT: maxs.w.sx %s0, %s0, %s1
141 ; CHECK-NEXT: b.l.t (, %s10)
142 %3 = icmp sgt i32 %0, %1
143 %4 = select i1 %3, i32 %0, i32 %1
147 define i32 @max2i32(i32, i32) {
148 ; CHECK-LABEL: max2i32:
150 ; CHECK-NEXT: maxs.w.sx %s0, %s0, %s1
151 ; CHECK-NEXT: b.l.t (, %s10)
152 %3 = icmp sge i32 %0, %1
153 %4 = select i1 %3, i32 %0, i32 %1
157 define i32 @maxu32(i32, i32) {
158 ; CHECK-LABEL: maxu32:
160 ; CHECK-NEXT: cmpu.w %s2, %s0, %s1
161 ; CHECK-NEXT: cmov.w.gt %s1, %s0, %s2
162 ; CHECK-NEXT: or %s0, 0, %s1
163 ; CHECK-NEXT: b.l.t (, %s10)
164 %3 = icmp ugt i32 %0, %1
165 %4 = select i1 %3, i32 %0, i32 %1
169 define i32 @max2u32(i32, i32) {
170 ; CHECK-LABEL: max2u32:
172 ; CHECK-NEXT: cmpu.w %s2, %s0, %s1
173 ; CHECK-NEXT: cmov.w.ge %s1, %s0, %s2
174 ; CHECK-NEXT: or %s0, 0, %s1
175 ; CHECK-NEXT: b.l.t (, %s10)
176 %3 = icmp uge i32 %0, %1
177 %4 = select i1 %3, i32 %0, i32 %1
181 define zeroext i1 @maxi1(i1 zeroext, i1 zeroext) {
182 ; CHECK-LABEL: maxi1:
184 ; CHECK-NEXT: or %s0, %s0, %s1
185 ; CHECK-NEXT: or %s0, %s1, %s0
186 ; CHECK-NEXT: b.l.t (, %s10)
189 %5 = select i1 %4, i1 %0, i1 %1