From 64e1b28643d87e70734deb5f3d2d298e859c2fd2 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Thu, 28 Jun 2012 05:42:42 +0000 Subject: Allow BBVectorize to form non-2^n-length vectors. The original algorithm only used recursive pair fusion of equal-length types. This is now extended to allow pairing of any types that share the same underlying scalar type. Because we would still generally prefer the 2^n-length types, those are formed first. Then a second set of iterations form the non-2^n-length types. Also, a call to SimplifyInstructionsInBlock has been added after each pairing iteration. This takes care of DCE (and a few other things) that make the following iterations execute somewhat faster. For the same reason, some of the simple shuffle-combination cases are now handled internally. There is some additional refactoring work to be done, but I've had many requests for this feature, so additional refactoring will come soon in future commits (as will additional test cases). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159330 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/BBVectorize/simple.ll | 3 +-- test/Transforms/BBVectorize/simple3.ll | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 test/Transforms/BBVectorize/simple3.ll (limited to 'test') diff --git a/test/Transforms/BBVectorize/simple.ll b/test/Transforms/BBVectorize/simple.ll index 904d766..88eb9c9 100644 --- a/test/Transforms/BBVectorize/simple.ll +++ b/test/Transforms/BBVectorize/simple.ll @@ -138,8 +138,7 @@ define <8 x i8> @test6(<8 x i8> %A1, <8 x i8> %A2, <8 x i8> %B1, <8 x i8> %B2) { ; CHECK: %Z1 = add <16 x i8> %Y1, %X1.v.i1 %Q1 = shufflevector <8 x i8> %Z1, <8 x i8> %Z2, <8 x i32> %Q2 = shufflevector <8 x i8> %Z2, <8 x i8> %Z2, <8 x i32> -; CHECK: %Z1.v.r2 = shufflevector <16 x i8> %Z1, <16 x i8> undef, <8 x i32> -; CHECK: %Q1.v.i1 = shufflevector <8 x i8> %Z1.v.r2, <8 x i8> undef, <16 x i32> +; CHECK: %Q1.v.i1 = shufflevector <16 x i8> %Z1, <16 x i8> undef, <16 x i32> ; CHECK: %Q1 = shufflevector <16 x i8> %Z1, <16 x i8> %Q1.v.i1, <16 x i32> %R = mul <8 x i8> %Q1, %Q2 ; CHECK: %Q1.v.r1 = shufflevector <16 x i8> %Q1, <16 x i8> undef, <8 x i32> diff --git a/test/Transforms/BBVectorize/simple3.ll b/test/Transforms/BBVectorize/simple3.ll new file mode 100644 index 0000000..153be73 --- /dev/null +++ b/test/Transforms/BBVectorize/simple3.ll @@ -0,0 +1,35 @@ +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -bb-vectorize-vector-bits=192 -instcombine -gvn -S | FileCheck %s + +; Basic depth-3 chain +define double @test1(double %A1, double %A2, double %A3, double %B1, double %B2, double %B3) { +; CHECK: @test1 +; CHECK: %X1.v.i1.11 = insertelement <3 x double> undef, double %B1, i32 0 +; CHECK: %X1.v.i1.22 = insertelement <3 x double> %X1.v.i1.11, double %B2, i32 1 +; CHECK: %X1.v.i1 = insertelement <3 x double> %X1.v.i1.22, double %B3, i32 2 +; CHECK: %X1.v.i0.13 = insertelement <3 x double> undef, double %A1, i32 0 +; CHECK: %X1.v.i0.24 = insertelement <3 x double> %X1.v.i0.13, double %A2, i32 1 +; CHECK: %X1.v.i0 = insertelement <3 x double> %X1.v.i0.24, double %A3, i32 2 + %X1 = fsub double %A1, %B1 + %X2 = fsub double %A2, %B2 + %X3 = fsub double %A3, %B3 +; CHECK: %X1 = fsub <3 x double> %X1.v.i0, %X1.v.i1 + %Y1 = fmul double %X1, %A1 + %Y2 = fmul double %X2, %A2 + %Y3 = fmul double %X3, %A3 +; CHECK: %Y1 = fmul <3 x double> %X1, %X1.v.i0 + %Z1 = fadd double %Y1, %B1 + %Z2 = fadd double %Y2, %B2 + %Z3 = fadd double %Y3, %B3 +; CHECK: %Z1 = fadd <3 x double> %Y1, %X1.v.i1 + %R1 = fmul double %Z1, %Z2 + %R = fmul double %R1, %Z3 +; CHECK: %Z1.v.r210 = extractelement <3 x double> %Z1, i32 2 +; CHECK: %Z1.v.r1 = extractelement <3 x double> %Z1, i32 0 +; CHECK: %Z1.v.r2 = extractelement <3 x double> %Z1, i32 1 +; CHECK: %R1 = fmul double %Z1.v.r1, %Z1.v.r2 +; CHECK: %R = fmul double %R1, %Z1.v.r210 + ret double %R +; CHECK: ret double %R +} + -- cgit v1.1