1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=slp-vectorizer -S -mcpu=corei7-avx | FileCheck %s --check-prefixes=ANY,AVX
3 ; RUN: opt < %s -passes=slp-vectorizer -slp-max-reg-size=128 -S -mcpu=corei7-avx | FileCheck %s --check-prefixes=ANY,MAX128
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 define void @store_chains(ptr %x) {
9 ; AVX-LABEL: @store_chains(
10 ; AVX-NEXT: [[TMP2:%.*]] = load <4 x double>, ptr [[X:%.*]], align 8
11 ; AVX-NEXT: [[TMP3:%.*]] = fadd <4 x double> [[TMP2]], [[TMP2]]
12 ; AVX-NEXT: [[TMP4:%.*]] = fadd <4 x double> [[TMP3]], [[TMP2]]
13 ; AVX-NEXT: store <4 x double> [[TMP4]], ptr [[X]], align 8
16 ; MAX128-LABEL: @store_chains(
17 ; MAX128-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr [[X:%.*]], align 8
18 ; MAX128-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP2]], [[TMP2]]
19 ; MAX128-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[TMP3]], [[TMP2]]
20 ; MAX128-NEXT: store <2 x double> [[TMP4]], ptr [[X]], align 8
21 ; MAX128-NEXT: [[TMP6:%.*]] = getelementptr inbounds double, ptr [[X]], i64 2
22 ; MAX128-NEXT: [[TMP8:%.*]] = load <2 x double>, ptr [[TMP6]], align 8
23 ; MAX128-NEXT: [[TMP9:%.*]] = fadd <2 x double> [[TMP8]], [[TMP8]]
24 ; MAX128-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[TMP9]], [[TMP8]]
25 ; MAX128-NEXT: store <2 x double> [[TMP10]], ptr [[TMP6]], align 8
26 ; MAX128-NEXT: ret void
28 %1 = load double, ptr %x, align 8
29 %2 = fadd double %1, %1
30 %3 = fadd double %2, %1
31 store double %3, ptr %x, align 8
32 %4 = getelementptr inbounds double, ptr %x, i64 1
33 %5 = load double, ptr %4, align 8
34 %6 = fadd double %5, %5
35 %7 = fadd double %6, %5
36 store double %7, ptr %4, align 8
37 %8 = getelementptr inbounds double, ptr %x, i64 2
38 %9 = load double, ptr %8, align 8
39 %10 = fadd double %9, %9
40 %11 = fadd double %10, %9
41 store double %11, ptr %8, align 8
42 %12 = getelementptr inbounds double, ptr %x, i64 3
43 %13 = load double, ptr %12, align 8
44 %14 = fadd double %13, %13
45 %15 = fadd double %14, %13
46 store double %15, ptr %12, align 8
50 define void @store_chains_prefer_width_attr(ptr %x) #0 {
51 ; ANY-LABEL: @store_chains_prefer_width_attr(
52 ; ANY-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr [[X:%.*]], align 8
53 ; ANY-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP2]], [[TMP2]]
54 ; ANY-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[TMP3]], [[TMP2]]
55 ; ANY-NEXT: store <2 x double> [[TMP4]], ptr [[X]], align 8
56 ; ANY-NEXT: [[TMP6:%.*]] = getelementptr inbounds double, ptr [[X]], i64 2
57 ; ANY-NEXT: [[TMP8:%.*]] = load <2 x double>, ptr [[TMP6]], align 8
58 ; ANY-NEXT: [[TMP9:%.*]] = fadd <2 x double> [[TMP8]], [[TMP8]]
59 ; ANY-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[TMP9]], [[TMP8]]
60 ; ANY-NEXT: store <2 x double> [[TMP10]], ptr [[TMP6]], align 8
63 %1 = load double, ptr %x, align 8
64 %2 = fadd double %1, %1
65 %3 = fadd double %2, %1
66 store double %3, ptr %x, align 8
67 %4 = getelementptr inbounds double, ptr %x, i64 1
68 %5 = load double, ptr %4, align 8
69 %6 = fadd double %5, %5
70 %7 = fadd double %6, %5
71 store double %7, ptr %4, align 8
72 %8 = getelementptr inbounds double, ptr %x, i64 2
73 %9 = load double, ptr %8, align 8
74 %10 = fadd double %9, %9
75 %11 = fadd double %10, %9
76 store double %11, ptr %8, align 8
77 %12 = getelementptr inbounds double, ptr %x, i64 3
78 %13 = load double, ptr %12, align 8
79 %14 = fadd double %13, %13
80 %15 = fadd double %14, %13
81 store double %15, ptr %12, align 8
85 attributes #0 = { "prefer-vector-width"="128" }