1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -O0 -run-pass=legalizer %s -o - | FileCheck %s 3 4--- | 5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 6 target triple = "aarch64--" 7 define void @test_simple() { 8 entry: 9 ret void 10 next: 11 ret void 12 } 13 define void @bitcast128() { 14 ret void 15 } 16 define void @testExtOfCopyOfTrunc() { 17 ret void 18 } 19 define void @testExtOf2CopyOfTrunc() { 20 ret void 21 } 22... 23 24--- 25name: test_simple 26registers: 27 - { id: 0, class: _ } 28 - { id: 1, class: _ } 29 - { id: 2, class: _ } 30 - { id: 3, class: _ } 31 - { id: 4, class: _ } 32 - { id: 5, class: _ } 33 - { id: 6, class: _ } 34 - { id: 7, class: _ } 35 - { id: 8, class: _ } 36 - { id: 9, class: _ } 37 - { id: 10, class: _ } 38 - { id: 11, class: _ } 39 - { id: 12, class: _ } 40 - { id: 13, class: _ } 41 - { id: 14, class: _ } 42 - { id: 15, class: _ } 43 - { id: 16, class: _ } 44body: | 45 ; CHECK-LABEL: name: test_simple 46 ; CHECK: bb.0.{{[a-zA-Z0-9]+}}: 47 ; CHECK: successors: %bb.1(0x80000000) 48 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 49 ; CHECK: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[COPY]](s64) 50 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 51 ; CHECK: [[INTTOPTR:%[0-9]+]]:_(p0) = G_INTTOPTR [[COPY]](s64) 52 ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[INTTOPTR]](p0) 53 ; CHECK: $x0 = COPY [[PTRTOINT]](s64) 54 ; CHECK: G_BRCOND [[TRUNC]](s1), %bb.1 55 ; CHECK: bb.1.{{[a-zA-Z0-9]+}}: 56 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 57 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 58 ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC2]], [[TRUNC3]] 59 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32) 60 ; CHECK: $w0 = COPY [[COPY1]](s32) 61 ; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 62 ; CHECK: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 63 ; CHECK: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC4]], [[TRUNC5]] 64 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SELECT1]](s32) 65 ; CHECK: $w0 = COPY [[COPY2]](s32) 66 ; CHECK: [[TRUNC6:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 67 ; CHECK: [[TRUNC7:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64) 68 ; CHECK: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC6]], [[TRUNC7]] 69 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[SELECT2]](s32) 70 ; CHECK: $w0 = COPY [[COPY3]](s32) 71 ; CHECK: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[TRUNC]](s1), [[TRUNC1]], [[TRUNC1]] 72 ; CHECK: [[SELECT4:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[COPY]], [[COPY]] 73 ; CHECK: $x0 = COPY [[SELECT4]](s64) 74 ; CHECK: [[BITCAST:%[0-9]+]]:_(<2 x s32>) = G_BITCAST [[COPY]](s64) 75 ; CHECK: [[BITCAST1:%[0-9]+]]:_(s64) = G_BITCAST [[BITCAST]](<2 x s32>) 76 ; CHECK: $x0 = COPY [[BITCAST1]](s64) 77 ; CHECK: [[BITCAST2:%[0-9]+]]:_(s32) = G_BITCAST [[SELECT3]](s32) 78 ; CHECK: $w0 = COPY [[BITCAST2]](s32) 79 ; CHECK: [[BITCAST3:%[0-9]+]]:_(<4 x s8>) = G_BITCAST [[COPY]](s64) 80 ; CHECK: [[BITCAST4:%[0-9]+]]:_(s32) = G_BITCAST [[BITCAST3]](<4 x s8>) 81 ; CHECK: $w0 = COPY [[BITCAST4]](s32) 82 ; CHECK: [[BITCAST5:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[COPY]](s64) 83 ; CHECK: [[BITCAST6:%[0-9]+]]:_(s32) = G_BITCAST [[BITCAST5]](<2 x s16>) 84 ; CHECK: $w0 = COPY [[BITCAST6]](s32) 85 bb.0.entry: 86 liveins: $x0, $x1, $x2, $x3 87 %0(s64) = COPY $x0 88 89 %1(s1) = G_TRUNC %0 90 %2(s8) = G_TRUNC %0 91 %3(s16) = G_TRUNC %0 92 %4(s32) = G_TRUNC %0 93 94 %5(p0) = G_INTTOPTR %0 95 %6(s64) = G_PTRTOINT %5 96 $x0 = COPY %6 97 98 G_BRCOND %1, %bb.1 99 100 bb.1.next: 101 102 %7(s1) = G_SELECT %1, %1, %1 103 %21:_(s32) = G_ANYEXT %7 104 $w0 = COPY %21 105 106 %8(s8) = G_SELECT %1, %2, %2 107 %20:_(s32) = G_ANYEXT %8 108 $w0 = COPY %20 109 110 %9(s16) = G_SELECT %1, %3, %3 111 %19:_(s32) = G_ANYEXT %9 112 $w0 = COPY %19 113 114 %10(s32) = G_SELECT %1, %4, %4 115 %11(s64) = G_SELECT %1, %0, %0 116 $x0 = COPY %11 117 118 %12(<2 x s32>) = G_BITCAST %0 119 %13(s64) = G_BITCAST %12 120 $x0 = COPY %13 121 %14(s32) = G_BITCAST %10 122 $w0 = COPY %14 123 %15(<4 x s8>) = G_BITCAST %0 124 %17:_(s32) = G_BITCAST %15 125 $w0 = COPY %17 126 %16(<2 x s16>) = G_BITCAST %0 127 %18:_(s32) = G_BITCAST %16 128 $w0 = COPY %18 129... 130 131--- 132name: bitcast128 133tracksRegLiveness: true 134registers: 135 - { id: 0, class: _} 136 - { id: 1, class: _} 137 - { id: 2, class: _} 138 - { id: 3, class: _} 139body: | 140 bb.1: 141 liveins: $x0, $x1 142 ; This is legal and shouldn't be changed. 143 ; CHECK-LABEL: name: bitcast128 144 ; CHECK: liveins: $x0, $x1 145 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 146 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1 147 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[COPY]](s64), [[COPY1]](s64) 148 ; CHECK: [[BITCAST:%[0-9]+]]:_(<2 x s64>) = G_BITCAST [[MV]](s128) 149 ; CHECK: $q0 = COPY [[BITCAST]](<2 x s64>) 150 ; CHECK: RET_ReallyLR implicit $q0 151 %0(s64) = COPY $x0 152 %1(s64) = COPY $x1 153 %3(s128) = G_MERGE_VALUES %0(s64), %1(s64) 154 %2(<2 x s64>) = G_BITCAST %3(s128) 155 $q0 = COPY %2(<2 x s64>) 156 RET_ReallyLR implicit $q0 157 158... 159--- 160name: testExtOfCopyOfTrunc 161tracksRegLiveness: true 162registers: 163 - { id: 0, class: _} 164 - { id: 1, class: _} 165 - { id: 2, class: _} 166 - { id: 3, class: _} 167body: | 168 bb.1: 169 liveins: $x0 170 ; CHECK-LABEL: name: testExtOfCopyOfTrunc 171 ; CHECK: liveins: $x0 172 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 173 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64) 174 ; CHECK: $x0 = COPY [[COPY1]](s64) 175 ; CHECK: RET_ReallyLR implicit $x0 176 %0(s64) = COPY $x0 177 %1(s1) = G_TRUNC %0 178 %2(s1) = COPY %1 179 %3(s64) = G_ANYEXT %2 180 $x0 = COPY %3 181 RET_ReallyLR implicit $x0 182 183... 184--- 185name: testExtOf2CopyOfTrunc 186tracksRegLiveness: true 187registers: 188 - { id: 0, class: _} 189 - { id: 1, class: _} 190 - { id: 2, class: _} 191 - { id: 3, class: _} 192body: | 193 bb.1: 194 liveins: $x0 195 ; CHECK-LABEL: name: testExtOf2CopyOfTrunc 196 ; CHECK: liveins: $x0 197 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0 198 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64) 199 ; CHECK: $x0 = COPY [[COPY1]](s64) 200 ; CHECK: RET_ReallyLR implicit $x0 201 %0(s64) = COPY $x0 202 %1(s1) = G_TRUNC %0 203 %2(s1) = COPY %1 204 %4:_(s1) = COPY %2 205 %3(s64) = G_ANYEXT %4 206 $x0 = COPY %3 207 RET_ReallyLR implicit $x0 208 209... 210