1 ; RUN: llc < %s -mtriple=x86_64-- -mcpu=corei7 | FileCheck %s
4 define i64 @foo(i64 %x, i64 %y) {
5 %tmp0 = zext i64 %x to i128
6 %tmp1 = zext i64 %y to i128
7 %tmp2 = mul i128 %tmp0, %tmp1
8 %tmp7 = zext i32 64 to i128
9 %tmp3 = lshr i128 %tmp2, %tmp7
10 %tmp4 = trunc i128 %tmp3 to i64
14 ; <rdar://problem/14096009> superfluous multiply by high part of
15 ; zero-extended value.
20 define i64 @mul1(i64 %n, i64* nocapture %z, i64* nocapture %x, i64 %y) {
22 %conv = zext i64 %y to i128
23 %cmp11 = icmp eq i64 %n, 0
24 br i1 %cmp11, label %for.end, label %for.body
26 for.body: ; preds = %entry, %for.body
27 %carry.013 = phi i64 [ %conv6, %for.body ], [ 0, %entry ]
28 %i.012 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
29 %arrayidx = getelementptr inbounds i64, i64* %x, i64 %i.012
30 %0 = load i64, i64* %arrayidx, align 8
31 %conv2 = zext i64 %0 to i128
32 %mul = mul i128 %conv2, %conv
33 %conv3 = zext i64 %carry.013 to i128
34 %add = add i128 %mul, %conv3
35 %conv4 = trunc i128 %add to i64
36 %arrayidx5 = getelementptr inbounds i64, i64* %z, i64 %i.012
37 store i64 %conv4, i64* %arrayidx5, align 8
38 %shr = lshr i128 %add, 64
39 %conv6 = trunc i128 %shr to i64
40 %inc = add i64 %i.012, 1
41 %exitcond = icmp eq i64 %inc, %n
42 br i1 %exitcond, label %for.end, label %for.body
44 for.end: ; preds = %for.body, %entry