1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -mtriple=x86_64 -passes=slp-vectorizer -S -mcpu=skylake-avx512 | FileCheck %s
4 declare void @llvm.masked.scatter.v2f64.v2p0(<2 x double>, <2 x ptr>, i32 immarg, <2 x i1>)
6 define void @rdx_feeds_single_insert(<2 x double> %v, ptr nocapture readonly %arg, ptr nocapture readonly %arg1, ptr nocapture %arg2) {
7 ; CHECK-LABEL: @rdx_feeds_single_insert(
9 ; CHECK-NEXT: [[TMP1:%.*]] = load <8 x double>, ptr [[ARG1:%.*]], align 8
10 ; CHECK-NEXT: [[TMP2:%.*]] = fmul fast <8 x double> [[TMP1]], <double 1.000000e+01, double 1.100000e+01, double 1.200000e+01, double 1.300000e+01, double 1.400000e+01, double 1.500000e+01, double 1.600000e+01, double 1.700000e+01>
11 ; CHECK-NEXT: [[TMP3:%.*]] = call fast double @llvm.vector.reduce.fadd.v8f64(double -0.000000e+00, <8 x double> [[TMP2]])
12 ; CHECK-NEXT: [[I:%.*]] = insertelement <2 x double> [[V:%.*]], double [[TMP3]], i64 1
13 ; CHECK-NEXT: [[P:%.*]] = getelementptr inbounds double, ptr [[ARG2:%.*]], <2 x i64> <i64 0, i64 16>
14 ; CHECK-NEXT: call void @llvm.masked.scatter.v2f64.v2p0(<2 x double> [[I]], <2 x ptr> [[P]], i32 8, <2 x i1> <i1 true, i1 true>)
15 ; CHECK-NEXT: ret void
18 %ld0.0 = load double, ptr %arg1, align 8
19 %mul1.0 = fmul fast double %ld0.0, 10.0
20 %gep0.1 = getelementptr inbounds double, ptr %arg1, i64 1
21 %ld0.1 = load double, ptr %gep0.1, align 8
22 %mul1.1 = fmul fast double %ld0.1, 11.0
23 %rdx1.0 = fadd fast double %mul1.0, %mul1.1
24 %gep0.2 = getelementptr inbounds double, ptr %arg1, i64 2
25 %ld0.2 = load double, ptr %gep0.2, align 8
26 %mul1.2 = fmul fast double %ld0.2, 12.0
27 %rdx1.1 = fadd fast double %rdx1.0, %mul1.2
28 %gep0.3 = getelementptr inbounds double, ptr %arg1, i64 3
29 %ld0.3 = load double, ptr %gep0.3, align 8
30 %mul1.3 = fmul fast double %ld0.3, 13.0
31 %rdx1.2 = fadd fast double %rdx1.1, %mul1.3
32 %gep0.4 = getelementptr inbounds double, ptr %arg1, i64 4
33 %ld0.4 = load double, ptr %gep0.4, align 8
34 %mul1.4 = fmul fast double %ld0.4, 14.0
35 %rdx1.3 = fadd fast double %rdx1.2, %mul1.4
36 %gep0.5 = getelementptr inbounds double, ptr %arg1, i64 5
37 %ld0.5 = load double, ptr %gep0.5, align 8
38 %mul1.5 = fmul fast double %ld0.5, 15.0
39 %rdx1.4 = fadd fast double %rdx1.3, %mul1.5
40 %gep0.6 = getelementptr inbounds double, ptr %arg1, i64 6
41 %ld0.6 = load double, ptr %gep0.6, align 8
42 %mul1.6 = fmul fast double %ld0.6, 16.0
43 %rdx1.5 = fadd fast double %rdx1.4, %mul1.6
44 %gep0.7 = getelementptr inbounds double, ptr %arg1, i64 7
45 %ld0.7 = load double, ptr %gep0.7, align 8
46 %mul1.7 = fmul fast double %ld0.7, 17.0
47 %rdx1 = fadd fast double %rdx1.5, %mul1.7
48 %i = insertelement <2 x double> %v, double %rdx1, i64 1
49 %p = getelementptr inbounds double, ptr %arg2, <2 x i64> <i64 0, i64 16>
50 call void @llvm.masked.scatter.v2f64.v2p0(<2 x double> %i, <2 x ptr> %p, i32 8, <2 x i1> <i1 true, i1 true>)