1 ; RUN: opt < %s -instcombine -S | FileCheck %s 2 3 define void @f(i64 %val, i32 %limit, i32 *%ptr) { 4 ;CHECK: %0 = trunc i64 5 ;CHECK: %1 = phi i32 6 entry: 7 %tempvector = insertelement <16 x i64> undef, i64 %val, i32 0 8 %vector = shufflevector <16 x i64> %tempvector, <16 x i64> undef, <16 x i32> zeroinitializer 9 %0 = add <16 x i64> %vector, <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15> 10 %1 = trunc <16 x i64> %0 to <16 x i32> 11 br label %loop 12 13 loop: 14 %2 = phi <16 x i32> [ %1, %entry ], [ %inc, %loop ] 15 %elt = extractelement <16 x i32> %2, i32 0 16 %end = icmp ult i32 %elt, %limit 17 %3 = add i32 10, %elt 18 %4 = sext i32 %elt to i64 19 %5 = getelementptr i32* %ptr, i64 %4 20 store i32 %3, i32* %5 21 %inc = add <16 x i32> %2, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16> 22 br i1 %end, label %loop, label %ret 23 24 ret: 25 ret void 26 } 27 28 define i1 @g(<3 x i32> %input_2) { 29 ; CHECK: extractelement 30 entry: 31 br label %for.cond 32 33 for.cond: 34 ; CHECK: phi i32 35 %input_2.addr.0 = phi <3 x i32> [ %input_2, %entry ], [ %div45, %for.body ] 36 %input_1.addr.1 = phi <3 x i32> [ undef, %entry ], [ %dec43, %for.body ] 37 br i1 undef, label %for.end, label %for.body 38 39 ; CHECK extractelement 40 for.body: 41 %dec43 = add <3 x i32> %input_1.addr.1, <i32 -1, i32 -1, i32 -1> 42 %sub44 = sub <3 x i32> zeroinitializer, %dec43 43 %div45 = sdiv <3 x i32> %input_2.addr.0, %sub44 44 br label %for.cond 45 46 for.end: 47 %0 = extractelement <3 x i32> %input_2.addr.0, i32 0 48 %.89 = select i1 false, i32 0, i32 %0 49 %tobool313 = icmp eq i32 %.89, 0 50 ret i1 %tobool313 51 } 52 53