1 ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple -asm-verbose=false | FileCheck %s
3 define i32 @vmax_u8x8(<8 x i8> %a) nounwind ssp {
4 ; CHECK-LABEL: vmax_u8x8:
5 ; CHECK: umaxv.8b b[[REG:[0-9]+]], v0
6 ; CHECK: fmov [[REG2:w[0-9]+]], s[[REG]]
10 %vmaxv.i = tail call i32 @llvm.aarch64.neon.umaxv.i32.v8i8(<8 x i8> %a) nounwind
11 %tmp = trunc i32 %vmaxv.i to i8
12 %tobool = icmp eq i8 %tmp, 0
13 br i1 %tobool, label %return, label %if.then
16 %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)() nounwind
20 %retval.0 = phi i32 [ %call1, %if.then ], [ 0, %entry ]
26 define i32 @vmax_u4x16(<4 x i16> %a) nounwind ssp {
27 ; CHECK-LABEL: vmax_u4x16:
28 ; CHECK: umaxv.4h h[[REG:[0-9]+]], v0
29 ; CHECK: fmov [[REG2:w[0-9]+]], s[[REG]]
31 ; CHECK: cbz [[REG2]],
33 %vmaxv.i = tail call i32 @llvm.aarch64.neon.umaxv.i32.v4i16(<4 x i16> %a) nounwind
34 %tmp = trunc i32 %vmaxv.i to i16
35 %tobool = icmp eq i16 %tmp, 0
36 br i1 %tobool, label %return, label %if.then
39 %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)() nounwind
43 %retval.0 = phi i32 [ %call1, %if.then ], [ 0, %entry ]
47 define i32 @vmax_u8x16(<8 x i16> %a) nounwind ssp {
48 ; CHECK-LABEL: vmax_u8x16:
49 ; CHECK: umaxv.8h h[[REG:[0-9]+]], v0
50 ; CHECK: fmov [[REG2:w[0-9]+]], s[[REG]]
52 ; CHECK: cbz [[REG2]],
54 %vmaxv.i = tail call i32 @llvm.aarch64.neon.umaxv.i32.v8i16(<8 x i16> %a) nounwind
55 %tmp = trunc i32 %vmaxv.i to i16
56 %tobool = icmp eq i16 %tmp, 0
57 br i1 %tobool, label %return, label %if.then
60 %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)() nounwind
64 %retval.0 = phi i32 [ %call1, %if.then ], [ 0, %entry ]
68 define i32 @vmax_u16x8(<16 x i8> %a) nounwind ssp {
69 ; CHECK-LABEL: vmax_u16x8:
70 ; CHECK: umaxv.16b b[[REG:[0-9]+]], v0
71 ; CHECK: fmov [[REG2:w[0-9]+]], s[[REG]]
73 ; CHECK: cbz [[REG2]],
75 %vmaxv.i = tail call i32 @llvm.aarch64.neon.umaxv.i32.v16i8(<16 x i8> %a) nounwind
76 %tmp = trunc i32 %vmaxv.i to i8
77 %tobool = icmp eq i8 %tmp, 0
78 br i1 %tobool, label %return, label %if.then
81 %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)() nounwind
85 %retval.0 = phi i32 [ %call1, %if.then ], [ 0, %entry ]
89 define <8 x i8> @test_vmaxv_u8_used_by_laneop(<8 x i8> %a1, <8 x i8> %a2) {
90 ; CHECK-LABEL: test_vmaxv_u8_used_by_laneop:
91 ; CHECK: umaxv.8b b[[REGNUM:[0-9]+]], v1
92 ; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0]
95 %0 = tail call i32 @llvm.aarch64.neon.umaxv.i32.v8i8(<8 x i8> %a2)
96 %1 = trunc i32 %0 to i8
97 %2 = insertelement <8 x i8> %a1, i8 %1, i32 3
101 define <4 x i16> @test_vmaxv_u16_used_by_laneop(<4 x i16> %a1, <4 x i16> %a2) {
102 ; CHECK-LABEL: test_vmaxv_u16_used_by_laneop:
103 ; CHECK: umaxv.4h h[[REGNUM:[0-9]+]], v1
104 ; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0]
107 %0 = tail call i32 @llvm.aarch64.neon.umaxv.i32.v4i16(<4 x i16> %a2)
108 %1 = trunc i32 %0 to i16
109 %2 = insertelement <4 x i16> %a1, i16 %1, i32 3
113 define <2 x i32> @test_vmaxv_u32_used_by_laneop(<2 x i32> %a1, <2 x i32> %a2) {
114 ; CHECK-LABEL: test_vmaxv_u32_used_by_laneop:
115 ; CHECK: umaxp.2s v[[REGNUM:[0-9]+]], v1, v1
116 ; CHECK-NEXT: mov.s v0[1], v[[REGNUM]][0]
119 %0 = tail call i32 @llvm.aarch64.neon.umaxv.i32.v2i32(<2 x i32> %a2)
120 %1 = insertelement <2 x i32> %a1, i32 %0, i32 1
124 define <16 x i8> @test_vmaxvq_u8_used_by_laneop(<16 x i8> %a1, <16 x i8> %a2) {
125 ; CHECK-LABEL: test_vmaxvq_u8_used_by_laneop:
126 ; CHECK: umaxv.16b b[[REGNUM:[0-9]+]], v1
127 ; CHECK-NEXT: mov.b v0[3], v[[REGNUM]][0]
130 %0 = tail call i32 @llvm.aarch64.neon.umaxv.i32.v16i8(<16 x i8> %a2)
131 %1 = trunc i32 %0 to i8
132 %2 = insertelement <16 x i8> %a1, i8 %1, i32 3
136 define <8 x i16> @test_vmaxvq_u16_used_by_laneop(<8 x i16> %a1, <8 x i16> %a2) {
137 ; CHECK-LABEL: test_vmaxvq_u16_used_by_laneop:
138 ; CHECK: umaxv.8h h[[REGNUM:[0-9]+]], v1
139 ; CHECK-NEXT: mov.h v0[3], v[[REGNUM]][0]
142 %0 = tail call i32 @llvm.aarch64.neon.umaxv.i32.v8i16(<8 x i16> %a2)
143 %1 = trunc i32 %0 to i16
144 %2 = insertelement <8 x i16> %a1, i16 %1, i32 3
148 define <4 x i32> @test_vmaxvq_u32_used_by_laneop(<4 x i32> %a1, <4 x i32> %a2) {
149 ; CHECK-LABEL: test_vmaxvq_u32_used_by_laneop:
150 ; CHECK: umaxv.4s s[[REGNUM:[0-9]+]], v1
151 ; CHECK-NEXT: mov.s v0[3], v[[REGNUM]][0]
154 %0 = tail call i32 @llvm.aarch64.neon.umaxv.i32.v4i32(<4 x i32> %a2)
155 %1 = insertelement <4 x i32> %a1, i32 %0, i32 3
159 declare i32 @llvm.aarch64.neon.umaxv.i32.v16i8(<16 x i8>) nounwind readnone
160 declare i32 @llvm.aarch64.neon.umaxv.i32.v8i16(<8 x i16>) nounwind readnone
161 declare i32 @llvm.aarch64.neon.umaxv.i32.v4i16(<4 x i16>) nounwind readnone
162 declare i32 @llvm.aarch64.neon.umaxv.i32.v8i8(<8 x i8>) nounwind readnone
163 declare i32 @llvm.aarch64.neon.umaxv.i32.v2i32(<2 x i32>) nounwind readnone
164 declare i32 @llvm.aarch64.neon.umaxv.i32.v4i32(<4 x i32>) nounwind readnone