1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=i386-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
4 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32-S128"
5 target triple = "i386-apple-macosx10.8.0"
7 define double @foo(double* nocapture %D) {
9 ; CHECK-NEXT: br label [[TMP1:%.*]]
10 ; CHECK: [[I_02:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP12:%.*]], [[TMP1]] ]
11 ; CHECK-NEXT: [[SUM_01:%.*]] = phi double [ 0.000000e+00, [[TMP0]] ], [ [[TMP11:%.*]], [[TMP1]] ]
12 ; CHECK-NEXT: [[TMP2:%.*]] = shl nsw i32 [[I_02]], 1
13 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds double, double* [[D:%.*]], i32 [[TMP2]]
14 ; CHECK-NEXT: [[TMP4:%.*]] = bitcast double* [[TMP3]] to <2 x double>*
15 ; CHECK-NEXT: [[TMP5:%.*]] = load <2 x double>, <2 x double>* [[TMP4]], align 4
16 ; CHECK-NEXT: [[TMP6:%.*]] = fmul <2 x double> [[TMP5]], [[TMP5]]
17 ; CHECK-NEXT: [[TMP7:%.*]] = fmul <2 x double> [[TMP6]], [[TMP6]]
18 ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x double> [[TMP7]], i32 0
19 ; CHECK-NEXT: [[TMP9:%.*]] = extractelement <2 x double> [[TMP7]], i32 1
20 ; CHECK-NEXT: [[TMP10:%.*]] = fadd double [[TMP8]], [[TMP9]]
21 ; CHECK-NEXT: [[TMP11]] = fadd double [[SUM_01]], [[TMP10]]
22 ; CHECK-NEXT: [[TMP12]] = add nsw i32 [[I_02]], 1
23 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[TMP12]], 100
24 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[TMP13:%.*]], label [[TMP1]]
25 ; CHECK: ret double [[TMP11]]
29 ; <label>:1 ; preds = %1, %0
30 %i.02 = phi i32 [ 0, %0 ], [ %10, %1 ]
31 %sum.01 = phi double [ 0.000000e+00, %0 ], [ %9, %1 ]
32 %2 = shl nsw i32 %i.02, 1
33 %3 = getelementptr inbounds double, double* %D, i32 %2
34 %4 = load double, double* %3, align 4
35 %A4 = fmul double %4, %4
36 %A42 = fmul double %A4, %A4
38 %6 = getelementptr inbounds double, double* %D, i32 %5
39 %7 = load double, double* %6, align 4
40 %A7 = fmul double %7, %7
41 %A72 = fmul double %A7, %A7
42 %8 = fadd double %A42, %A72
43 %9 = fadd double %sum.01, %8
44 %10 = add nsw i32 %i.02, 1
45 %exitcond = icmp eq i32 %10, 100
46 br i1 %exitcond, label %11, label %1
48 ; <label>:11 ; preds = %1