1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -march=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
6 ; CHECK-LABEL: name: test_simple
8 ; CHECK: successors: %bb.1(0x80000000)
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
10 ; CHECK: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s64)
11 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
12 ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[COPY]](s64)
13 ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[INTTOPTR]](p0)
14 ; CHECK: $x0 = COPY [[PTRTOINT]](s64)
15 ; CHECK: G_BRCOND [[TRUNC]](s1), %bb.1
17 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
18 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
19 ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC2]], [[TRUNC3]]
20 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
21 ; CHECK: $w0 = COPY [[COPY1]](s32)
22 ; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
23 ; CHECK: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
24 ; CHECK: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC4]], [[TRUNC5]]
25 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SELECT1]](s32)
26 ; CHECK: $w0 = COPY [[COPY2]](s32)
27 ; CHECK: [[TRUNC6:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
28 ; CHECK: [[TRUNC7:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
29 ; CHECK: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC6]], [[TRUNC7]]
30 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[SELECT2]](s32)
31 ; CHECK: $w0 = COPY [[COPY3]](s32)
32 ; CHECK: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC1]], [[TRUNC1]]
33 ; CHECK: [[SELECT4:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[COPY]], [[COPY]]
34 ; CHECK: $x0 = COPY [[SELECT4]](s64)
35 ; CHECK: [[BITCAST:%[0-9]+]]:_(<2 x s32>) = G_BITCAST [[COPY]](s64)
36 ; CHECK: [[BITCAST1:%[0-9]+]]:_(s64) = G_BITCAST [[BITCAST]](<2 x s32>)
37 ; CHECK: $x0 = COPY [[BITCAST1]](s64)
38 ; CHECK: [[BITCAST2:%[0-9]+]]:_(s32) = G_BITCAST [[SELECT3]](s32)
39 ; CHECK: $w0 = COPY [[BITCAST2]](s32)
40 ; CHECK: [[BITCAST3:%[0-9]+]]:_(<4 x s8>) = G_BITCAST [[TRUNC1]](s32)
41 ; CHECK: [[BITCAST4:%[0-9]+]]:_(s32) = G_BITCAST [[BITCAST3]](<4 x s8>)
42 ; CHECK: $w0 = COPY [[BITCAST4]](s32)
43 ; CHECK: [[BITCAST5:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[TRUNC1]](s32)
44 ; CHECK: [[BITCAST6:%[0-9]+]]:_(s32) = G_BITCAST [[BITCAST5]](<2 x s16>)
45 ; CHECK: $w0 = COPY [[BITCAST6]](s32)
47 successors: %bb.1(0x80000000)
50 %1:_(s1) = G_TRUNC %0(s64)
51 %2:_(s8) = G_TRUNC %0(s64)
52 %3:_(s16) = G_TRUNC %0(s64)
53 %4:_(s32) = G_TRUNC %0(s64)
54 %5:_(p0) = G_INTTOPTR %0(s64)
55 %6:_(s64) = G_PTRTOINT %5(p0)
57 G_BRCOND %1(s1), %bb.1
60 %7:_(s1) = G_SELECT %1(s1), %1, %1
61 %17:_(s32) = G_ANYEXT %7(s1)
63 %8:_(s8) = G_SELECT %1(s1), %2, %2
64 %18:_(s32) = G_ANYEXT %8(s8)
66 %9:_(s16) = G_SELECT %1(s1), %3, %3
67 %19:_(s32) = G_ANYEXT %9(s16)
69 %10:_(s32) = G_SELECT %1(s1), %4, %4
70 %11:_(s64) = G_SELECT %1(s1), %0, %0
72 %12:_(<2 x s32>) = G_BITCAST %0(s64)
73 %13:_(s64) = G_BITCAST %12(<2 x s32>)
75 %14:_(s32) = G_BITCAST %10(s32)
77 %15:_(<4 x s8>) = G_BITCAST %4(s32)
78 %20:_(s32) = G_BITCAST %15(<4 x s8>)
80 %16:_(<2 x s16>) = G_BITCAST %4(s32)
81 %21:_(s32) = G_BITCAST %16(<2 x s16>)
91 ; CHECK-LABEL: name: bitcast128
92 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
93 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
94 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[COPY]](s64), [[COPY1]](s64)
95 ; CHECK: [[BITCAST:%[0-9]+]]:_(<2 x s64>) = G_BITCAST [[MV]](s128)
96 ; CHECK: $q0 = COPY [[BITCAST]](<2 x s64>)
97 ; CHECK: RET_ReallyLR implicit $q0
100 %3:_(s128) = G_MERGE_VALUES %0(s64), %1(s64)
101 %2:_(<2 x s64>) = G_BITCAST %3(s128)
102 $q0 = COPY %2(<2 x s64>)
103 RET_ReallyLR implicit $q0
107 name: testExtOfCopyOfTrunc
112 ; CHECK-LABEL: name: testExtOfCopyOfTrunc
113 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
114 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
115 ; CHECK: $x0 = COPY [[COPY1]](s64)
116 ; CHECK: RET_ReallyLR implicit $x0
118 %1:_(s1) = G_TRUNC %0(s64)
119 %2:_(s1) = COPY %1(s1)
120 %3:_(s64) = G_ANYEXT %2(s1)
122 RET_ReallyLR implicit $x0
126 name: testExtOf2CopyOfTrunc
131 ; CHECK-LABEL: name: testExtOf2CopyOfTrunc
132 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
133 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
134 ; CHECK: $x0 = COPY [[COPY1]](s64)
135 ; CHECK: RET_ReallyLR implicit $x0
137 %1:_(s1) = G_TRUNC %0(s64)
138 %2:_(s1) = COPY %1(s1)
139 %4:_(s1) = COPY %2(s1)
140 %3:_(s64) = G_ANYEXT %4(s1)
142 RET_ReallyLR implicit $x0