llvm.org GIT mirror llvm / f9c9604
[SLP] Lit test that cannot get vectorized due to lack of look-ahead operand reordering heuristic. The code in this test is not vectorized by SLP because its operand reordering cannot look beyond the immediate predecessors. This will get fixed in a follow-up patch that introduces the look-ahead operand reordering heuristic. Committed on behalf of @vporpo (Vasileios Porpodas) Differential Revision: https://reviews.llvm.org/D61283 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359553 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Pilgrim 4 months ago
1 changed file(s) with 74 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt -slp-vectorizer -S < %s -mtriple=x86_64-unknown-linux -mcpu=corei7-avx | FileCheck %s
2 ;
3 ; This checks the look-ahead operand reordering heuristic
4 ;
5 ; A[0] B[0] C[0] D[0] C[1] D[1] A[1] B[1]
6 ; \ / \ / \ / \ /
7 ; - - - -
8 ; \ / \ /
9 ; + +
10 ; | |
11 ; S[0] S[1]
12 ;
13 define void @test(double* %array) {
14 ; CHECK-LABEL: @test(
15 ; CHECK-NEXT: entry:
16 ; CHECK-NEXT: [[IDX0:%.*]] = getelementptr inbounds double, double* [[ARRAY:%.*]], i64 0
17 ; CHECK-NEXT: [[IDX1:%.*]] = getelementptr inbounds double, double* [[ARRAY]], i64 1
18 ; CHECK-NEXT: [[IDX2:%.*]] = getelementptr inbounds double, double* [[ARRAY]], i64 2
19 ; CHECK-NEXT: [[IDX3:%.*]] = getelementptr inbounds double, double* [[ARRAY]], i64 3
20 ; CHECK-NEXT: [[IDX4:%.*]] = getelementptr inbounds double, double* [[ARRAY]], i64 4
21 ; CHECK-NEXT: [[IDX5:%.*]] = getelementptr inbounds double, double* [[ARRAY]], i64 5
22 ; CHECK-NEXT: [[IDX6:%.*]] = getelementptr inbounds double, double* [[ARRAY]], i64 6
23 ; CHECK-NEXT: [[IDX7:%.*]] = getelementptr inbounds double, double* [[ARRAY]], i64 7
24 ; CHECK-NEXT: [[A_0:%.*]] = load double, double* [[IDX0]], align 8
25 ; CHECK-NEXT: [[A_1:%.*]] = load double, double* [[IDX1]], align 8
26 ; CHECK-NEXT: [[B_0:%.*]] = load double, double* [[IDX2]], align 8
27 ; CHECK-NEXT: [[B_1:%.*]] = load double, double* [[IDX3]], align 8
28 ; CHECK-NEXT: [[C_0:%.*]] = load double, double* [[IDX4]], align 8
29 ; CHECK-NEXT: [[C_1:%.*]] = load double, double* [[IDX5]], align 8
30 ; CHECK-NEXT: [[D_0:%.*]] = load double, double* [[IDX6]], align 8
31 ; CHECK-NEXT: [[D_1:%.*]] = load double, double* [[IDX7]], align 8
32 ; CHECK-NEXT: [[SUBAB_0:%.*]] = fsub fast double [[A_0]], [[B_0]]
33 ; CHECK-NEXT: [[SUBCD_0:%.*]] = fsub fast double [[C_0]], [[D_0]]
34 ; CHECK-NEXT: [[SUBAB_1:%.*]] = fsub fast double [[A_1]], [[B_1]]
35 ; CHECK-NEXT: [[SUBCD_1:%.*]] = fsub fast double [[C_1]], [[D_1]]
36 ; CHECK-NEXT: [[ADDABCD_0:%.*]] = fadd fast double [[SUBAB_0]], [[SUBCD_0]]
37 ; CHECK-NEXT: [[ADDCDAB_1:%.*]] = fadd fast double [[SUBCD_1]], [[SUBAB_1]]
38 ; CHECK-NEXT: store double [[ADDABCD_0]], double* [[IDX0]], align 8
39 ; CHECK-NEXT: store double [[ADDCDAB_1]], double* [[IDX1]], align 8
40 ; CHECK-NEXT: ret void
41 ;
42 entry:
43 %idx0 = getelementptr inbounds double, double* %array, i64 0
44 %idx1 = getelementptr inbounds double, double* %array, i64 1
45 %idx2 = getelementptr inbounds double, double* %array, i64 2
46 %idx3 = getelementptr inbounds double, double* %array, i64 3
47 %idx4 = getelementptr inbounds double, double* %array, i64 4
48 %idx5 = getelementptr inbounds double, double* %array, i64 5
49 %idx6 = getelementptr inbounds double, double* %array, i64 6
50 %idx7 = getelementptr inbounds double, double* %array, i64 7
51
52 %A_0 = load double, double *%idx0, align 8
53 %A_1 = load double, double *%idx1, align 8
54 %B_0 = load double, double *%idx2, align 8
55 %B_1 = load double, double *%idx3, align 8
56 %C_0 = load double, double *%idx4, align 8
57 %C_1 = load double, double *%idx5, align 8
58 %D_0 = load double, double *%idx6, align 8
59 %D_1 = load double, double *%idx7, align 8
60
61 %subAB_0 = fsub fast double %A_0, %B_0
62 %subCD_0 = fsub fast double %C_0, %D_0
63
64 %subAB_1 = fsub fast double %A_1, %B_1
65 %subCD_1 = fsub fast double %C_1, %D_1
66
67 %addABCD_0 = fadd fast double %subAB_0, %subCD_0
68 %addCDAB_1 = fadd fast double %subCD_1, %subAB_1
69
70 store double %addABCD_0, double *%idx0, align 8
71 store double %addCDAB_1, double *%idx1, align 8
72 ret void
73 }