1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=aarch64 -run-pass=legalizer -global-isel-abort=1 %s -o - | FileCheck %s
5 tracksRegLiveness: true
10 ; CHECK-LABEL: name: add_v16s8
12 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
13 ; CHECK: [[LOAD:%[0-9]+]]:_(<16 x s8>) = G_LOAD [[COPY]](p0) :: (load (<16 x s8>))
14 ; CHECK: [[VECREDUCE_ADD:%[0-9]+]]:_(s8) = G_VECREDUCE_ADD [[LOAD]](<16 x s8>)
15 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[VECREDUCE_ADD]](s8)
16 ; CHECK: $w0 = COPY [[ANYEXT]](s32)
17 ; CHECK: RET_ReallyLR implicit $w0
19 %1:_(<16 x s8>) = G_LOAD %0(p0) :: (load (<16 x s8>))
20 %2:_(s8) = G_VECREDUCE_ADD %1(<16 x s8>)
21 %3:_(s32) = G_ANYEXT %2(s8)
23 RET_ReallyLR implicit $w0
28 tracksRegLiveness: true
33 ; CHECK-LABEL: name: add_v8s16
35 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
36 ; CHECK: [[LOAD:%[0-9]+]]:_(<8 x s16>) = G_LOAD [[COPY]](p0) :: (load (<8 x s16>))
37 ; CHECK: [[VECREDUCE_ADD:%[0-9]+]]:_(s16) = G_VECREDUCE_ADD [[LOAD]](<8 x s16>)
38 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[VECREDUCE_ADD]](s16)
39 ; CHECK: $w0 = COPY [[ANYEXT]](s32)
40 ; CHECK: RET_ReallyLR implicit $w0
42 %1:_(<8 x s16>) = G_LOAD %0(p0) :: (load (<8 x s16>))
43 %2:_(s16) = G_VECREDUCE_ADD %1(<8 x s16>)
44 %3:_(s32) = G_ANYEXT %2(s16)
46 RET_ReallyLR implicit $w0
51 tracksRegLiveness: true
56 ; CHECK-LABEL: name: add_v4s32
58 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
59 ; CHECK: [[LOAD:%[0-9]+]]:_(<4 x s32>) = G_LOAD [[COPY]](p0) :: (load (<4 x s32>))
60 ; CHECK: [[VECREDUCE_ADD:%[0-9]+]]:_(s32) = G_VECREDUCE_ADD [[LOAD]](<4 x s32>)
61 ; CHECK: $w0 = COPY [[VECREDUCE_ADD]](s32)
62 ; CHECK: RET_ReallyLR implicit $w0
64 %1:_(<4 x s32>) = G_LOAD %0(p0) :: (load (<4 x s32>))
65 %2:_(s32) = G_VECREDUCE_ADD %1(<4 x s32>)
67 RET_ReallyLR implicit $w0
72 tracksRegLiveness: true
77 ; CHECK-LABEL: name: add_v2s64
79 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
80 ; CHECK: [[LOAD:%[0-9]+]]:_(<2 x s64>) = G_LOAD [[COPY]](p0) :: (load (<2 x s64>))
81 ; CHECK: [[VECREDUCE_ADD:%[0-9]+]]:_(s64) = G_VECREDUCE_ADD [[LOAD]](<2 x s64>)
82 ; CHECK: $x0 = COPY [[VECREDUCE_ADD]](s64)
83 ; CHECK: RET_ReallyLR implicit $x0
85 %1:_(<2 x s64>) = G_LOAD %0(p0) :: (load (<2 x s64>))
86 %2:_(s64) = G_VECREDUCE_ADD %1(<2 x s64>)
88 RET_ReallyLR implicit $x0
93 tracksRegLiveness: true
98 ; CHECK-LABEL: name: add_v2s32
100 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
101 ; CHECK: [[LOAD:%[0-9]+]]:_(<2 x s32>) = G_LOAD [[COPY]](p0) :: (load (<2 x s32>))
102 ; CHECK: [[VECREDUCE_ADD:%[0-9]+]]:_(s32) = G_VECREDUCE_ADD [[LOAD]](<2 x s32>)
103 ; CHECK: $w0 = COPY [[VECREDUCE_ADD]](s32)
104 ; CHECK: RET_ReallyLR implicit $w0
106 %1:_(<2 x s32>) = G_LOAD %0(p0) :: (load (<2 x s32>))
107 %2:_(s32) = G_VECREDUCE_ADD %1(<2 x s32>)
109 RET_ReallyLR implicit $w0
115 tracksRegLiveness: true
118 liveins: $q0, $q1, $q2, $q3
119 ; This is a power-of-2 legalization, so use a tree reduction.
120 ; CHECK-LABEL: name: test_v8i64
121 ; CHECK: liveins: $q0, $q1, $q2, $q3
122 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
123 ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $q1
124 ; CHECK: [[COPY2:%[0-9]+]]:_(<2 x s64>) = COPY $q2
125 ; CHECK: [[COPY3:%[0-9]+]]:_(<2 x s64>) = COPY $q3
126 ; CHECK: [[ADD:%[0-9]+]]:_(<2 x s64>) = G_ADD [[COPY]], [[COPY1]]
127 ; CHECK: [[ADD1:%[0-9]+]]:_(<2 x s64>) = G_ADD [[COPY2]], [[COPY3]]
128 ; CHECK: [[ADD2:%[0-9]+]]:_(<2 x s64>) = G_ADD [[ADD]], [[ADD1]]
129 ; CHECK: [[VECREDUCE_ADD:%[0-9]+]]:_(s64) = G_VECREDUCE_ADD [[ADD2]](<2 x s64>)
130 ; CHECK: $x0 = COPY [[VECREDUCE_ADD]](s64)
131 ; CHECK: RET_ReallyLR implicit $x0
132 %0:_(<2 x s64>) = COPY $q0
133 %1:_(<2 x s64>) = COPY $q1
134 %2:_(<2 x s64>) = COPY $q2
135 %3:_(<2 x s64>) = COPY $q3
136 %4:_(<4 x s64>) = G_CONCAT_VECTORS %0(<2 x s64>), %1(<2 x s64>)
137 %5:_(<4 x s64>) = G_CONCAT_VECTORS %2(<2 x s64>), %3(<2 x s64>)
138 %6:_(<8 x s64>) = G_CONCAT_VECTORS %4(<4 x s64>), %5(<4 x s64>)
139 %7:_(s64) = G_VECREDUCE_ADD %6(<8 x s64>)
141 RET_ReallyLR implicit $x0
147 tracksRegLiveness: true
150 liveins: $q0, $q1, $q2, $q3
151 ; This is a non-power-of-2 legalization, generate multiple vector reductions
152 ; and combine them with scalar ops.
153 ; CHECK-LABEL: name: test_v6i64
154 ; CHECK: liveins: $q0, $q1, $q2, $q3
155 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
156 ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $q1
157 ; CHECK: [[COPY2:%[0-9]+]]:_(<2 x s64>) = COPY $q2
158 ; CHECK: [[VECREDUCE_ADD:%[0-9]+]]:_(s64) = G_VECREDUCE_ADD [[COPY]](<2 x s64>)
159 ; CHECK: [[VECREDUCE_ADD1:%[0-9]+]]:_(s64) = G_VECREDUCE_ADD [[COPY1]](<2 x s64>)
160 ; CHECK: [[VECREDUCE_ADD2:%[0-9]+]]:_(s64) = G_VECREDUCE_ADD [[COPY2]](<2 x s64>)
161 ; CHECK: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[VECREDUCE_ADD]], [[VECREDUCE_ADD1]]
162 ; CHECK: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[ADD]], [[VECREDUCE_ADD2]]
163 ; CHECK: $x0 = COPY [[ADD1]](s64)
164 ; CHECK: RET_ReallyLR implicit $x0
165 %0:_(<2 x s64>) = COPY $q0
166 %1:_(<2 x s64>) = COPY $q1
167 %2:_(<2 x s64>) = COPY $q2
168 %3:_(<6 x s64>) = G_CONCAT_VECTORS %0(<2 x s64>), %1(<2 x s64>), %2(<2 x s64>)
169 %4:_(s64) = G_VECREDUCE_ADD %3(<6 x s64>)
171 RET_ReallyLR implicit $x0