1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-none-elf -verify-machineinstrs %s -o - | FileCheck %s
4 define <4 x i16> @vqmovni32_smaxmin(<4 x i32> %s0) {
5 ; CHECK-LABEL: vqmovni32_smaxmin:
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: sqxtn v0.4h, v0.4s
10 %c1 = icmp slt <4 x i32> %s0, <i32 32767, i32 32767, i32 32767, i32 32767>
11 %s1 = select <4 x i1> %c1, <4 x i32> %s0, <4 x i32> <i32 32767, i32 32767, i32 32767, i32 32767>
12 %c2 = icmp sgt <4 x i32> %s1, <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
13 %s2 = select <4 x i1> %c2, <4 x i32> %s1, <4 x i32> <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
14 %t = trunc <4 x i32> %s2 to <4 x i16>
18 define <4 x i16> @vqmovni32_sminmax(<4 x i32> %s0) {
19 ; CHECK-LABEL: vqmovni32_sminmax:
20 ; CHECK: // %bb.0: // %entry
21 ; CHECK-NEXT: sqxtn v0.4h, v0.4s
24 %c1 = icmp sgt <4 x i32> %s0, <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
25 %s1 = select <4 x i1> %c1, <4 x i32> %s0, <4 x i32> <i32 -32768, i32 -32768, i32 -32768, i32 -32768>
26 %c2 = icmp slt <4 x i32> %s1, <i32 32767, i32 32767, i32 32767, i32 32767>
27 %s2 = select <4 x i1> %c2, <4 x i32> %s1, <4 x i32> <i32 32767, i32 32767, i32 32767, i32 32767>
28 %t = trunc <4 x i32> %s2 to <4 x i16>
32 define <4 x i16> @vqmovni32_umaxmin(<4 x i32> %s0) {
33 ; CHECK-LABEL: vqmovni32_umaxmin:
34 ; CHECK: // %bb.0: // %entry
35 ; CHECK-NEXT: uqxtn v0.4h, v0.4s
38 %c1 = icmp ult <4 x i32> %s0, <i32 65535, i32 65535, i32 65535, i32 65535>
39 %s1 = select <4 x i1> %c1, <4 x i32> %s0, <4 x i32> <i32 65535, i32 65535, i32 65535, i32 65535>
40 %t = trunc <4 x i32> %s1 to <4 x i16>
44 define <8 x i8> @vqmovni16_smaxmin(<8 x i16> %s0) {
45 ; CHECK-LABEL: vqmovni16_smaxmin:
46 ; CHECK: // %bb.0: // %entry
47 ; CHECK-NEXT: sqxtn v0.8b, v0.8h
50 %c1 = icmp slt <8 x i16> %s0, <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
51 %s1 = select <8 x i1> %c1, <8 x i16> %s0, <8 x i16> <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
52 %c2 = icmp sgt <8 x i16> %s1, <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
53 %s2 = select <8 x i1> %c2, <8 x i16> %s1, <8 x i16> <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
54 %t = trunc <8 x i16> %s2 to <8 x i8>
58 define <8 x i8> @vqmovni16_sminmax(<8 x i16> %s0) {
59 ; CHECK-LABEL: vqmovni16_sminmax:
60 ; CHECK: // %bb.0: // %entry
61 ; CHECK-NEXT: sqxtn v0.8b, v0.8h
64 %c1 = icmp sgt <8 x i16> %s0, <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
65 %s1 = select <8 x i1> %c1, <8 x i16> %s0, <8 x i16> <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>
66 %c2 = icmp slt <8 x i16> %s1, <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
67 %s2 = select <8 x i1> %c2, <8 x i16> %s1, <8 x i16> <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>
68 %t = trunc <8 x i16> %s2 to <8 x i8>
72 define <8 x i8> @vqmovni16_umaxmin(<8 x i16> %s0) {
73 ; CHECK-LABEL: vqmovni16_umaxmin:
74 ; CHECK: // %bb.0: // %entry
75 ; CHECK-NEXT: uqxtn v0.8b, v0.8h
78 %c1 = icmp ult <8 x i16> %s0, <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
79 %s1 = select <8 x i1> %c1, <8 x i16> %s0, <8 x i16> <i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255, i16 255>
80 %t = trunc <8 x i16> %s1 to <8 x i8>
84 define <2 x i32> @vqmovni64_smaxmin(<2 x i64> %s0) {
85 ; CHECK-LABEL: vqmovni64_smaxmin:
86 ; CHECK: // %bb.0: // %entry
87 ; CHECK-NEXT: mov w8, #2147483647
88 ; CHECK-NEXT: dup v1.2d, x8
89 ; CHECK-NEXT: mov x8, #-2147483648
90 ; CHECK-NEXT: cmgt v2.2d, v1.2d, v0.2d
91 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
92 ; CHECK-NEXT: dup v1.2d, x8
93 ; CHECK-NEXT: cmgt v2.2d, v0.2d, v1.2d
94 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
95 ; CHECK-NEXT: xtn v0.2s, v0.2d
98 %c1 = icmp slt <2 x i64> %s0, <i64 2147483647, i64 2147483647>
99 %s1 = select <2 x i1> %c1, <2 x i64> %s0, <2 x i64> <i64 2147483647, i64 2147483647>
100 %c2 = icmp sgt <2 x i64> %s1, <i64 -2147483648, i64 -2147483648>
101 %s2 = select <2 x i1> %c2, <2 x i64> %s1, <2 x i64> <i64 -2147483648, i64 -2147483648>
102 %t = trunc <2 x i64> %s2 to <2 x i32>
106 define <2 x i32> @vqmovni64_sminmax(<2 x i64> %s0) {
107 ; CHECK-LABEL: vqmovni64_sminmax:
108 ; CHECK: // %bb.0: // %entry
109 ; CHECK-NEXT: mov x8, #-2147483648
110 ; CHECK-NEXT: dup v1.2d, x8
111 ; CHECK-NEXT: mov w8, #2147483647
112 ; CHECK-NEXT: cmgt v2.2d, v0.2d, v1.2d
113 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
114 ; CHECK-NEXT: dup v1.2d, x8
115 ; CHECK-NEXT: cmgt v2.2d, v1.2d, v0.2d
116 ; CHECK-NEXT: bif v0.16b, v1.16b, v2.16b
117 ; CHECK-NEXT: xtn v0.2s, v0.2d
120 %c1 = icmp sgt <2 x i64> %s0, <i64 -2147483648, i64 -2147483648>
121 %s1 = select <2 x i1> %c1, <2 x i64> %s0, <2 x i64> <i64 -2147483648, i64 -2147483648>
122 %c2 = icmp slt <2 x i64> %s1, <i64 2147483647, i64 2147483647>
123 %s2 = select <2 x i1> %c2, <2 x i64> %s1, <2 x i64> <i64 2147483647, i64 2147483647>
124 %t = trunc <2 x i64> %s2 to <2 x i32>
128 define <2 x i32> @vqmovni64_umaxmin(<2 x i64> %s0) {
129 ; CHECK-LABEL: vqmovni64_umaxmin:
130 ; CHECK: // %bb.0: // %entry
131 ; CHECK-NEXT: movi v1.2d, #0x000000ffffffff
132 ; CHECK-NEXT: cmhi v1.2d, v1.2d, v0.2d
133 ; CHECK-NEXT: and v0.16b, v0.16b, v1.16b
134 ; CHECK-NEXT: orn v0.16b, v0.16b, v1.16b
135 ; CHECK-NEXT: xtn v0.2s, v0.2d
138 %c1 = icmp ult <2 x i64> %s0, <i64 4294967295, i64 4294967295>
139 %s1 = select <2 x i1> %c1, <2 x i64> %s0, <2 x i64> <i64 4294967295, i64 4294967295>
140 %t = trunc <2 x i64> %s1 to <2 x i32>