1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
6 ; CHECK-LABEL: name: test_simple
8 ; CHECK-NEXT: successors: %bb.1(0x80000000)
10 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
11 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
12 ; CHECK-NEXT: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[COPY]](s64)
13 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[INTTOPTR]](p0)
14 ; CHECK-NEXT: $x0 = COPY [[PTRTOINT]](s64)
15 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
16 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
17 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC1]], [[C]]
18 ; CHECK-NEXT: G_BRCOND [[AND]](s32), %bb.1
21 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
22 ; CHECK-NEXT: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
23 ; CHECK-NEXT: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
24 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
25 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC4]], [[C1]]
26 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), [[TRUNC2]], [[TRUNC3]]
27 ; CHECK-NEXT: $w0 = COPY [[SELECT]](s32)
28 ; CHECK-NEXT: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
29 ; CHECK-NEXT: [[TRUNC6:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
30 ; CHECK-NEXT: [[TRUNC7:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
31 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC7]], [[C1]]
32 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND2]](s32), [[TRUNC5]], [[TRUNC6]]
33 ; CHECK-NEXT: $w0 = COPY [[SELECT1]](s32)
34 ; CHECK-NEXT: [[TRUNC8:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
35 ; CHECK-NEXT: [[TRUNC9:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
36 ; CHECK-NEXT: [[TRUNC10:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
37 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC10]], [[C1]]
38 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[AND3]](s32), [[TRUNC8]], [[TRUNC9]]
39 ; CHECK-NEXT: $w0 = COPY [[SELECT2]](s32)
40 ; CHECK-NEXT: [[TRUNC11:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
41 ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s32) = G_AND [[TRUNC11]], [[C1]]
42 ; CHECK-NEXT: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[AND4]](s32), [[TRUNC]], [[TRUNC]]
43 ; CHECK-NEXT: [[TRUNC12:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
44 ; CHECK-NEXT: [[AND5:%[0-9]+]]:_(s32) = G_AND [[TRUNC12]], [[C1]]
45 ; CHECK-NEXT: [[SELECT4:%[0-9]+]]:_(s64) = G_SELECT [[AND5]](s32), [[COPY]], [[COPY]]
46 ; CHECK-NEXT: $x0 = COPY [[SELECT4]](s64)
47 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(<2 x s32>) = G_BITCAST [[COPY]](s64)
48 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:_(s64) = G_BITCAST [[BITCAST]](<2 x s32>)
49 ; CHECK-NEXT: $x0 = COPY [[BITCAST1]](s64)
50 ; CHECK-NEXT: [[BITCAST2:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[SELECT3]](s32)
51 ; CHECK-NEXT: $w0 = COPY [[BITCAST2]](<2 x s16>)
52 ; CHECK-NEXT: [[BITCAST3:%[0-9]+]]:_(<4 x s8>) = G_BITCAST [[TRUNC]](s32)
53 ; CHECK-NEXT: [[BITCAST4:%[0-9]+]]:_(s32) = G_BITCAST [[BITCAST3]](<4 x s8>)
54 ; CHECK-NEXT: $w0 = COPY [[BITCAST4]](s32)
55 ; CHECK-NEXT: [[BITCAST5:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[TRUNC]](s32)
56 ; CHECK-NEXT: [[BITCAST6:%[0-9]+]]:_(s32) = G_BITCAST [[BITCAST5]](<2 x s16>)
57 ; CHECK-NEXT: $w0 = COPY [[BITCAST6]](s32)
59 successors: %bb.1(0x80000000)
62 %1:_(s1) = G_TRUNC %0(s64)
63 %2:_(s8) = G_TRUNC %0(s64)
64 %3:_(s16) = G_TRUNC %0(s64)
65 %4:_(s32) = G_TRUNC %0(s64)
66 %5:_(p0) = G_INTTOPTR %0(s64)
67 %6:_(s64) = G_PTRTOINT %5(p0)
69 G_BRCOND %1(s1), %bb.1
72 %7:_(s1) = G_SELECT %1(s1), %1, %1
73 %17:_(s32) = G_ANYEXT %7(s1)
75 %8:_(s8) = G_SELECT %1(s1), %2, %2
76 %18:_(s32) = G_ANYEXT %8(s8)
78 %9:_(s16) = G_SELECT %1(s1), %3, %3
79 %19:_(s32) = G_ANYEXT %9(s16)
81 %10:_(s32) = G_SELECT %1(s1), %4, %4
82 %11:_(s64) = G_SELECT %1(s1), %0, %0
84 %12:_(<2 x s32>) = G_BITCAST %0(s64)
85 %13:_(s64) = G_BITCAST %12(<2 x s32>)
87 %14:_(<2 x s16>) = G_BITCAST %10(s32)
89 %15:_(<4 x s8>) = G_BITCAST %4(s32)
90 %20:_(s32) = G_BITCAST %15(<4 x s8>)
92 %16:_(<2 x s16>) = G_BITCAST %4(s32)
93 %21:_(s32) = G_BITCAST %16(<2 x s16>)
103 ; CHECK-LABEL: name: bitcast128
104 ; CHECK: liveins: $x0, $x1
106 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
107 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
108 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[COPY]](s64), [[COPY1]](s64)
109 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(<2 x s64>) = G_BITCAST [[MV]](s128)
110 ; CHECK-NEXT: $q0 = COPY [[BITCAST]](<2 x s64>)
111 ; CHECK-NEXT: RET_ReallyLR implicit $q0
114 %3:_(s128) = G_MERGE_VALUES %0(s64), %1(s64)
115 %2:_(<2 x s64>) = G_BITCAST %3(s128)
116 $q0 = COPY %2(<2 x s64>)
117 RET_ReallyLR implicit $q0
121 name: testExtOfCopyOfTrunc
126 ; CHECK-LABEL: name: testExtOfCopyOfTrunc
127 ; CHECK: liveins: $x0
129 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
130 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
131 ; CHECK-NEXT: RET_ReallyLR implicit $x0
133 %1:_(s1) = G_TRUNC %0(s64)
134 %2:_(s1) = COPY %1(s1)
135 %3:_(s64) = G_ANYEXT %2(s1)
137 RET_ReallyLR implicit $x0
141 name: testExtOfHintOfTrunc
146 ; CHECK-LABEL: name: testExtOfHintOfTrunc
147 ; CHECK: liveins: $x0
149 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
150 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
151 ; CHECK-NEXT: RET_ReallyLR implicit $x0
153 %1:_(s8) = G_TRUNC %0(s64)
154 %2:_(s8) = G_ASSERT_ZEXT %1(s8), 1
155 %3:_(s64) = G_ANYEXT %2(s8)
157 RET_ReallyLR implicit $x0
161 name: testExtOfCopyAndHintOfTrunc
166 ; CHECK-LABEL: name: testExtOfCopyAndHintOfTrunc
167 ; CHECK: liveins: $x0
169 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
170 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
171 ; CHECK-NEXT: RET_ReallyLR implicit $x0
173 %1:_(s8) = G_TRUNC %0(s64)
174 %2:_(s8) = COPY %1(s8)
175 %3:_(s8) = G_ASSERT_ZEXT %2(s8), 1
176 %4:_(s64) = G_ANYEXT %3(s8)
178 RET_ReallyLR implicit $x0
182 name: testExtOf2CopyOfTrunc
187 ; CHECK-LABEL: name: testExtOf2CopyOfTrunc
188 ; CHECK: liveins: $x0
190 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
191 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
192 ; CHECK-NEXT: RET_ReallyLR implicit $x0
194 %1:_(s1) = G_TRUNC %0(s64)
195 %2:_(s1) = COPY %1(s1)
196 %4:_(s1) = COPY %2(s1)
197 %3:_(s64) = G_ANYEXT %4(s1)
199 RET_ReallyLR implicit $x0
203 name: testUnmergeHintOfTrunc
208 ; CHECK-LABEL: name: testUnmergeHintOfTrunc
209 ; CHECK: liveins: $x0
211 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
212 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s8), [[UV1:%[0-9]+]]:_(s8), [[UV2:%[0-9]+]]:_(s8), [[UV3:%[0-9]+]]:_(s8), [[UV4:%[0-9]+]]:_(s8), [[UV5:%[0-9]+]]:_(s8), [[UV6:%[0-9]+]]:_(s8), [[UV7:%[0-9]+]]:_(s8) = G_UNMERGE_VALUES [[COPY]](s64)
213 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[UV1]](s8)
214 ; CHECK-NEXT: $x0 = COPY [[ANYEXT]](s64)
215 ; CHECK-NEXT: RET_ReallyLR implicit $x0
217 %1:_(s16) = G_TRUNC %0(s64)
218 %2:_(s16) = G_ASSERT_ZEXT %1(s16), 1
219 %3:_(s8), %4:_(s8) = G_UNMERGE_VALUES %2(s16)
220 %5:_(s64) = G_ANYEXT %4(s8)
222 RET_ReallyLR implicit $x0