244 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -o - -mtriple=aarch64-unknown-unknown -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s --check-prefixes=CHECK,CHECK-PRE3# RUN: llc -o - -mtriple=aarch64-unknown-unknown -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs %s | FileCheck %s --check-prefixes=CHECK,CHECK-POST4 5---6name: test_combine_trunc_select7legalized: true8body: |9 bb.1:10 ; CHECK-PRE-LABEL: name: test_combine_trunc_select11 ; CHECK-PRE: %cond:_(s32) = COPY $w012 ; CHECK-PRE-NEXT: %lhs:_(s64) = COPY $x013 ; CHECK-PRE-NEXT: %rhs:_(s64) = COPY $x014 ; CHECK-PRE-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC %lhs(s64)15 ; CHECK-PRE-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC %rhs(s64)16 ; CHECK-PRE-NEXT: %small:_(s32) = G_SELECT %cond(s32), [[TRUNC]], [[TRUNC1]]17 ; CHECK-PRE-NEXT: $w0 = COPY %small(s32)18 ;19 ; CHECK-POST-LABEL: name: test_combine_trunc_select20 ; CHECK-POST: %cond:_(s32) = COPY $w021 ; CHECK-POST-NEXT: %lhs:_(s64) = COPY $x022 ; CHECK-POST-NEXT: %rhs:_(s64) = COPY $x023 ; CHECK-POST-NEXT: %res:_(s64) = G_SELECT %cond(s32), %lhs, %rhs24 ; CHECK-POST-NEXT: %small:_(s32) = G_TRUNC %res(s64)25 ; CHECK-POST-NEXT: $w0 = COPY %small(s32)26 %cond:_(s32) = COPY $w027 %lhs:_(s64) = COPY $x028 %rhs:_(s64) = COPY $x029 %res:_(s64) = G_SELECT %cond(s32), %lhs, %rhs30 %small:_(s32) = G_TRUNC %res(s64)31 $w0 = COPY %small(s32)32...33---34name: test_combine_zext_select35legalized: true36body: |37 bb.1:38 ; CHECK-PRE-LABEL: name: test_combine_zext_select39 ; CHECK-PRE: %cond:_(s32) = COPY $w040 ; CHECK-PRE-NEXT: %lhs:_(s32) = COPY $w041 ; CHECK-PRE-NEXT: %rhs:_(s32) = COPY $w042 ; CHECK-PRE-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT %lhs(s32)43 ; CHECK-PRE-NEXT: [[ZEXT1:%[0-9]+]]:_(s64) = G_ZEXT %rhs(s32)44 ; CHECK-PRE-NEXT: %big:_(s64) = G_SELECT %cond(s32), [[ZEXT]], [[ZEXT1]]45 ; CHECK-PRE-NEXT: $x0 = COPY %big(s64)46 ;47 ; CHECK-POST-LABEL: name: test_combine_zext_select48 ; CHECK-POST: %cond:_(s32) = COPY $w049 ; CHECK-POST-NEXT: %lhs:_(s32) = COPY $w050 ; CHECK-POST-NEXT: %rhs:_(s32) = COPY $w051 ; CHECK-POST-NEXT: %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs52 ; CHECK-POST-NEXT: %big:_(s64) = G_ZEXT %res(s32)53 ; CHECK-POST-NEXT: $x0 = COPY %big(s64)54 %cond:_(s32) = COPY $w055 %lhs:_(s32) = COPY $w056 %rhs:_(s32) = COPY $w057 %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs58 %big:_(s64) = G_ZEXT %res(s32)59 $x0 = COPY %big(s64)60...61---62name: test_combine_anyzext_select63legalized: true64body: |65 bb.1:66 ; CHECK-PRE-LABEL: name: test_combine_anyzext_select67 ; CHECK-PRE: %cond:_(s32) = COPY $w068 ; CHECK-PRE-NEXT: %lhs:_(s32) = COPY $w069 ; CHECK-PRE-NEXT: %rhs:_(s32) = COPY $w070 ; CHECK-PRE-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT %lhs(s32)71 ; CHECK-PRE-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT %rhs(s32)72 ; CHECK-PRE-NEXT: %big:_(s64) = G_SELECT %cond(s32), [[ANYEXT]], [[ANYEXT1]]73 ; CHECK-PRE-NEXT: $x0 = COPY %big(s64)74 ;75 ; CHECK-POST-LABEL: name: test_combine_anyzext_select76 ; CHECK-POST: %cond:_(s32) = COPY $w077 ; CHECK-POST-NEXT: %lhs:_(s32) = COPY $w078 ; CHECK-POST-NEXT: %rhs:_(s32) = COPY $w079 ; CHECK-POST-NEXT: %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs80 ; CHECK-POST-NEXT: %big:_(s64) = G_ANYEXT %res(s32)81 ; CHECK-POST-NEXT: $x0 = COPY %big(s64)82 %cond:_(s32) = COPY $w083 %lhs:_(s32) = COPY $w084 %rhs:_(s32) = COPY $w085 %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs86 %big:_(s64) = G_ANYEXT %res(s32)87 $x0 = COPY %big(s64)88...89---90name: test_combine_anyzext_select_multi_use91legalized: true92body: |93 bb.1:94 ; CHECK-LABEL: name: test_combine_anyzext_select_multi_use95 ; CHECK: %cond:_(s32) = COPY $w096 ; CHECK-NEXT: %lhs:_(s32) = COPY $w097 ; CHECK-NEXT: %rhs:_(s32) = COPY $w098 ; CHECK-NEXT: %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs99 ; CHECK-NEXT: %big:_(s64) = G_ANYEXT %res(s32)100 ; CHECK-NEXT: $x0 = COPY %big(s64)101 ; CHECK-NEXT: $w0 = COPY %res(s32)102 %cond:_(s32) = COPY $w0103 %lhs:_(s32) = COPY $w0104 %rhs:_(s32) = COPY $w0105 %res:_(s32) = G_SELECT %cond(s32), %lhs, %rhs106 %big:_(s64) = G_ANYEXT %res(s32)107 $x0 = COPY %big(s64)108 $w0 = COPY %res(s32)109...110---111name: test_combine_trunc_select_vector_out_of_budget112legalized: true113body: |114 bb.1:115 ; CHECK-LABEL: name: test_combine_trunc_select_vector_out_of_budget116 ; CHECK: %cond:_(<2 x s32>) = COPY $x0117 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0118 ; CHECK-NEXT: %arg2:_(s64) = COPY $x0119 ; CHECK-NEXT: %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)120 ; CHECK-NEXT: %bv2:_(<2 x s64>) = G_BUILD_VECTOR %arg2(s64), %arg1(s64)121 ; CHECK-NEXT: %res:_(<2 x s64>) = G_SELECT %cond(<2 x s32>), %bv, %bv2122 ; CHECK-NEXT: %small:_(<2 x s32>) = G_TRUNC %res(<2 x s64>)123 ; CHECK-NEXT: $x0 = COPY %small(<2 x s32>)124 %cond:_(<2 x s32>) = COPY $x0125 %arg1:_(s64) = COPY $x0126 %arg2:_(s64) = COPY $x0127 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)128 %bv2:_(<2 x s64>) = G_BUILD_VECTOR %arg2(s64), %arg1(s64)129 %res:_(<2 x s64>) = G_SELECT %cond(<2 x s32>), %bv, %bv2130 %small:_(<2 x s32>) = G_TRUNC %res(<2 x s64>)131 $x0 = COPY %small(<2 x s32>)132...133---134name: test_combine_trunc_build_vector135legalized: true136body: |137 bb.1:138 ; CHECK-LABEL: name: test_combine_trunc_build_vector139 ; CHECK: %arg1:_(s64) = COPY $x0140 ; CHECK-NEXT: %arg2:_(s64) = COPY $x0141 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC %arg1(s64)142 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC %arg2(s64)143 ; CHECK-NEXT: %small:_(<2 x s32>) = G_BUILD_VECTOR [[TRUNC]](s32), [[TRUNC1]](s32)144 ; CHECK-NEXT: $x0 = COPY %small(<2 x s32>)145 %arg1:_(s64) = COPY $x0146 %arg2:_(s64) = COPY $x0147 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64)148 %small:_(<2 x s32>) = G_TRUNC %bv(<2 x s64>)149 $x0 = COPY %small(<2 x s32>)150...151---152name: test_combine_zext_build_vector153legalized: true154body: |155 bb.1:156 ; CHECK-LABEL: name: test_combine_zext_build_vector157 ; CHECK: %arg1:_(s32) = COPY $w0158 ; CHECK-NEXT: %arg2:_(s32) = COPY $w0159 ; CHECK-NEXT: %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)160 ; CHECK-NEXT: %large:_(<2 x s64>) = G_ZEXT %bv(<2 x s32>)161 ; CHECK-NEXT: $q0 = COPY %large(<2 x s64>)162 %arg1:_(s32) = COPY $w0163 %arg2:_(s32) = COPY $w0164 %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)165 %large:_(<2 x s64>) = G_ZEXT %bv(<2 x s32>)166 $q0 = COPY %large(<2 x s64>)167...168---169name: test_combine_anyext_build_vector170legalized: true171body: |172 bb.1:173 ; CHECK-LABEL: name: test_combine_anyext_build_vector174 ; CHECK: %arg1:_(s32) = COPY $w0175 ; CHECK-NEXT: %arg2:_(s32) = COPY $w0176 ; CHECK-NEXT: %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)177 ; CHECK-NEXT: %large:_(<2 x s64>) = G_ANYEXT %bv(<2 x s32>)178 ; CHECK-NEXT: $q0 = COPY %large(<2 x s64>)179 %arg1:_(s32) = COPY $w0180 %arg2:_(s32) = COPY $w0181 %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)182 %large:_(<2 x s64>) = G_ANYEXT %bv(<2 x s32>)183 $q0 = COPY %large(<2 x s64>)184...185---186name: test_combine_sext_build_vector187legalized: true188body: |189 bb.1:190 ; CHECK-LABEL: name: test_combine_sext_build_vector191 ; CHECK: %arg1:_(s32) = COPY $w0192 ; CHECK-NEXT: %arg2:_(s32) = COPY $w0193 ; CHECK-NEXT: %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)194 ; CHECK-NEXT: %large:_(<2 x s64>) = G_SEXT %bv(<2 x s32>)195 ; CHECK-NEXT: $q0 = COPY %large(<2 x s64>)196 %arg1:_(s32) = COPY $w0197 %arg2:_(s32) = COPY $w0198 %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)199 %large:_(<2 x s64>) = G_SEXT %bv(<2 x s32>)200 $q0 = COPY %large(<2 x s64>)201...202---203name: test_combine_anyext_build_vector_multi_use204legalized: true205body: |206 bb.1:207 ; CHECK-LABEL: name: test_combine_anyext_build_vector_multi_use208 ; CHECK: %arg1:_(s32) = COPY $w0209 ; CHECK-NEXT: %arg2:_(s32) = COPY $w0210 ; CHECK-NEXT: %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)211 ; CHECK-NEXT: %large:_(<2 x s64>) = G_ANYEXT %bv(<2 x s32>)212 ; CHECK-NEXT: $q0 = COPY %large(<2 x s64>)213 ; CHECK-NEXT: $d0 = COPY %bv(<2 x s32>)214 %arg1:_(s32) = COPY $w0215 %arg2:_(s32) = COPY $w0216 %bv:_(<2 x s32>) = G_BUILD_VECTOR %arg1(s32), %arg2(s32)217 %large:_(<2 x s64>) = G_ANYEXT %bv(<2 x s32>)218 $q0 = COPY %large(<2 x s64>)219 $d0 = COPY %bv(<2 x s32>)220...221---222name: test_undef_ptrtoint223legalized: true224body: |225 bb.1:226 ; CHECK-LABEL: name: test_undef_ptrtoint227 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s64>) = G_IMPLICIT_DEF228 ; CHECK-NEXT: $q0 = COPY [[DEF]](<2 x s64>)229 %0:_(<2 x p0>) = G_IMPLICIT_DEF230 %1:_(<2 x s64>) = G_PTRTOINT %0(<2 x p0>)231 $q0 = COPY %1(<2 x s64>)232...233---234name: test_undef_inttoptr235legalized: true236body: |237 bb.1:238 ; CHECK-LABEL: name: test_undef_inttoptr239 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x p0>) = G_IMPLICIT_DEF240 ; CHECK-NEXT: $q0 = COPY [[DEF]](<2 x p0>)241 %0:_(<2 x s64>) = G_IMPLICIT_DEF242 %1:_(<2 x p0>) = G_INTTOPTR %0(<2 x s64>)243 $q0 = COPY %1(<2 x p0>)244