1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s
4 define <4 x i32> @t1(<4 x i32> %a, <4 x i32> %b) {
7 ; CHECK-NEXT: smax v0.4s, v0.4s, v1.4s
9 %t1 = icmp sgt <4 x i32> %a, %b
10 %t2 = select <4 x i1> %t1, <4 x i32> %a, <4 x i32> %b
14 define <4 x i32> @t2(<4 x i32> %a, <4 x i32> %b) {
17 ; CHECK-NEXT: smin v0.4s, v0.4s, v1.4s
19 %t1 = icmp slt <4 x i32> %a, %b
20 %t2 = select <4 x i1> %t1, <4 x i32> %a, <4 x i32> %b
24 define <4 x i32> @t3(<4 x i32> %a, <4 x i32> %b) {
27 ; CHECK-NEXT: umax v0.4s, v0.4s, v1.4s
29 %t1 = icmp ugt <4 x i32> %a, %b
30 %t2 = select <4 x i1> %t1, <4 x i32> %a, <4 x i32> %b
34 define <8 x i8> @t4(<8 x i8> %a, <8 x i8> %b) {
37 ; CHECK-NEXT: umin v0.8b, v0.8b, v1.8b
39 %t1 = icmp ult <8 x i8> %a, %b
40 %t2 = select <8 x i1> %t1, <8 x i8> %a, <8 x i8> %b
44 define <4 x i16> @t5(<4 x i16> %a, <4 x i16> %b) {
47 ; CHECK-NEXT: smin v0.4h, v1.4h, v0.4h
49 %t1 = icmp sgt <4 x i16> %b, %a
50 %t2 = select <4 x i1> %t1, <4 x i16> %a, <4 x i16> %b
54 define <2 x i32> @t6(<2 x i32> %a, <2 x i32> %b) {
57 ; CHECK-NEXT: smax v0.2s, v1.2s, v0.2s
59 %t1 = icmp slt <2 x i32> %b, %a
60 %t2 = select <2 x i1> %t1, <2 x i32> %a, <2 x i32> %b
64 define <16 x i8> @t7(<16 x i8> %a, <16 x i8> %b) {
67 ; CHECK-NEXT: umin v0.16b, v1.16b, v0.16b
69 %t1 = icmp ugt <16 x i8> %b, %a
70 %t2 = select <16 x i1> %t1, <16 x i8> %a, <16 x i8> %b
74 define <8 x i16> @t8(<8 x i16> %a, <8 x i16> %b) {
77 ; CHECK-NEXT: umax v0.8h, v1.8h, v0.8h
79 %t1 = icmp ult <8 x i16> %b, %a
80 %t2 = select <8 x i1> %t1, <8 x i16> %a, <8 x i16> %b
84 define <4 x i32> @t9(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) {
87 ; CHECK-NEXT: umin v0.4s, v1.4s, v0.4s
88 ; CHECK-NEXT: smax v0.4s, v0.4s, v2.4s
90 %t1 = icmp ugt <4 x i32> %b, %a
91 %t2 = select <4 x i1> %t1, <4 x i32> %a, <4 x i32> %b
92 %t3 = icmp sge <4 x i32> %t2, %c
93 %t4 = select <4 x i1> %t3, <4 x i32> %t2, <4 x i32> %c
97 define <8 x i32> @t10(<8 x i32> %a, <8 x i32> %b) {
100 ; CHECK-NEXT: smax v1.4s, v1.4s, v3.4s
101 ; CHECK-NEXT: smax v0.4s, v0.4s, v2.4s
103 %t1 = icmp sgt <8 x i32> %a, %b
104 %t2 = select <8 x i1> %t1, <8 x i32> %a, <8 x i32> %b
108 define <16 x i32> @t11(<16 x i32> %a, <16 x i32> %b) {
111 ; CHECK-NEXT: smin v2.4s, v2.4s, v6.4s
112 ; CHECK-NEXT: smin v0.4s, v0.4s, v4.4s
113 ; CHECK-NEXT: smin v1.4s, v1.4s, v5.4s
114 ; CHECK-NEXT: smin v3.4s, v3.4s, v7.4s
116 %t1 = icmp sle <16 x i32> %a, %b
117 %t2 = select <16 x i1> %t1, <16 x i32> %a, <16 x i32> %b
121 ; The icmp is used by two instructions, so don't produce a umin node.
122 define <16 x i8> @t12(<16 x i8> %a, <16 x i8> %b) {
125 ; CHECK-NEXT: cmhi v2.16b, v1.16b, v0.16b
126 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
127 ; CHECK-NEXT: sub v0.16b, v0.16b, v2.16b
129 %t1 = icmp ugt <16 x i8> %b, %a
130 %t2 = select <16 x i1> %t1, <16 x i8> %a, <16 x i8> %b
131 %t3 = zext <16 x i1> %t1 to <16 x i8>
132 %t4 = add <16 x i8> %t3, %t2
136 define <1 x i64> @t13(<1 x i64> %a, <1 x i64> %b) {
139 ; CHECK-NEXT: cmhi d2, d1, d0
140 ; CHECK-NEXT: bif v0.8b, v1.8b, v2.8b
142 %t1 = icmp ult <1 x i64> %a, %b
143 %t2 = select <1 x i1> %t1, <1 x i64> %a, <1 x i64> %b
147 define <2 x i64> @t14(<2 x i64> %a, <2 x i64> %b) {
150 ; CHECK-NEXT: cmhi v2.2d, v0.2d, v1.2d
151 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
153 %t1 = icmp ugt <2 x i64> %a, %b
154 %t2 = select <2 x i1> %t1, <2 x i64> %a, <2 x i64> %b
158 define <4 x i64> @t15(<4 x i64> %a, <4 x i64> %b) {
161 ; CHECK-NEXT: cmhi v4.2d, v3.2d, v1.2d
162 ; CHECK-NEXT: cmhi v5.2d, v2.2d, v0.2d
163 ; CHECK-NEXT: bif v1.16b, v3.16b, v4.16b
164 ; CHECK-NEXT: bif v0.16b, v2.16b, v5.16b
166 %t1 = icmp ule <4 x i64> %a, %b
167 %t2 = select <4 x i1> %t1, <4 x i64> %a, <4 x i64> %b