• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1target 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"
2; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
3; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3 -bb-vectorize-no-bools -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s -check-prefix=CHECK-NB
4
5; Basic depth-3 chain with select
6define double @test1(double %A1, double %A2, double %B1, double %B2, i1 %C1, i1 %C2) {
7; CHECK-LABEL: @test1(
8; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
9; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
10; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
11; CHECK: %X1.v.i0.2 = insertelement <2 x double> %X1.v.i0.1, double %A2, i32 1
12	%X1 = fsub double %A1, %B1
13	%X2 = fsub double %A2, %B2
14; CHECK: %X1 = fsub <2 x double> %X1.v.i0.2, %X1.v.i1.2
15	%Y1 = fmul double %X1, %A1
16	%Y2 = fmul double %X2, %A2
17; CHECK: %Y1 = fmul <2 x double> %X1, %X1.v.i0.2
18        %Z1 = select i1 %C1, double %Y1, double %B1
19        %Z2 = select i1 %C2, double %Y2, double %B2
20; CHECK: %Z1.v.i0.1 = insertelement <2 x i1> undef, i1 %C1, i32 0
21; CHECK: %Z1.v.i0.2 = insertelement <2 x i1> %Z1.v.i0.1, i1 %C2, i32 1
22; CHECK: %Z1 = select <2 x i1> %Z1.v.i0.2, <2 x double> %Y1, <2 x double> %X1.v.i1.2
23	%R  = fmul double %Z1, %Z2
24; CHECK: %Z1.v.r1 = extractelement <2 x double> %Z1, i32 0
25; CHECK: %Z1.v.r2 = extractelement <2 x double> %Z1, i32 1
26; CHECK: %R = fmul double %Z1.v.r1, %Z1.v.r2
27	ret double %R
28; CHECK: ret double %R
29}
30
31; Basic depth-3 chain with select (and vect. compare)
32define double @test2(double %A1, double %A2, double %B1, double %B2) {
33; CHECK-LABEL: @test2(
34; CHECK-NB-LABEL: @test2(
35; CHECK: %X1.v.i1.1 = insertelement <2 x double> undef, double %B1, i32 0
36; CHECK: %X1.v.i1.2 = insertelement <2 x double> %X1.v.i1.1, double %B2, i32 1
37; CHECK: %X1.v.i0.1 = insertelement <2 x double> undef, double %A1, i32 0
38; CHECK: %X1.v.i0.2 = insertelement <2 x double> %X1.v.i0.1, double %A2, i32 1
39	%X1 = fsub double %A1, %B1
40	%X2 = fsub double %A2, %B2
41; CHECK: %X1 = fsub <2 x double> %X1.v.i0.2, %X1.v.i1.2
42	%Y1 = fmul double %X1, %A1
43	%Y2 = fmul double %X2, %A2
44; CHECK: %Y1 = fmul <2 x double> %X1, %X1.v.i0.2
45	%C1 = fcmp ogt double %X1, %A1
46        %C2 = fcmp ogt double %X2, %A2
47; CHECK: %C1 = fcmp ogt <2 x double> %X1, %X1.v.i0.2
48; CHECK-NB: fcmp ogt double
49        %Z1 = select i1 %C1, double %Y1, double %B1
50        %Z2 = select i1 %C2, double %Y2, double %B2
51; CHECK: %Z1 = select <2 x i1> %C1, <2 x double> %Y1, <2 x double> %X1.v.i1.2
52	%R  = fmul double %Z1, %Z2
53; CHECK: %Z1.v.r1 = extractelement <2 x double> %Z1, i32 0
54; CHECK: %Z1.v.r2 = extractelement <2 x double> %Z1, i32 1
55; CHECK: %R = fmul double %Z1.v.r1, %Z1.v.r2
56	ret double %R
57; CHECK: ret double %R
58}
59
60