1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -run-pass=legalizer -verify-machineinstrs -global-isel-abort=0 %s -o - | FileCheck %s
7 tracksRegLiveness: true
11 ; CHECK-LABEL: name: s32
12 ; CHECK: liveins: $w0, $w1
14 ; CHECK-NEXT: %x:_(s32) = COPY $w0
15 ; CHECK-NEXT: %y:_(s32) = COPY $w1
16 ; CHECK-NEXT: [[SADDO:%[0-9]+]]:_(s32), [[SADDO1:%[0-9]+]]:_(s32) = G_SADDO %x, %y
17 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
18 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SADDO]], [[C]](s64)
19 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
20 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C1]]
21 ; CHECK-NEXT: %saddsat:_(s32) = G_SELECT [[SADDO1]](s32), [[ADD]], [[SADDO]]
22 ; CHECK-NEXT: $w0 = COPY %saddsat(s32)
23 ; CHECK-NEXT: RET_ReallyLR implicit $w0
26 %saddsat:_(s32) = G_SADDSAT %x, %y
27 $w0 = COPY %saddsat(s32)
28 RET_ReallyLR implicit $w0
33 tracksRegLiveness: true
37 ; CHECK-LABEL: name: s64
38 ; CHECK: liveins: $x0, $x1
40 ; CHECK-NEXT: %x:_(s64) = COPY $x0
41 ; CHECK-NEXT: %y:_(s64) = COPY $x1
42 ; CHECK-NEXT: [[SADDO:%[0-9]+]]:_(s64), [[SADDO1:%[0-9]+]]:_(s32) = G_SADDO %x, %y
43 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
44 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SADDO]], [[C]](s64)
45 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -9223372036854775808
46 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[ASHR]], [[C1]]
47 ; CHECK-NEXT: %saddsat:_(s64) = G_SELECT [[SADDO1]](s32), [[ADD]], [[SADDO]]
48 ; CHECK-NEXT: $x0 = COPY %saddsat(s64)
49 ; CHECK-NEXT: RET_ReallyLR implicit $x0
52 %saddsat:_(s64) = G_SADDSAT %x, %y
53 $x0 = COPY %saddsat(s64)
54 RET_ReallyLR implicit $x0
59 tracksRegLiveness: true
62 liveins: $w0, $w1, $w2
64 ; CHECK-LABEL: name: s16
65 ; CHECK: liveins: $w0, $w1, $w2
67 ; CHECK-NEXT: %copy_1:_(s32) = COPY $w0
68 ; CHECK-NEXT: %copy_2:_(s32) = COPY $w1
69 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG %copy_1, 16
70 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG %copy_2, 16
71 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[SEXT_INREG]], [[SEXT_INREG1]]
72 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ADD]], 16
73 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[ADD]](s32), [[SEXT_INREG2]]
74 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[SEXT_INREG2]](s32)
75 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 15
76 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]](s64)
77 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -32768
78 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C1]]
79 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[ADD1]], [[ADD]]
80 ; CHECK-NEXT: $w0 = COPY [[SELECT]](s32)
81 ; CHECK-NEXT: RET_ReallyLR implicit $w0
82 %copy_1:_(s32) = COPY $w0
83 %x:_(s16) = G_TRUNC %copy_1(s32)
84 %copy_2:_(s32) = COPY $w1
85 %y:_(s16) = G_TRUNC %copy_2(s32)
86 %saddsat:_(s16) = G_SADDSAT %x, %y
87 %ext:_(s32) = G_ANYEXT %saddsat(s16)
89 RET_ReallyLR implicit $w0
94 tracksRegLiveness: true
97 liveins: $w0, $w1, $w2
99 ; CHECK-LABEL: name: s1
100 ; CHECK: liveins: $w0, $w1, $w2
102 ; CHECK-NEXT: %copy_1:_(s32) = COPY $w0
103 ; CHECK-NEXT: %copy_2:_(s32) = COPY $w1
104 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG %copy_1, 1
105 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG %copy_2, 1
106 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[SEXT_INREG]], [[SEXT_INREG1]]
107 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ADD]], 1
108 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[ADD]](s32), [[SEXT_INREG2]]
109 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[SEXT_INREG2]](s32)
110 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
111 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]](s64)
112 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
113 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C1]]
114 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[ADD1]], [[ADD]]
115 ; CHECK-NEXT: $w0 = COPY [[SELECT]](s32)
116 ; CHECK-NEXT: RET_ReallyLR implicit $w0
117 %copy_1:_(s32) = COPY $w0
118 %x:_(s1) = G_TRUNC %copy_1(s32)
119 %copy_2:_(s32) = COPY $w1
120 %y:_(s1) = G_TRUNC %copy_2(s32)
121 %saddsat:_(s1) = G_SADDSAT %x, %y
122 %ext:_(s32) = G_ANYEXT %saddsat(s1)
124 RET_ReallyLR implicit $w0
129 tracksRegLiveness: true
132 liveins: $w0, $w1, $w2
134 ; CHECK-LABEL: name: s3
135 ; CHECK: liveins: $w0, $w1, $w2
137 ; CHECK-NEXT: %copy_1:_(s32) = COPY $w0
138 ; CHECK-NEXT: %copy_2:_(s32) = COPY $w1
139 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG %copy_1, 3
140 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG %copy_2, 3
141 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[SEXT_INREG]], [[SEXT_INREG1]]
142 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ADD]], 3
143 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[ADD]](s32), [[SEXT_INREG2]]
144 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[SEXT_INREG2]](s32)
145 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
146 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]](s64)
147 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
148 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[ASHR]], [[C1]]
149 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[ADD1]], [[ADD]]
150 ; CHECK-NEXT: $w0 = COPY [[SELECT]](s32)
151 ; CHECK-NEXT: RET_ReallyLR implicit $w0
152 %copy_1:_(s32) = COPY $w0
153 %x:_(s3) = G_TRUNC %copy_1(s32)
154 %copy_2:_(s32) = COPY $w1
155 %y:_(s3) = G_TRUNC %copy_2(s32)
156 %saddsat:_(s3) = G_SADDSAT %x, %y
157 %ext:_(s32) = G_ANYEXT %saddsat(s3)
159 RET_ReallyLR implicit $w0
164 tracksRegLiveness: true
169 ; CHECK-LABEL: name: s36
170 ; CHECK: liveins: $x0, $x1
172 ; CHECK-NEXT: %copy_1:_(s64) = COPY $x0
173 ; CHECK-NEXT: %copy_2:_(s64) = COPY $x1
174 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG %copy_1, 36
175 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG %copy_2, 36
176 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[SEXT_INREG]], [[SEXT_INREG1]]
177 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s64) = G_SEXT_INREG [[ADD]], 36
178 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[ADD]](s64), [[SEXT_INREG2]]
179 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 35
180 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY [[SEXT_INREG2]](s64)
181 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[COPY]], [[C]](s64)
182 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 34359738368
183 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[ASHR]], [[C1]]
184 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[ICMP]](s32), [[ADD1]], [[ADD]]
185 ; CHECK-NEXT: $x0 = COPY [[SELECT]](s64)
186 ; CHECK-NEXT: RET_ReallyLR implicit $x0
187 %copy_1:_(s64) = COPY $x0
188 %x:_(s36) = G_TRUNC %copy_1(s64)
189 %copy_2:_(s64) = COPY $x1
190 %y:_(s36) = G_TRUNC %copy_2(s64)
191 %saddsat:_(s36) = G_SADDSAT %x, %y
192 %ext:_(s64) = G_ANYEXT %saddsat(s36)
194 RET_ReallyLR implicit $x0
199 tracksRegLiveness: true
202 liveins: $q0, $q1, $x0
203 ; CHECK-LABEL: name: s88
204 ; CHECK: liveins: $q0, $q1, $x0
206 ; CHECK-NEXT: %copy_1:_(s128) = COPY $q0
207 ; CHECK-NEXT: %copy_2:_(s128) = COPY $q1
208 ; CHECK-NEXT: [[EXTRACT:%[0-9]+]]:_(s64) = G_EXTRACT %copy_1(s128), 0
209 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
210 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES %copy_1(s128)
211 ; CHECK-NEXT: [[EXTRACT1:%[0-9]+]]:_(s64) = G_EXTRACT %copy_2(s128), 0
212 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s64), [[UV3:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES %copy_2(s128)
213 ; CHECK-NEXT: [[UADDO:%[0-9]+]]:_(s64), [[UADDO1:%[0-9]+]]:_(s32) = G_UADDO [[EXTRACT]], [[EXTRACT1]]
214 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[UV1]](s64)
215 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC]], 24
216 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[UV3]](s64)
217 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC1]], 24
218 ; CHECK-NEXT: [[UADDE:%[0-9]+]]:_(s32), [[UADDE1:%[0-9]+]]:_(s32) = G_UADDE [[SEXT_INREG]], [[SEXT_INREG1]], [[UADDO1]]
219 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s32) = G_SEXT_INREG [[UADDE]], 24
220 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[UADDE]](s32), [[SEXT_INREG2]]
221 ; CHECK-NEXT: [[UV4:%[0-9]+]]:_(s8), [[UV5:%[0-9]+]]:_(s8), [[UV6:%[0-9]+]]:_(s8), [[UV7:%[0-9]+]]:_(s8) = G_UNMERGE_VALUES [[UADDE]](s32)
222 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s8) = G_IMPLICIT_DEF
223 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
224 ; CHECK-NEXT: [[UV8:%[0-9]+]]:_(s8), [[UV9:%[0-9]+]]:_(s8), [[UV10:%[0-9]+]]:_(s8), [[UV11:%[0-9]+]]:_(s8) = G_UNMERGE_VALUES [[DEF1]](s32)
225 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s32) = G_MERGE_VALUES [[UV4]](s8), [[UV5]](s8), [[UV6]](s8), [[DEF]](s8)
226 ; CHECK-NEXT: [[MV1:%[0-9]+]]:_(s32) = G_MERGE_VALUES [[UV8]](s8), [[UV9]](s8), [[UV10]](s8), [[UV8]](s8)
227 ; CHECK-NEXT: [[MV2:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[MV]](s32), [[MV1]](s32)
228 ; CHECK-NEXT: [[SEXT_INREG3:%[0-9]+]]:_(s64) = G_SEXT_INREG [[MV2]], 24
229 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 23
230 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SEXT_INREG3]], [[C1]](s64)
231 ; CHECK-NEXT: [[UADDO2:%[0-9]+]]:_(s64), [[UADDO3:%[0-9]+]]:_(s32) = G_UADDO [[ASHR]], [[C]]
232 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[ICMP]](s32), [[UADDO2]], [[UADDO]]
233 ; CHECK-NEXT: $x0 = COPY [[SELECT]](s64)
234 ; CHECK-NEXT: RET_ReallyLR implicit $x0
235 %copy_1:_(s128) = COPY $q0
236 %x:_(s88) = G_TRUNC %copy_1(s128)
237 %copy_2:_(s128) = COPY $q1
238 %y:_(s88) = G_TRUNC %copy_2(s128)
239 %saddsat:_(s88) = G_SADDSAT %x, %y
240 %trunc:_(s64) = G_TRUNC %saddsat(s88)
241 $x0 = COPY %trunc(s64)
242 RET_ReallyLR implicit $x0