From: Alexey Bataev Date: Tue, 22 Feb 2022 21:46:02 +0000 (-0800) Subject: [SLP][NFC]Add a test for bottom to top reordering. X-Git-Tag: upstream/15.0.7~15639 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3f4535a039918965adb21509700739afc25f9f1;p=platform%2Fupstream%2Fllvm.git [SLP][NFC]Add a test for bottom to top reordering. --- diff --git a/llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll b/llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll new file mode 100644 index 0000000..2ac4b7d --- /dev/null +++ b/llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll @@ -0,0 +1,98 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mattr=+avx < %s | FileCheck %s + +define void @test(i32* %0, i32* %1, i32* %2) { +; CHECK-LABEL: @test( +; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* [[TMP0:%.*]], i64 4 +; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, i32* [[TMP1:%.*]], i64 1 +; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 1 +; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 5 +; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i64 2 +; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 2 +; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 6 +; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i32, i32* [[TMP1]], i64 3 +; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 3 +; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 7 +; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i32, i32* [[TMP2:%.*]], i64 2 +; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i32, i32* [[TMP2]], i64 1 +; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i32, i32* [[TMP2]], i64 3 +; CHECK-NEXT: [[TMP17:%.*]] = bitcast i32* [[TMP1]] to <4 x i32>* +; CHECK-NEXT: [[TMP18:%.*]] = load <4 x i32>, <4 x i32>* [[TMP17]], align 4 +; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <4 x i32> [[TMP18]], <4 x i32> poison, <4 x i32> +; CHECK-NEXT: [[TMP19:%.*]] = bitcast i32* [[TMP0]] to <4 x i32>* +; CHECK-NEXT: [[TMP20:%.*]] = load <4 x i32>, <4 x i32>* [[TMP19]], align 4 +; CHECK-NEXT: [[TMP21:%.*]] = bitcast i32* [[TMP4]] to <4 x i32>* +; CHECK-NEXT: [[TMP22:%.*]] = load <4 x i32>, <4 x i32>* [[TMP21]], align 4 +; CHECK-NEXT: [[SHUFFLE1:%.*]] = shufflevector <4 x i32> [[TMP22]], <4 x i32> poison, <4 x i32> +; CHECK-NEXT: [[TMP23:%.*]] = sub <4 x i32> , [[TMP20]] +; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x i32> [[TMP23]], <4 x i32> poison, <4 x i32> +; CHECK-NEXT: [[TMP24:%.*]] = sub <4 x i32> [[SHUFFLE]], [[SHUFFLE1]] +; CHECK-NEXT: [[TMP25:%.*]] = add <4 x i32> [[TMP24]], [[SHUFFLE2]] +; CHECK-NEXT: [[TMP26:%.*]] = add <4 x i32> [[TMP25]], +; CHECK-NEXT: [[TMP27:%.*]] = sub <4 x i32> [[TMP25]], +; CHECK-NEXT: [[TMP28:%.*]] = shufflevector <4 x i32> [[TMP26]], <4 x i32> [[TMP27]], <4 x i32> +; CHECK-NEXT: [[TMP29:%.*]] = add <4 x i32> [[TMP28]], zeroinitializer +; CHECK-NEXT: [[TMP30:%.*]] = sub <4 x i32> [[TMP28]], zeroinitializer +; CHECK-NEXT: [[TMP31:%.*]] = shufflevector <4 x i32> [[TMP29]], <4 x i32> [[TMP30]], <4 x i32> +; CHECK-NEXT: [[TMP32:%.*]] = add <4 x i32> [[TMP31]], zeroinitializer +; CHECK-NEXT: [[TMP33:%.*]] = sub <4 x i32> [[TMP31]], zeroinitializer +; CHECK-NEXT: [[TMP34:%.*]] = shufflevector <4 x i32> [[TMP32]], <4 x i32> [[TMP33]], <4 x i32> +; CHECK-NEXT: [[TMP35:%.*]] = bitcast i32* [[TMP2]] to <4 x i32>* +; CHECK-NEXT: store <4 x i32> [[TMP34]], <4 x i32>* [[TMP35]], align 4 +; CHECK-NEXT: ret void +; + %4 = load i32, i32* %1, align 4 + %5 = load i32, i32* %0, align 4 + %6 = getelementptr inbounds i32, i32* %0, i64 4 + %7 = load i32, i32* %6, align 4 + %8 = getelementptr inbounds i32, i32* %1, i64 1 + %9 = load i32, i32* %8, align 4 + %10 = getelementptr inbounds i32, i32* %0, i64 1 + %11 = load i32, i32* %10, align 4 + %12 = getelementptr inbounds i32, i32* %0, i64 5 + %13 = load i32, i32* %12, align 4 + %14 = getelementptr inbounds i32, i32* %1, i64 2 + %15 = load i32, i32* %14, align 4 + %16 = getelementptr inbounds i32, i32* %0, i64 2 + %17 = load i32, i32* %16, align 4 + %18 = getelementptr inbounds i32, i32* %0, i64 6 + %19 = load i32, i32* %18, align 4 + %20 = getelementptr inbounds i32, i32* %1, i64 3 + %21 = load i32, i32* %20, align 4 + %22 = getelementptr inbounds i32, i32* %0, i64 3 + %23 = load i32, i32* %22, align 4 + %24 = getelementptr inbounds i32, i32* %0, i64 7 + %25 = load i32, i32* %24, align 4 + %26 = sub i32 0, %23 + %27 = sub i32 %26, %25 + %28 = add i32 %27, %21 + %29 = sub i32 undef, %17 + %30 = sub i32 %29, %19 + %31 = add i32 %30, %15 + %32 = sub i32 0, %11 + %33 = sub i32 %32, %13 + %34 = add i32 %33, %9 + %35 = sub i32 0, %5 + %36 = sub i32 %35, %7 + %37 = add i32 %36, %4 + %38 = add i32 %31, 1 + %39 = add i32 %38, 0 + %40 = add i32 %39, 0 + store i32 %40, i32* %2, align 4 + %41 = getelementptr inbounds i32, i32* %2, i64 2 + %42 = add i32 0, %34 + %43 = sub i32 %42, 0 + %44 = sub i32 %43, 0 + store i32 %44, i32* %41, align 4 + %45 = getelementptr inbounds i32, i32* %2, i64 1 + %46 = add i32 %37, 0 + %47 = sub i32 %46, 0 + %48 = sub i32 %47, 0 + store i32 %48, i32* %45, align 4 + %49 = getelementptr inbounds i32, i32* %2, i64 3 + %50 = sub i32 %28, 0 + %51 = sub i32 %50, 0 + %52 = add i32 %51, 0 + store i32 %52, i32* %49, align 4 + ret void +}