From 83fd8feb00b1d77c756894a0bdd0bfcc2001007c Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Fri, 29 Jul 2016 17:55:37 +0000 Subject: [PATCH] [Hexagon] Testcase for not merging stores into a misaligned store The DAG combiner will try to merge consecutive stores into a bigger store, unless the resulting store is not fast. Misaligned vector stores are allowed on Hexagon, but are not fast. Add a testcase to make sure this type of merging does not occur. Patch by Pranav Bhandarkar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277182 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../misaligned_double_vector_store_not_fast.ll | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll diff --git a/test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll b/test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll new file mode 100644 index 00000000000..451feef8a36 --- /dev/null +++ b/test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll @@ -0,0 +1,46 @@ +; RUN: llc -march=hexagon -O3 -debug-only=isel 2>&1 < %s | FileCheck %s + +; DAGCombiner converts the two vector stores to a double vector store, +; even if the double vector store is unaligned. This is not good. If it +; is unaligned, we should let the DAGCombiner know that it is slow via +; the allowsMisalignedAccess function in HexagonISelLowering. + +; CHECK-NOT: store + +target triple = "hexagon-unknown--elf" + +; Function Attrs: nounwind +define void @__processed() #0 { +entry: + br label %"for demosaiced.s0.y.y" + +"for demosaiced.s0.y.y": ; preds = %"for demosaiced.s0.y.y", %entry + %demosaiced.s0.y.y = phi i32 [ 0, %entry ], [ %0, %"for demosaiced.s0.y.y" ] + %0 = add nuw nsw i32 %demosaiced.s0.y.y, 1 + %1 = mul nuw nsw i32 %demosaiced.s0.y.y, 256 + %2 = tail call <64 x i32> @llvm.hexagon.V6.vshuffvdd.128B(<32 x i32> undef, <32 x i32> undef, i32 -2) + %3 = bitcast <64 x i32> %2 to <128 x i16> + %4 = shufflevector <128 x i16> %3, <128 x i16> undef, <64 x i32> + %5 = add nuw nsw i32 %1, 32896 + %6 = getelementptr inbounds i16, i16* undef, i32 %5 + %7 = bitcast i16* %6 to <64 x i16>* + store <64 x i16> %4, <64 x i16>* %7, align 128 + %8 = shufflevector <128 x i16> %3, <128 x i16> undef, <64 x i32> + %9 = add nuw nsw i32 %1, 32960 + %10 = getelementptr inbounds i16, i16* undef, i32 %9 + %11 = bitcast i16* %10 to <64 x i16>* + store <64 x i16> %8, <64 x i16>* %11, align 128 + br i1 false, label %"consume demosaiced", label %"for demosaiced.s0.y.y" + +"consume demosaiced": ; preds = %"for demosaiced.s0.y.y" + unreachable + +"consume processed": ; preds = %"produce processed" + ret void +} + +declare <64 x i32> @llvm.hexagon.V6.vshuffvdd.128B(<32 x i32>, <32 x i32>, i32) #1 + +attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-double" } +attributes #1 = { nounwind readnone "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-double" } + -- 2.11.0