1 ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple -asm-verbose=false | FileCheck %s
2 ; RUN: llc < %s -global-isel=1 -mtriple=arm64-eabi -aarch64-neon-syntax=apple -asm-verbose=false | FileCheck %s
4 define signext i8 @test_vminv_s8(<8 x i8> %a1) {
6 ; CHECK: sminv.8b b[[REGNUM:[0-9]+]], v0
7 ; CHECK-NEXT: smov.b w0, v[[REGNUM]][0]
10 %vminv.i = tail call i32 @llvm.aarch64.neon.sminv.i32.v8i8(<8 x i8> %a1)
11 %0 = trunc i32 %vminv.i to i8
15 define signext i16 @test_vminv_s16(<4 x i16> %a1) {
16 ; CHECK: test_vminv_s16
17 ; CHECK: sminv.4h h[[REGNUM:[0-9]+]], v0
18 ; CHECK-NEXT: smov.h w0, v[[REGNUM]][0]
21 %vminv.i = tail call i32 @llvm.aarch64.neon.sminv.i32.v4i16(<4 x i16> %a1)
22 %0 = trunc i32 %vminv.i to i16
26 define i32 @test_vminv_s32(<2 x i32> %a1) {
27 ; CHECK: test_vminv_s32
28 ; 2 x i32 is not supported by the ISA, thus, this is a special case
29 ; CHECK: sminp.2s v[[REGNUM:[0-9]+]], v0, v0
30 ; CHECK-NEXT: fmov w0, s[[REGNUM]]
33 %vminv.i = tail call i32 @llvm.aarch64.neon.sminv.i32.v2i32(<2 x i32> %a1)
37 define signext i8 @test_vminvq_s8(<16 x i8> %a1) {
38 ; CHECK: test_vminvq_s8
39 ; CHECK: sminv.16b b[[REGNUM:[0-9]+]], v0
40 ; CHECK-NEXT: smov.b w0, v[[REGNUM]][0]
43 %vminv.i = tail call i32 @llvm.aarch64.neon.sminv.i32.v16i8(<16 x i8> %a1)
44 %0 = trunc i32 %vminv.i to i8
48 define signext i16 @test_vminvq_s16(<8 x i16> %a1) {
49 ; CHECK: test_vminvq_s16
50 ; CHECK: sminv.8h h[[REGNUM:[0-9]+]], v0
51 ; CHECK-NEXT: smov.h w0, v[[REGNUM]][0]
54 %vminv.i = tail call i32 @llvm.aarch64.neon.sminv.i32.v8i16(<8 x i16> %a1)
55 %0 = trunc i32 %vminv.i to i16
59 define i32 @test_vminvq_s32(<4 x i32> %a1) {
60 ; CHECK: test_vminvq_s32
61 ; CHECK: sminv.4s [[REGNUM:s[0-9]+]], v0
62 ; CHECK-NEXT: fmov w0, [[REGNUM]]
65 %vminv.i = tail call i32 @llvm.aarch64.neon.sminv.i32.v4i32(<4 x i32> %a1)
69 define <8 x i8> @test_vminv_s8_used_by_laneop(<8 x i8> %a1, <8 x i8> %a2) {
70 ; CHECK-LABEL: test_vminv_s8_used_by_laneop:
71 ; CHECK: sminv.8b b[[REGNUM:[0-9]+]], v1
72 ; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0]
75 %0 = tail call i32 @llvm.aarch64.neon.sminv.i32.v8i8(<8 x i8> %a2)
76 %1 = trunc i32 %0 to i8
77 %2 = insertelement <8 x i8> %a1, i8 %1, i32 3
81 define <4 x i16> @test_vminv_s16_used_by_laneop(<4 x i16> %a1, <4 x i16> %a2) {
82 ; CHECK-LABEL: test_vminv_s16_used_by_laneop:
83 ; CHECK: sminv.4h h[[REGNUM:[0-9]+]], v1
84 ; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0]
87 %0 = tail call i32 @llvm.aarch64.neon.sminv.i32.v4i16(<4 x i16> %a2)
88 %1 = trunc i32 %0 to i16
89 %2 = insertelement <4 x i16> %a1, i16 %1, i32 3
93 define <2 x i32> @test_vminv_s32_used_by_laneop(<2 x i32> %a1, <2 x i32> %a2) {
94 ; CHECK-LABEL: test_vminv_s32_used_by_laneop:
95 ; CHECK: sminp.2s v[[REGNUM:[0-9]+]], v1, v1
96 ; CHECK-NEXT: mov.s v0[1], v[[REGNUM]][0]
99 %0 = tail call i32 @llvm.aarch64.neon.sminv.i32.v2i32(<2 x i32> %a2)
100 %1 = insertelement <2 x i32> %a1, i32 %0, i32 1
104 define <16 x i8> @test_vminvq_s8_used_by_laneop(<16 x i8> %a1, <16 x i8> %a2) {
105 ; CHECK-LABEL: test_vminvq_s8_used_by_laneop:
106 ; CHECK: sminv.16b b[[REGNUM:[0-9]+]], v1
107 ; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0]
110 %0 = tail call i32 @llvm.aarch64.neon.sminv.i32.v16i8(<16 x i8> %a2)
111 %1 = trunc i32 %0 to i8
112 %2 = insertelement <16 x i8> %a1, i8 %1, i32 3
116 define <8 x i16> @test_vminvq_s16_used_by_laneop(<8 x i16> %a1, <8 x i16> %a2) {
117 ; CHECK-LABEL: test_vminvq_s16_used_by_laneop:
118 ; CHECK: sminv.8h h[[REGNUM:[0-9]+]], v1
119 ; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0]
122 %0 = tail call i32 @llvm.aarch64.neon.sminv.i32.v8i16(<8 x i16> %a2)
123 %1 = trunc i32 %0 to i16
124 %2 = insertelement <8 x i16> %a1, i16 %1, i32 3
128 define <4 x i32> @test_vminvq_s32_used_by_laneop(<4 x i32> %a1, <4 x i32> %a2) {
129 ; CHECK-LABEL: test_vminvq_s32_used_by_laneop:
130 ; CHECK: sminv.4s s[[REGNUM:[0-9]+]], v1
131 ; CHECK-NEXT: mov.s v0[3], v[[REGNUM]][0]
134 %0 = tail call i32 @llvm.aarch64.neon.sminv.i32.v4i32(<4 x i32> %a2)
135 %1 = insertelement <4 x i32> %a1, i32 %0, i32 3
139 declare i32 @llvm.aarch64.neon.sminv.i32.v4i32(<4 x i32>)
140 declare i32 @llvm.aarch64.neon.sminv.i32.v8i16(<8 x i16>)
141 declare i32 @llvm.aarch64.neon.sminv.i32.v16i8(<16 x i8>)
142 declare i32 @llvm.aarch64.neon.sminv.i32.v2i32(<2 x i32>)
143 declare i32 @llvm.aarch64.neon.sminv.i32.v4i16(<4 x i16>)
144 declare i32 @llvm.aarch64.neon.sminv.i32.v8i8(<8 x i8>)