47 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=aarch64 < %s | FileCheck %s3 4; This test is reduced fom https://github.com/android/ndk/issues/1207 for an5; issue with the following DAGCobmine operation:6; truncate(build_vector(x,y)) -> build_vector(truncate(x),truncate(y))7; The combine should avoid creating illegal types if types have already been8; legalized.9 10define void @no_combine(i32 %p) local_unnamed_addr {11; CHECK-LABEL: no_combine:12; CHECK: // %bb.0:13; CHECK-NEXT: movi v0.4h, #414; CHECK-NEXT: dup v1.4h, w015; CHECK-NEXT: mov v1.d[1], v0.d[0]16; CHECK-NEXT: uzp1 v0.16b, v1.16b, v1.16b17; CHECK-NEXT: str q0, [x8]18; CHECK-NEXT: ret19 20; The two shufflevector operations are needed to force the DAGCombine to happen21; after type legalization and before operation legalization. Removing either22; makes the combine to happen before type legalization and the issue no longer23; repros.24 %1 = insertelement <16 x i32> undef, i32 %p, i32 025 %2 = shufflevector <16 x i32> %1, <16 x i32> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 undef, i32 undef, i32 undef, i32 undef, i32 0, i32 0, i32 0, i32 0, i32 undef, i32 undef, i32 undef, i32 undef>26 %3 = shufflevector <16 x i32> %2, <16 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 4, i32 4, i32 4, i32 4, i32 undef, i32 undef, i32 undef, i32 undef, i32 4, i32 4, i32 4, i32 4>, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 20, i32 21, i32 22, i32 23, i32 8, i32 9, i32 10, i32 11, i32 28, i32 29, i32 30, i32 31>27 %4 = trunc <16 x i32> %3 to <16 x i8>28 %5 = bitcast ptr undef to ptr29 store <16 x i8> %4, ptr %5, align 130 ret void31}32 33; Test case to ensure that the combine is done before type legalization.34define void @do_combine(i32 %p) local_unnamed_addr {35; CHECK-LABEL: do_combine:36; CHECK: // %bb.0:37; CHECK-NEXT: dup v0.16b, w038; CHECK-NEXT: str q0, [x8]39; CHECK-NEXT: ret40 %1 = insertelement <16 x i32> undef, i32 %p, i32 041 %2 = shufflevector <16 x i32> %1, <16 x i32> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 undef, i32 undef, i32 undef, i32 undef, i32 0, i32 0, i32 0, i32 0, i32 undef, i32 undef, i32 undef, i32 undef>42 %3 = trunc <16 x i32> %2 to <16 x i8>43 %4 = bitcast ptr undef to ptr44 store <16 x i8> %3, ptr %4, align 145 ret void46}47